@specverse/engines 4.2.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/assets/templates/default/specs/main.specly +65 -0
  2. package/dist/libs/instance-factories/CURVED-INTERFACE.md +278 -0
  3. package/dist/libs/instance-factories/README.md +73 -0
  4. package/dist/libs/instance-factories/applications/README.md +51 -0
  5. package/dist/libs/instance-factories/applications/generic-app.yaml +52 -0
  6. package/dist/libs/instance-factories/applications/react-app-runtime.yaml +139 -0
  7. package/dist/libs/instance-factories/applications/react-app-starter.yaml +143 -0
  8. package/dist/libs/instance-factories/applications/templates/react/env-example-generator.js +24 -2
  9. package/dist/libs/instance-factories/applications/templates/react/vite-config-generator.js +54 -33
  10. package/dist/libs/instance-factories/applications/templates/react-starter/README.md +211 -0
  11. package/dist/libs/instance-factories/applications/templates/react-starter/api-types-starter-generator.js +69 -0
  12. package/dist/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.js +1 -1
  13. package/dist/libs/instance-factories/applications/templates/react-starter/belongs-to.js +40 -0
  14. package/dist/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.js +11 -3
  15. package/dist/libs/instance-factories/applications/templates/react-starter/detail-body-composer.js +18 -16
  16. package/dist/libs/instance-factories/applications/templates/react-starter/form-body-composer.js +50 -23
  17. package/dist/libs/instance-factories/applications/templates/react-starter/helpers-emitter.js +9 -3
  18. package/dist/libs/instance-factories/applications/templates/react-starter/list-body-composer.js +17 -7
  19. package/dist/libs/instance-factories/applications/templates/react-starter/orchestrator.js +16 -5
  20. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/dashboard.tsx.template +49 -0
  21. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/detail.tsx.template +96 -0
  22. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/form.tsx.template +116 -0
  23. package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/list.tsx.template +74 -0
  24. package/dist/libs/instance-factories/applications/templates/react-starter/use-api-hooks-starter-generator.js +95 -0
  25. package/dist/libs/instance-factories/applications/templates/react-starter/view-emitter.js +26 -1
  26. package/dist/libs/instance-factories/archived/fastify-prisma.yaml +104 -0
  27. package/dist/libs/instance-factories/cli/README.md +43 -0
  28. package/dist/libs/instance-factories/cli/commander-js.yaml +55 -0
  29. package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +49 -1
  30. package/dist/libs/instance-factories/communication/README.md +47 -0
  31. package/dist/libs/instance-factories/communication/event-emitter.yaml +60 -0
  32. package/dist/libs/instance-factories/communication/rabbitmq-events.yaml +87 -0
  33. package/dist/libs/instance-factories/controllers/README.md +42 -0
  34. package/dist/libs/instance-factories/controllers/fastify.yaml +139 -0
  35. package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +29 -2
  36. package/dist/libs/instance-factories/infrastructure/README.md +29 -0
  37. package/dist/libs/instance-factories/infrastructure/docker-k8s.yaml +61 -0
  38. package/dist/libs/instance-factories/orms/README.md +54 -0
  39. package/dist/libs/instance-factories/orms/prisma.yaml +89 -0
  40. package/dist/libs/instance-factories/orms/templates/prisma/schema-generator.js +2 -2
  41. package/dist/libs/instance-factories/scaffolding/README.md +49 -0
  42. package/dist/libs/instance-factories/scaffolding/generic-scaffold.yaml +65 -0
  43. package/dist/libs/instance-factories/sdks/README.md +28 -0
  44. package/dist/libs/instance-factories/sdks/python-sdk.yaml +66 -0
  45. package/dist/libs/instance-factories/sdks/typescript-sdk.yaml +59 -0
  46. package/dist/libs/instance-factories/services/README.md +55 -0
  47. package/dist/libs/instance-factories/services/prisma-services.yaml +71 -0
  48. package/dist/libs/instance-factories/storage/README.md +34 -0
  49. package/dist/libs/instance-factories/storage/mongodb.yaml +79 -0
  50. package/dist/libs/instance-factories/storage/postgresql.yaml +75 -0
  51. package/dist/libs/instance-factories/storage/redis.yaml +79 -0
  52. package/dist/libs/instance-factories/testing/README.md +40 -0
  53. package/dist/libs/instance-factories/testing/vitest-tests.yaml +63 -0
  54. package/dist/libs/instance-factories/tools/README.md +70 -0
  55. package/dist/libs/instance-factories/tools/mcp.yaml +36 -0
  56. package/dist/libs/instance-factories/tools/vscode.yaml +35 -0
  57. package/dist/libs/instance-factories/validation/README.md +38 -0
  58. package/dist/libs/instance-factories/validation/zod.yaml +56 -0
  59. package/dist/realize/engines/code-generator.d.ts.map +1 -1
  60. package/dist/realize/engines/code-generator.js +3 -0
  61. package/dist/realize/engines/code-generator.js.map +1 -1
  62. package/libs/instance-factories/applications/react-app-starter.yaml +10 -17
  63. package/libs/instance-factories/applications/templates/react/env-example-generator.ts +24 -2
  64. package/libs/instance-factories/applications/templates/react/vite-config-generator.ts +54 -33
  65. package/libs/instance-factories/applications/templates/react-starter/__tests__/detail-body-composer.test.ts +5 -4
  66. package/libs/instance-factories/applications/templates/react-starter/__tests__/form-body-composer.test.ts +18 -5
  67. package/libs/instance-factories/applications/templates/react-starter/__tests__/orchestrator.test.ts +83 -62
  68. package/libs/instance-factories/applications/templates/react-starter/api-types-starter-generator.ts +98 -0
  69. package/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.ts +1 -1
  70. package/libs/instance-factories/applications/templates/react-starter/belongs-to.ts +82 -0
  71. package/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.ts +20 -5
  72. package/libs/instance-factories/applications/templates/react-starter/detail-body-composer.ts +33 -33
  73. package/libs/instance-factories/applications/templates/react-starter/form-body-composer.ts +107 -30
  74. package/libs/instance-factories/applications/templates/react-starter/helpers-emitter.ts +9 -3
  75. package/libs/instance-factories/applications/templates/react-starter/list-body-composer.ts +34 -8
  76. package/libs/instance-factories/applications/templates/react-starter/orchestrator.ts +41 -26
  77. package/libs/instance-factories/applications/templates/react-starter/skeletons/dashboard.tsx.template +2 -0
  78. package/libs/instance-factories/applications/templates/react-starter/skeletons/detail.tsx.template +2 -0
  79. package/libs/instance-factories/applications/templates/react-starter/skeletons/form.tsx.template +2 -0
  80. package/libs/instance-factories/applications/templates/react-starter/skeletons/list.tsx.template +2 -0
  81. package/libs/instance-factories/applications/templates/react-starter/use-api-hooks-starter-generator.ts +124 -0
  82. package/libs/instance-factories/applications/templates/react-starter/view-emitter.ts +58 -0
  83. package/libs/instance-factories/cli/templates/commander/command-generator.ts +49 -1
  84. package/libs/instance-factories/controllers/fastify.yaml +7 -0
  85. package/libs/instance-factories/controllers/templates/fastify/server-generator.ts +36 -2
  86. package/libs/instance-factories/orms/templates/prisma/schema-generator.ts +11 -4
  87. package/package.json +1 -1
@@ -0,0 +1,65 @@
1
+ # Starter specification.
2
+ #
3
+ # Two models, one belongsTo relationship, one lifecycle. Small enough
4
+ # to read in 30 seconds, rich enough to exercise the generated-UI
5
+ # rules you'll build on: lifecycle dropdowns, belongsTo FK dropdowns,
6
+ # FK resolution in list / detail / dashboard columns.
7
+ components:
8
+ {{componentName}}:
9
+ version: "1.0.0"
10
+ description: "Starter specification — use the AI tab to extend it"
11
+ tags: [default, minimal]
12
+
13
+ models:
14
+ Category:
15
+ description: "A grouping label for Items"
16
+ attributes:
17
+ id: UUID required auto=uuid4
18
+ name: String required unique
19
+ description: Text
20
+ createdAt: DateTime auto=now
21
+ updatedAt: DateTime auto=now
22
+ relationships:
23
+ items: hasMany Item
24
+
25
+ Item:
26
+ description: "Something worth tracking"
27
+ attributes:
28
+ id: UUID required auto=uuid4
29
+ name: String required
30
+ description: Text
31
+ status: String required default=active
32
+ createdAt: DateTime auto=now
33
+ updatedAt: DateTime auto=now
34
+ relationships:
35
+ category: belongsTo Category
36
+ lifecycles:
37
+ status:
38
+ flow: "active -> archived"
39
+
40
+ views:
41
+ CategoryListView:
42
+ type: list
43
+ model: Category
44
+ CategoryDetailView:
45
+ type: detail
46
+ model: Category
47
+ CategoryFormView:
48
+ type: form
49
+ model: Category
50
+ CategoryDashboardView:
51
+ type: dashboard
52
+ model: Category
53
+
54
+ ItemListView:
55
+ type: list
56
+ model: Item
57
+ ItemDetailView:
58
+ type: detail
59
+ model: Item
60
+ ItemFormView:
61
+ type: form
62
+ model: Item
63
+ ItemDashboardView:
64
+ type: dashboard
65
+ model: Item
@@ -0,0 +1,278 @@
1
+ # CURVED Interface Standard
2
+
3
+ ## Overview
4
+
5
+ **CURVED** is the standard interface that all SpecVerse business logic controllers must implement. It defines the complete set of operations for managing domain models.
6
+
7
+ ## CURVED Operations
8
+
9
+ | Letter | Operation | Description | Required |
10
+ |--------|-----------|-------------|----------|
11
+ | **C** | Create | Create a new entity | Yes |
12
+ | **U** | Update | Update an existing entity | Yes |
13
+ | **R** | Retrieve | Retrieve entity (single + list) | Yes |
14
+ | **V** | Validate | Validate data before operations | Yes |
15
+ | **E** | Evolve | Lifecycle-aware state transitions | Yes |
16
+ | **D** | Delete | Delete an entity | Yes |
17
+
18
+ ## TypeScript Interface
19
+
20
+ ```typescript
21
+ /**
22
+ * Standard CURVED interface for all service controllers
23
+ * All business logic controllers must implement this interface
24
+ */
25
+ interface CurvedController<T> {
26
+ // C - Create
27
+ create(data: any): Promise<T>;
28
+
29
+ // U - Update
30
+ update(id: string, data: any): Promise<T>;
31
+
32
+ // R - Retrieve (single)
33
+ retrieve(id: string): Promise<T>;
34
+
35
+ // R - Retrieve (list)
36
+ retrieveAll(options?: RetrieveOptions): Promise<T[]>;
37
+
38
+ // V - Validate
39
+ validate(
40
+ data: any,
41
+ context: { operation: 'create' | 'update' | 'evolve' }
42
+ ): ValidationResult;
43
+
44
+ // E - Evolve (lifecycle-aware updates)
45
+ evolve(id: string, data: any): Promise<T>;
46
+
47
+ // D - Delete
48
+ delete(id: string): Promise<void>;
49
+ }
50
+
51
+ interface RetrieveOptions {
52
+ skip?: number;
53
+ take?: number;
54
+ where?: Record<string, any>;
55
+ orderBy?: Record<string, 'asc' | 'desc'>;
56
+ include?: string[];
57
+ }
58
+
59
+ interface ValidationResult {
60
+ valid: boolean;
61
+ errors: string[];
62
+ }
63
+ ```
64
+
65
+ ## Architecture Layers
66
+
67
+ ### 1. Controllers (Model-specific)
68
+ - **Must implement**: Full CURVED interface
69
+ - **Examples**: `UserController`, `ProjectController`, `TaskController`
70
+ - **Location**: `src/controllers/`
71
+ - **Generated by**: Service factories (PrismaServices, TypeORMServices, etc.)
72
+ - **Additional**: Can have custom actions beyond CURVED
73
+
74
+ ```yaml
75
+ # In SpecVerse spec
76
+ controllers:
77
+ UserController:
78
+ model: User
79
+ curved: # ← CURVED operations
80
+ create: {}
81
+ update: {}
82
+ retrieve: {}
83
+ validate: {}
84
+ evolve: {}
85
+ delete: {}
86
+ actions: # ← Custom actions (beyond CURVED)
87
+ resetPassword: {}
88
+ verifyEmail: {}
89
+ ```
90
+
91
+ ### 2. Services (Abstract business logic)
92
+ - **Must implement**: Custom operations (NOT CURVED)
93
+ - **Examples**: `NotificationService`, `TaskAssignmentService`
94
+ - **Location**: `src/services/`
95
+ - **Generated by**: Service factories (PrismaServices, etc.)
96
+ - **Operations**: Custom business logic operations
97
+
98
+ ```yaml
99
+ # In SpecVerse spec
100
+ services:
101
+ NotificationService:
102
+ operations: # ← Custom operations (NOT CURVED)
103
+ sendWelcomeEmail: {}
104
+ sendPasswordReset: {}
105
+ ```
106
+
107
+ ### 3. Storage/ORM Layer
108
+ - **Must support**: CURVED primitives
109
+ - **Examples**: Prisma client, TypeORM repositories, Mongoose models
110
+ - **Location**: ORM-specific (e.g., `prisma/schema.prisma`)
111
+ - **Generated by**: ORM factories (PrismaORM, TypeORM, Mongoose)
112
+ - **Provides**: Database access methods that enable CURVED operations
113
+
114
+ ## Implementation Requirements
115
+
116
+ ### All Service Factories Must:
117
+
118
+ 1. **Generate controllers** that implement the full CURVED interface
119
+ 2. **Support all CURVED operations** for every model
120
+ 3. **Provide consistent signatures** across different ORMs
121
+ 4. **Include validation** as part of the CURVED interface
122
+ 5. **Support evolve** for lifecycle-aware updates
123
+
124
+ ### Example Implementations:
125
+
126
+ #### PrismaServices
127
+ - Uses: `@prisma/client`
128
+ - Controllers: `src/controllers/{Model}Controller.ts`
129
+ - Pattern: Class-based with Prisma client calls
130
+
131
+ #### TypeORMServices (future)
132
+ - Uses: `typeorm` repositories
133
+ - Controllers: `src/controllers/{Model}Controller.ts`
134
+ - Pattern: Class-based with TypeORM repository calls
135
+
136
+ #### MongooseServices (future)
137
+ - Uses: `mongoose` models
138
+ - Controllers: `src/controllers/{Model}Controller.ts`
139
+ - Pattern: Class-based with Mongoose model calls
140
+
141
+ ## Data Flow
142
+
143
+ ```
144
+ API Layer (Fastify/SOAP/GraphQL)
145
+ ↓ calls
146
+ ├─→ Controllers (CURVED + actions)
147
+ │ ↓ calls
148
+ │ Storage/ORM (CURVED primitives)
149
+ │ ↓
150
+ │ Database
151
+
152
+ └─→ Services (custom operations)
153
+ ↓ can call
154
+ ├─→ Controllers (CURVED)
155
+ └─→ Storage/ORM (directly)
156
+ ```
157
+
158
+ **Key points:**
159
+ - API layer can call **both** Controllers and Services
160
+ - Services can call Controllers OR ORM directly
161
+ - Controllers always call ORM/Storage layer
162
+
163
+ ## Validation in CURVED
164
+
165
+ The **V** (Validate) operation is special:
166
+
167
+ ### Internal Validation
168
+ All CURVED operations internally call `validate()` before execution:
169
+
170
+ ```typescript
171
+ async create(data: any): Promise<T> {
172
+ // Internal validation
173
+ const validation = this.validate(data, { operation: 'create' });
174
+ if (!validation.valid) {
175
+ throw new Error(`Validation failed: ${validation.errors.join(', ')}`);
176
+ }
177
+
178
+ // Proceed with creation
179
+ return await this.orm.create(data);
180
+ }
181
+ ```
182
+
183
+ ### External Validation
184
+ The validate operation can also be exposed as an API endpoint for dry-run validation:
185
+
186
+ ```typescript
187
+ // POST /api/users/validate
188
+ {
189
+ "data": { "email": "invalid", "name": "John" },
190
+ "operation": "create"
191
+ }
192
+
193
+ // Response
194
+ {
195
+ "valid": false,
196
+ "errors": ["email must be a valid email address"]
197
+ }
198
+ ```
199
+
200
+ ## Evolve vs Update
201
+
202
+ ### Update
203
+ Standard field updates without lifecycle validation:
204
+ ```typescript
205
+ // Update any field
206
+ await userController.update(userId, { name: 'New Name', email: 'new@email.com' });
207
+ ```
208
+
209
+ ### Evolve
210
+ Lifecycle-aware state transitions with validation:
211
+ ```typescript
212
+ // Evolve through lifecycle states
213
+ await taskController.evolve(taskId, {
214
+ status: 'in_progress' // Must follow lifecycle: todo → in_progress
215
+ });
216
+ ```
217
+
218
+ ## Extension Points
219
+
220
+ While CURVED defines the core interface, controllers can extend it with:
221
+
222
+ 1. **Custom Actions** - Additional operations specific to the model
223
+ 2. **Event Publishing** - Emit events after CURVED operations
224
+ 3. **Hooks** - Before/after hooks for operations
225
+ 4. **Caching** - Add caching layer for retrieve operations
226
+ 5. **Authorization** - Add permission checks before operations
227
+
228
+ ## Testing CURVED Implementations
229
+
230
+ All service factories should provide tests verifying:
231
+
232
+ ```typescript
233
+ describe('CurvedController', () => {
234
+ it('implements create operation', async () => {
235
+ const result = await controller.create(validData);
236
+ expect(result).toBeDefined();
237
+ });
238
+
239
+ it('implements update operation', async () => {
240
+ const result = await controller.update(id, updateData);
241
+ expect(result).toBeDefined();
242
+ });
243
+
244
+ it('implements retrieve operation', async () => {
245
+ const result = await controller.retrieve(id);
246
+ expect(result).toBeDefined();
247
+ });
248
+
249
+ it('implements retrieveAll operation', async () => {
250
+ const result = await controller.retrieveAll();
251
+ expect(Array.isArray(result)).toBe(true);
252
+ });
253
+
254
+ it('implements validate operation', async () => {
255
+ const result = controller.validate(data, { operation: 'create' });
256
+ expect(result).toHaveProperty('valid');
257
+ expect(result).toHaveProperty('errors');
258
+ });
259
+
260
+ it('implements evolve operation', async () => {
261
+ const result = await controller.evolve(id, evolveData);
262
+ expect(result).toBeDefined();
263
+ });
264
+
265
+ it('implements delete operation', async () => {
266
+ await expect(controller.delete(id)).resolves.not.toThrow();
267
+ });
268
+ });
269
+ ```
270
+
271
+ ## Summary
272
+
273
+ **CURVED is the universal interface for all SpecVerse business logic controllers:**
274
+ - Ensures consistency across different ORMs (Prisma, TypeORM, Mongoose)
275
+ - Enables protocol-agnostic API layers (REST, SOAP, GraphQL, gRPC)
276
+ - Provides complete lifecycle management (Create, Update, Retrieve, Validate, Evolve, Delete)
277
+ - Separates concerns between Controllers (model-specific) and Services (abstract)
278
+ - Supports extension while maintaining core interface compatibility
@@ -0,0 +1,73 @@
1
+ # Instance Factories
2
+
3
+ Code generation templates for the realize engine. Each factory category produces a specific kind of output from a SpecVerse specification.
4
+
5
+ ## Factory Categories
6
+
7
+ | Category | Templates | Generates |
8
+ |----------|-----------|-----------|
9
+ | [applications](applications/) | generic, react | App scaffolding, React frontend (API client, views, routing, sidebar) |
10
+ | [cli](cli/) | commander | CLI entry point, command files from spec commands |
11
+ | [communication](communication/) | eventemitter | Event bus, publishers, subscribers |
12
+ | [controllers](controllers/) | fastify | Fastify route handlers, server with auto-wired routes |
13
+ | [infrastructure](infrastructure/) | docker-k8s | Dockerfiles, docker-compose, Kubernetes manifests |
14
+ | [orms](orms/) | prisma | Prisma schema from models (relations, types, defaults) |
15
+ | [scaffolding](scaffolding/) | generic | package.json, tsconfig, .env, .gitignore, README |
16
+ | [sdks](sdks/) | python, typescript | Client SDKs for generated APIs |
17
+ | [services](services/) | prisma | CURVED controllers, business logic services, behavior generation |
18
+ | [storage](storage/) | mongodb, postgresql, redis | Database configs, Docker setup |
19
+ | [testing](testing/) | vitest | Test file generation |
20
+ | [tools](tools/) | mcp, vscode | MCP server, VSCode extension (14 commands) |
21
+ | [validation](validation/) | zod | Zod validation schemas from model attributes |
22
+ | [views](views/) | react, shared | React components (list, detail, form, dashboard), adapters |
23
+ | [shared](shared/) | - | Path resolver, reserved words |
24
+ | [archived](archived/) | - | Deprecated factory definitions |
25
+
26
+ ## How It Works
27
+
28
+ ```
29
+ Specification + Manifest
30
+ |
31
+ v
32
+ [Manifest Loader] ---> resolve capabilities to factories
33
+ |
34
+ v
35
+ [Instance Factory Library] ---> find matching factory YAML
36
+ |
37
+ v
38
+ [Code Generator] ---> call template generator function
39
+ |
40
+ v
41
+ Generated source file
42
+ ```
43
+
44
+ Each factory has:
45
+ 1. **YAML definition** — declares capabilities, technology, and template mappings
46
+ 2. **Template generators** — TypeScript functions that produce source code from spec context
47
+
48
+ ## Template Generator Pattern
49
+
50
+ Every generator is a function that receives spec context and returns source code:
51
+
52
+ ```typescript
53
+ export function generate(context: {
54
+ spec: any; // Full SpecVerseAST
55
+ model?: any; // Current model (if model-scoped)
56
+ controller?: any; // Current controller
57
+ models?: any[]; // All models in component
58
+ componentName: string;
59
+ }): { filePath: string; code: string } {
60
+ // Generate and return source code
61
+ }
62
+ ```
63
+
64
+ ## Adding a New Factory
65
+
66
+ 1. Create a YAML definition in the appropriate category
67
+ 2. Write template generator(s) in `templates/{technology}/`
68
+ 3. The realize engine discovers factories by scanning this directory
69
+
70
+ ## See Also
71
+
72
+ - [Realize Engine README](../../README.md)
73
+ - [Architecture Guide](https://github.com/SpecVerse/specverse-self/blob/main/docs/guides/ARCHITECTURE-GUIDE.md)
@@ -0,0 +1,51 @@
1
+ # Applications Factory
2
+
3
+ Full application scaffolding for backend and frontend entry points.
4
+
5
+ ## Definitions
6
+
7
+ | File | Description |
8
+ |------|-------------|
9
+ | `generic-app.yaml` | Backend entry point — adapts to framework choice (defaults to Fastify) |
10
+ | `react-app.yaml` | Complete React SPA with Vite, React Router, and TanStack Query |
11
+
12
+ ## Generated Output
13
+
14
+ ### Generic Backend (`generic/`)
15
+
16
+ | Generator | Output | Purpose |
17
+ |-----------|--------|---------|
18
+ | `main-generator` | `backend/src/main.ts` | Application entry point (detects framework from manifest) |
19
+ | `backend-package-json-generator` | `backend/package.json` | Backend dependencies and scripts |
20
+ | `backend-tsconfig-generator` | `backend/tsconfig.json` | TypeScript configuration |
21
+ | `backend-env-generator` | `backend/.env` | Environment variables |
22
+
23
+ ### React Frontend (`react/`)
24
+
25
+ | Generator | Output | Purpose |
26
+ |-----------|--------|---------|
27
+ | `app-tsx-generator` | `frontend/src/App.tsx` | Root component with sidebar navigation grouped by model |
28
+ | `main-tsx-generator` | `frontend/src/main.tsx` | React DOM render entry |
29
+ | `vite-config-generator` | `frontend/vite.config.ts` | Vite bundler config with API proxy |
30
+ | `package-json-generator` | `frontend/package.json` | Frontend dependencies |
31
+ | `tsconfig-generator` | `frontend/tsconfig.json` | TypeScript config |
32
+ | `index-html-generator` | `frontend/index.html` | HTML shell |
33
+ | `index-css-generator` | `frontend/src/index.css` | Base styles |
34
+ | `api-client-generator` | `frontend/src/lib/apiClient.ts` | HTTP client for backend API |
35
+ | `api-types-generator` | `frontend/src/types/api.ts` | TypeScript types from spec models |
36
+ | `use-api-hooks-generator` | `frontend/src/hooks/useApi.ts` | React Query data-fetching hooks |
37
+ | `view-list-generator` | `frontend/src/components/views/ListView.tsx` | List view component |
38
+ | `view-detail-generator` | `frontend/src/components/views/DetailView.tsx` | Detail view component |
39
+ | `view-form-generator` | `frontend/src/components/views/FormView.tsx` | Form view component |
40
+ | `view-dashboard-generator` | `frontend/src/components/views/DashboardView.tsx` | Dashboard view component |
41
+ | `view-router-generator` | `frontend/src/components/views/StandardViewRouter.tsx` | View routing |
42
+ | `pattern-adapter-generator` | `frontend/src/lib/react-pattern-adapter.tsx` | Pattern adapter for dynamic rendering |
43
+ | `tailwind-adapter-wrapper-generator` | `frontend/src/lib/tailwind-adapter-generator.ts` | Tailwind CSS adapter |
44
+ | `field-helpers-generator` | `frontend/src/utils/field-helpers.ts` | Form field utilities |
45
+ | `relationship-field-generator` | `frontend/src/components/fields/RelationshipField.tsx` | Relationship field component |
46
+
47
+ ## Technology
48
+
49
+ - **Backend**: Node.js, TypeScript, Fastify (default)
50
+ - **Frontend**: React 18, Vite 5, React Router 6, TanStack Query 5
51
+ - **Structure**: Monorepo (`backend/` + `frontend/`)
@@ -0,0 +1,52 @@
1
+ name: GenericApp
2
+ version: "1.0.0"
3
+ category: application
4
+ description: "Generic application entry point that adapts to framework choice"
5
+
6
+ metadata:
7
+ author: "SpecVerse Team"
8
+ license: "MIT"
9
+ tags: [application, entry-point, generic]
10
+
11
+ compatibility:
12
+ specverse: ">=3.3.0"
13
+ node: ">=18.0.0"
14
+
15
+ capabilities:
16
+ provides:
17
+ - "app.entrypoint"
18
+ - "app.main"
19
+ requires:
20
+ - "api.rest" # Needs HTTP framework
21
+
22
+ technology:
23
+ runtime: "node"
24
+ language: "typescript"
25
+
26
+ codeTemplates:
27
+ main:
28
+ engine: typescript
29
+ generator: "libs/instance-factories/applications/templates/generic/main-generator.ts"
30
+ outputPattern: "{backendDir}/src/main.ts"
31
+
32
+ backendPackageJson:
33
+ engine: typescript
34
+ generator: "libs/instance-factories/applications/templates/generic/backend-package-json-generator.ts"
35
+ outputPattern: "{backendDir}/package.json"
36
+
37
+ backendTsconfig:
38
+ engine: typescript
39
+ generator: "libs/instance-factories/applications/templates/generic/backend-tsconfig-generator.ts"
40
+ outputPattern: "{backendDir}/tsconfig.json"
41
+
42
+ backendEnv:
43
+ engine: typescript
44
+ generator: "libs/instance-factories/applications/templates/generic/backend-env-generator.ts"
45
+ outputPattern: "{backendDir}/.env"
46
+
47
+ configuration:
48
+ outputStructure: "monorepo"
49
+ backendDir: "backend"
50
+
51
+ defaultPort: 3000
52
+ defaultHost: "0.0.0.0"
@@ -0,0 +1,139 @@
1
+ name: ReactAppRuntime
2
+ version: "1.0.0"
3
+ category: view
4
+ description: "Slim React frontend using @specverse/runtime — dev views rendered at runtime, not generated"
5
+
6
+ metadata:
7
+ author: "SpecVerse Team"
8
+ license: "MIT"
9
+ tags: [react, vite, spa, frontend, runtime]
10
+ mode: runtime
11
+
12
+ compatibility:
13
+ specverse: ">=4.0.0"
14
+ node: ">=18.0.0"
15
+
16
+ capabilities:
17
+ provides:
18
+ - "app.frontend"
19
+ - "ui.scaffolding"
20
+ - "ui.router"
21
+ - "ui.runtimeviews"
22
+ requires: []
23
+
24
+ technology:
25
+ runtime: "browser"
26
+ language: "typescript"
27
+ framework: "react"
28
+ bundler: "vite"
29
+ router: "@specverse/runtime"
30
+ version: "^18.2.0"
31
+
32
+ dependencies:
33
+ runtime:
34
+ - name: "react"
35
+ version: "^18.2.0"
36
+ - name: "react-dom"
37
+ version: "^18.2.0"
38
+ - name: "@tanstack/react-query"
39
+ version: "^5.0.0"
40
+ - name: "@specverse/runtime"
41
+ version: "^4.1.0"
42
+
43
+ dev:
44
+ - name: "@types/react"
45
+ version: "^18.2.0"
46
+ - name: "@types/react-dom"
47
+ version: "^18.2.0"
48
+ - name: "typescript"
49
+ version: "^5.2.0"
50
+ - name: "vite"
51
+ version: "^5.0.0"
52
+ - name: "@vitejs/plugin-react"
53
+ version: "^4.2.0"
54
+
55
+ codeTemplates:
56
+ # === Infrastructure (same as static) ===
57
+ index-html:
58
+ engine: typescript
59
+ generator: "libs/instance-factories/applications/templates/react/index-html-generator.ts"
60
+ outputPattern: "{frontendDir}/index.html"
61
+
62
+ main-tsx:
63
+ engine: typescript
64
+ generator: "libs/instance-factories/applications/templates/react/main-tsx-generator.ts"
65
+ outputPattern: "{frontendDir}/src/main.tsx"
66
+
67
+ vite-config:
68
+ engine: typescript
69
+ generator: "libs/instance-factories/applications/templates/react/vite-config-generator.ts"
70
+ outputPattern: "{frontendDir}/vite.config.ts"
71
+
72
+ tsconfig:
73
+ engine: typescript
74
+ generator: "libs/instance-factories/applications/templates/react/tsconfig-generator.ts"
75
+ outputPattern: "{frontendDir}/tsconfig.json"
76
+
77
+ package-json:
78
+ engine: typescript
79
+ generator: "libs/instance-factories/applications/templates/react/runtime-package-json-generator.ts"
80
+ outputPattern: "{frontendDir}/package.json"
81
+
82
+ index-css:
83
+ engine: typescript
84
+ generator: "libs/instance-factories/applications/templates/react/index-css-generator.ts"
85
+ outputPattern: "{frontendDir}/src/index.css"
86
+
87
+ gitignore:
88
+ engine: typescript
89
+ generator: "libs/instance-factories/applications/templates/react/gitignore-generator.ts"
90
+ outputPattern: "{frontendDir}/.gitignore"
91
+
92
+ env-example:
93
+ engine: typescript
94
+ generator: "libs/instance-factories/applications/templates/react/env-example-generator.ts"
95
+ outputPattern: "{frontendDir}/.env.example"
96
+
97
+ # === Instance-specific wiring (still generated per project) ===
98
+ api-client:
99
+ engine: typescript
100
+ generator: "libs/instance-factories/applications/templates/react/api-client-generator.ts"
101
+ outputPattern: "{frontendDir}/src/lib/apiClient.ts"
102
+
103
+ use-api-hooks:
104
+ engine: typescript
105
+ generator: "libs/instance-factories/applications/templates/react/use-api-hooks-generator.ts"
106
+ outputPattern: "{frontendDir}/src/hooks/useApi.ts"
107
+
108
+ api-types:
109
+ engine: typescript
110
+ generator: "libs/instance-factories/applications/templates/react/api-types-generator.ts"
111
+ outputPattern: "{frontendDir}/src/types/api.ts"
112
+
113
+ # === Runtime App (NEW — imports from @specverse/runtime) ===
114
+ app-tsx:
115
+ engine: typescript
116
+ generator: "libs/instance-factories/applications/templates/react/runtime-app-tsx-generator.ts"
117
+ outputPattern: "{frontendDir}/src/App.tsx"
118
+
119
+ # === Removed from runtime mode (now in @specverse/runtime) ===
120
+ # view-form — FormView from @specverse/runtime
121
+ # view-list — RuntimeView from @specverse/runtime
122
+ # view-detail — RuntimeView from @specverse/runtime
123
+ # view-dashboard — RuntimeView from @specverse/runtime
124
+ # view-router — ViewRouter from @specverse/runtime
125
+ # pattern-adapter — ReactPatternAdapter from @specverse/runtime
126
+ # tailwind-adapter — TailwindAdapter from @specverse/runtime
127
+ # field-helpers — fieldClassification from @specverse/runtime
128
+ # relationship-field — RelationshipField from @specverse/runtime
129
+
130
+ configuration:
131
+ projectStructure: "monorepo"
132
+ frontendDir: "frontend"
133
+ backendDir: "backend"
134
+
135
+ vite:
136
+ port: 5173
137
+ host: "localhost"
138
+ proxy:
139
+ "/api": "http://localhost:3000"