Skip to content

Commit 26ea448

Browse files
committed
updated docs
1 parent 3abcd4a commit 26ea448

29 files changed

Lines changed: 17970 additions & 1458 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,6 @@ example/src/enums.ts
147147
packages/idea-language/client/package-lock.json
148148
packages/idea-language/server/package-lock.json
149149
packages/idea-transformer/tests/out
150-
.DS_Store
150+
.DS_Store
151+
152+
.clinerules

docs/README.md

Lines changed: 304 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,304 @@
1+
<div align="center">
2+
<h1>💡 Idea</h1>
3+
<a href="https://www.npmjs.com/package/@stackpress/idea"><img src="https://img.shields.io/npm/v/@stackpress/idea.svg?style=flat" /></a>
4+
<a href="https://github.com/stackpress/idea/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat" /></a>
5+
<a href="https://github.com/stackpress/idea/commits/main/"><img src="https://img.shields.io/github/last-commit/stackpress/idea" /></a>
6+
<a href="https://github.com/stackpress/idea/actions"><img src="https://img.shields.io/github/actions/workflow/status/stackpress/idea/test.yml" /></a>
7+
<a href="https://coveralls.io/github/stackpress/idea?branch=main"><img src="https://coveralls.io/repos/github/stackpress/idea/badge.svg?branch=main" /></a>
8+
<a href="https://github.com/stackpress/idea/blob/main/docs/contribute.md"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" /></a>
9+
<br />
10+
<br />
11+
<a href="https://github.com/stackpress/idea/blob/main/docs/Specifications.md">Form an Idea</a>
12+
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
13+
<a href="https://github.com/stackpress/idea/blob/main/docs/plugins/README.md">Transform an Idea</a>
14+
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
15+
<a href="https://marketplace.visualstudio.com/items?itemName=stackpress.idea-schema">Code Extension</a>
16+
<br />
17+
<hr />
18+
</div>
19+
20+
> A meta language to express and transform your ideas to reality.
21+
22+
## What is .idea?
23+
24+
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.
25+
26+
Think of it as the bridge between **AI prompting and full-stack code generation** - where a simple schema definition can automatically generate everything from database tables to React components, API endpoints to documentation sites.
27+
28+
## Key Benefits
29+
30+
### 🎯 Single Source of Truth
31+
Define your data model once, use it everywhere. No more maintaining separate schemas for your database, frontend types, API documentation, and validation rules. One `.idea` file generates them all.
32+
33+
### 🛡️ Type Safety Across Languages
34+
Generate type-safe code across multiple languages and frameworks. From TypeScript interfaces to Python data classes, from GraphQL schemas to Rust structs - maintain consistency and catch errors at compile time.
35+
36+
### ⚡ Rapid Development
37+
Automatically generate boilerplate code, forms, documentation, and more. What used to take hours or days of manual coding now happens in seconds with a single command.
38+
39+
### 🔄 Perfect Consistency
40+
Ensure consistent data structures across your entire application stack. When you update your schema, all generated code updates automatically, eliminating sync issues between frontend and backend.
41+
42+
### 🔌 Infinite Extensibility
43+
The plugin system allows custom code generation for any target technology. Create plugins for new frameworks, languages, or tools - the possibilities are limitless.
44+
45+
### 🤖 AI-to-Code Bridge
46+
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+
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+
## The Plugin Ecosystem
70+
71+
The true power of `.idea` lies in its **plugin system** - a bridge from simple schema definitions to full-stack applications.
72+
73+
### 🌐 Multi-Language Support
74+
75+
Plugins can generate code for **any programming language**:
76+
77+
- **TypeScript/JavaScript**: Interfaces, types, validation schemas
78+
- **Python**: Data classes, Pydantic models, SQLAlchemy schemas
79+
- **Rust**: Structs, enums, serialization code
80+
- **Go**: Structs, JSON tags, validation
81+
- **Java**: POJOs, JPA entities, validation annotations
82+
- **C#**: Classes, Entity Framework models
83+
- **PHP**: Classes, Eloquent models, validation rules
84+
- **And many more...**
85+
86+
### 🛠️ Framework Integration
87+
88+
Generate framework-specific code:
89+
90+
- **React**: Components, forms, hooks, contexts
91+
- **Vue**: Components, composables, stores
92+
- **Angular**: Components, services, models
93+
- **Svelte**: Components, stores, actions
94+
- **Next.js**: API routes, pages, middleware
95+
- **Express**: Routes, middleware, controllers
96+
- **FastAPI**: Routes, models, documentation
97+
- **Django**: Models, serializers, views
98+
99+
### 🗄️ Database Support
100+
101+
Generate schemas for any database:
102+
103+
- **SQL**: PostgreSQL, MySQL, SQLite, SQL Server
104+
- **NoSQL**: MongoDB, DynamoDB, Firestore
105+
- **Graph**: Neo4j, ArangoDB
106+
- **Time-series**: InfluxDB, TimescaleDB
107+
- **Search**: Elasticsearch, Solr
108+
109+
### 📚 Documentation & Tools
110+
111+
Automatically generate:
112+
113+
- **API Documentation**: OpenAPI/Swagger specs
114+
- **Database Documentation**: Schema diagrams, table docs
115+
- **Form Generators**: HTML forms with validation
116+
- **Test Data**: Realistic mock data and fixtures
117+
- **Migration Scripts**: Database migration files
118+
- **Configuration Files**: Environment configs, CI/CD setups
119+
120+
## Real-World Example
121+
122+
Here's how a simple e-commerce schema transforms into a full application:
123+
124+
```typescript
125+
// schema.idea
126+
enum UserRole {
127+
ADMIN "Administrator"
128+
CUSTOMER "Customer"
129+
VENDOR "Vendor"
130+
}
131+
132+
type Address {
133+
street String @required
134+
city String @required
135+
country String @default("US")
136+
}
137+
138+
model User {
139+
id String @id @default("nanoid()")
140+
email String @unique @required @field.input(Email)
141+
name String @required @field.input(Text)
142+
role UserRole @default("CUSTOMER")
143+
address Address?
144+
orders Order[] @relation(Order.userId)
145+
created Date @default("now()")
146+
}
147+
148+
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)
155+
}
156+
157+
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
163+
status OrderStatus @default("PENDING")
164+
created Date @default("now()")
165+
}
166+
167+
// Plugin configurations
168+
plugin "./plugins/typescript-generator.js" {
169+
output "./src/types/schema.ts"
170+
}
171+
172+
plugin "./plugins/database-generator.js" {
173+
output "./database/schema.sql"
174+
dialect "postgresql"
175+
}
176+
177+
plugin "./plugins/react-forms.js" {
178+
output "./src/components/forms/"
179+
framework "react"
180+
styling "tailwind"
181+
}
182+
183+
plugin "./plugins/api-generator.js" {
184+
output "./src/api/"
185+
framework "express"
186+
includeValidation true
187+
}
188+
```
189+
190+
**From this single schema, generate:**
191+
192+
- ✅ TypeScript interfaces and types
193+
- ✅ PostgreSQL database schema
194+
- ✅ React form components with Tailwind CSS
195+
- ✅ Express.js API routes with validation
196+
- ✅ OpenAPI documentation
197+
- ✅ Test data and fixtures
198+
- ✅ Database migration files
199+
- ✅ Validation schemas (Zod, Joi, etc.)
200+
201+
## AI-Powered Development Workflow
202+
203+
The `.idea` format is perfect for AI-driven development:
204+
205+
1. **Describe** your application to an AI assistant
206+
2. **Generate** a `.idea` schema from the description
207+
3. **Configure** plugins for your target technologies
208+
4. **Execute** the transformation to generate full-stack code
209+
5. **Iterate** by updating the schema and regenerating
210+
211+
This workflow enables rapid prototyping and development, making it possible to go from idea to working application in minutes rather than days.
212+
213+
## Getting Started
214+
215+
### 1. Installation
216+
217+
```bash
218+
$ npm i -D @stackpress/idea
219+
```
220+
221+
### 2. Create Your First Schema
222+
223+
Create a `schema.idea` file:
224+
225+
```typescript
226+
model User {
227+
id String @id @default("nanoid()")
228+
name String @required
229+
email String @unique @required
230+
created Date @default("now()")
231+
}
232+
233+
plugin "./plugins/typescript-generator.js" {
234+
output "./generated/types.ts"
235+
}
236+
```
237+
238+
### 3. Generate Code
239+
240+
```bash
241+
npx idea transform --input schema.idea
242+
```
243+
244+
### 4. Explore the Results
245+
246+
Check the generated files in your output directories!
247+
248+
## Documentation Structure
249+
250+
This documentation is organized into several sections:
251+
252+
### 📋 [Specifications](./Specifications.md)
253+
Complete reference for the `.idea` file format syntax, data types, and schema structure.
254+
255+
### 🔧 [Parser Documentation](./parser/)
256+
Technical documentation for the parser library that processes `.idea` files.
257+
258+
### 🔄 [Transformer Documentation](./transformer/)
259+
Documentation for the transformer library that executes plugins and generates code.
260+
261+
### 🔌 [Plugin Development](./plugins/)
262+
Comprehensive guides for creating custom plugins, including tutorials for:
263+
- Database schema generators
264+
- Form generators
265+
- API documentation generators
266+
- TypeScript interface generators
267+
- And many more...
268+
269+
## The Future of Development
270+
271+
The `.idea` file format represents a paradigm shift in how we build applications:
272+
273+
- **From Manual to Automated**: Stop writing boilerplate, start defining intent
274+
- **From Fragmented to Unified**: One schema, infinite outputs
275+
- **From Reactive to Proactive**: Catch errors before they happen
276+
- **From Slow to Instant**: Generate entire application layers in seconds
277+
278+
### Endless Possibilities
279+
280+
With the plugin system, you can generate:
281+
282+
- **Mobile Apps**: React Native, Flutter, native iOS/Android
283+
- **Desktop Apps**: Electron, Tauri, native applications
284+
- **Microservices**: Docker configs, Kubernetes manifests
285+
- **Infrastructure**: Terraform, CloudFormation, Pulumi
286+
- **Documentation**: Websites, PDFs, interactive guides
287+
- **Testing**: Unit tests, integration tests, load tests
288+
- **Monitoring**: Dashboards, alerts, metrics
289+
- **And anything else you can imagine...**
290+
291+
## Start Building Today
292+
293+
Ready to transform your development workflow?
294+
295+
1. **Read the [Specifications](./Specifications.md)** to understand the syntax
296+
2. **Explore [Plugin Tutorials](./plugins/)** to see what's possible
297+
3. **Join the Community** to share your creations
298+
4. **Build Something Amazing** with the power of declarative development
299+
300+
The future of application development is declarative, type-safe, and automated. Welcome to the `.idea` revolution! 🚀
301+
302+
---
303+
304+
> The line of code that’s the fastest to write, that never breaks, that doesn’t need maintenance, is the line you never had to write. - Steve Jobs

0 commit comments

Comments
 (0)