You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+46-49Lines changed: 46 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,24 @@
19
19
20
20
> A meta language to express and transform your ideas to reality.
21
21
22
+
```ts
23
+
modelProduct {
24
+
titleString
25
+
@unique @is.required @form.text @view.title
26
+
27
+
detailText
28
+
@anything @is.possible(true)
29
+
30
+
coolnessInteger
31
+
@is.gt(0) @is.lte(100) @default(100)
32
+
}
33
+
34
+
plugin"./to-database" { url"postgress://" }
35
+
plugin"./to-backend" { with"nestjs" }
36
+
plugin"./to-frontend" { with"nextjs" }
37
+
plugin"./to-docs" { path"/api" }
38
+
```
39
+
22
40
## What is .idea?
23
41
24
42
The `.idea` file format is a declarative schema definition language designed to simplify application development by providing a **single source of truth** for data structures, relationships, and code generation. It enables developers to define their application's data model once and generate multiple outputs including database schemas, TypeScript interfaces, API documentation, forms, and more.
@@ -45,27 +63,6 @@ The plugin system allows custom code generation for any target technology. Creat
45
63
### 🤖 AI-to-Code Bridge
46
64
Perfect for AI-driven development workflows. Describe your data model to an AI, get a `.idea` schema, and instantly generate production-ready code across your entire stack.
47
65
48
-
## Who Should Use This?
49
-
50
-
### 👨💻 Junior Developers
51
-
-**Easy-to-understand syntax** with comprehensive examples
52
-
-**Rapid prototyping** without deep framework knowledge
53
-
-**Learn best practices** through generated code patterns
54
-
-**Focus on business logic** instead of boilerplate
55
-
56
-
### 👩💻 Senior Developers
57
-
-**Powerful features** for complex applications
58
-
-**Extensible plugin system** for custom requirements
59
-
-**Cross-platform code generation** for polyglot architectures
60
-
-**Maintain consistency** across large codebases
61
-
62
-
### 👔 CTOs & Technical Leaders
63
-
-**Reduce development time** by 60-80% for common tasks
64
-
-**Improve code consistency** across teams and projects
65
-
-**Lower maintenance costs** with synchronized schemas
66
-
-**Accelerate time-to-market** for new features
67
-
-**Enable rapid experimentation** and prototyping
68
-
69
66
## The Plugin Ecosystem
70
67
71
68
The true power of `.idea` lies in its **plugin system** - a bridge from simple schema definitions to full-stack applications.
@@ -121,7 +118,7 @@ Automatically generate:
121
118
122
119
Here's how a simple e-commerce schema transforms into a full application:
123
120
124
-
```typescript
121
+
```js
125
122
// schema.idea
126
123
enum UserRole {
127
124
ADMIN"Administrator"
@@ -130,38 +127,38 @@ enum UserRole {
130
127
}
131
128
132
129
type Address {
133
-
street String @required
134
-
city String @required
130
+
street String @required
131
+
city String @required
135
132
country String @default("US")
136
133
}
137
134
138
135
model User {
139
-
idString @id @default("nanoid()")
140
-
emailString @unique @required @field.input(Email)
141
-
nameString @required @field.input(Text)
142
-
roleUserRole @default("CUSTOMER")
136
+
id String @id @default("nanoid()")
137
+
email String@unique @required @field.input(Email)
138
+
name String @required @field.input(Text)
139
+
role UserRole @default("CUSTOMER")
143
140
address Address?
144
-
ordersOrder[] @relation(Order.userId)
145
-
createdDate @default("now()")
141
+
orders Order[] @relation(Order.userId)
142
+
created Date@default("now()")
146
143
}
147
144
148
145
model Product {
149
-
id String @id @default("nanoid()")
150
-
name String @required @field.input(Text)
151
-
price Number @required @field.input(Currency)
152
-
description String @field.textarea
153
-
category String @field.select
154
-
inStock Boolean @default(true)
146
+
id String @id @default("nanoid()")
147
+
name String @required @field.input(Text)
148
+
price Number @required @field.input(Currency)
149
+
description String@field.textarea
150
+
category String @field.select
151
+
inStock Boolean @default(true)
155
152
}
156
153
157
154
model Order {
158
-
id String @id @default("nanoid()")
159
-
userId String @relation(User.id)
160
-
user User @relation(User, userId)
161
-
items OrderItem[] @relation(OrderItem.orderId)
162
-
total Number @required
155
+
id String@id @default("nanoid()")
156
+
userId String@relation(User.id)
157
+
user User @relation(User, userId)
158
+
items OrderItem[] @relation(OrderItem.orderId)
159
+
total Number@required
163
160
status OrderStatus @default("PENDING")
164
-
created Date @default("now()")
161
+
created Date@default("now()")
165
162
}
166
163
167
164
// Plugin configurations
@@ -222,7 +219,7 @@ $ npm i -D @stackpress/idea
222
219
223
220
Create a `schema.idea` file:
224
221
225
-
```typescript
222
+
```js
226
223
model User {
227
224
id String @id @default("nanoid()")
228
225
name String @required
@@ -252,12 +249,6 @@ This documentation is organized into several sections:
0 commit comments