myaiforone 1.0.0
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.
- package/README.md +113 -0
- package/agents/_template/CLAUDE.md +18 -0
- package/agents/_template/agent.json +7 -0
- package/agents/platform/agentcreator/CLAUDE.md +300 -0
- package/agents/platform/appcreator/CLAUDE.md +158 -0
- package/agents/platform/gym/CLAUDE.md +486 -0
- package/agents/platform/gym/agent.json +40 -0
- package/agents/platform/gym/programs/agent-building/program.json +160 -0
- package/agents/platform/gym/programs/automations-mastery/program.json +129 -0
- package/agents/platform/gym/programs/getting-started/program.json +124 -0
- package/agents/platform/gym/programs/mcp-integrations/program.json +116 -0
- package/agents/platform/gym/programs/multi-model-strategy/program.json +115 -0
- package/agents/platform/gym/programs/prompt-engineering/program.json +136 -0
- package/agents/platform/gym/souls/alex.md +12 -0
- package/agents/platform/gym/souls/jordan.md +12 -0
- package/agents/platform/gym/souls/morgan.md +12 -0
- package/agents/platform/gym/souls/riley.md +12 -0
- package/agents/platform/gym/souls/sam.md +12 -0
- package/agents/platform/hub/CLAUDE.md +372 -0
- package/agents/platform/promptcreator/CLAUDE.md +130 -0
- package/agents/platform/skillcreator/CLAUDE.md +163 -0
- package/bin/cli.js +566 -0
- package/config.example.json +310 -0
- package/dist/agent-registry.d.ts +32 -0
- package/dist/agent-registry.d.ts.map +1 -0
- package/dist/agent-registry.js +144 -0
- package/dist/agent-registry.js.map +1 -0
- package/dist/channels/discord.d.ts +17 -0
- package/dist/channels/discord.d.ts.map +1 -0
- package/dist/channels/discord.js +114 -0
- package/dist/channels/discord.js.map +1 -0
- package/dist/channels/imessage.d.ts +23 -0
- package/dist/channels/imessage.d.ts.map +1 -0
- package/dist/channels/imessage.js +214 -0
- package/dist/channels/imessage.js.map +1 -0
- package/dist/channels/slack.d.ts +19 -0
- package/dist/channels/slack.d.ts.map +1 -0
- package/dist/channels/slack.js +167 -0
- package/dist/channels/slack.js.map +1 -0
- package/dist/channels/telegram.d.ts +19 -0
- package/dist/channels/telegram.d.ts.map +1 -0
- package/dist/channels/telegram.js +274 -0
- package/dist/channels/telegram.js.map +1 -0
- package/dist/channels/types.d.ts +44 -0
- package/dist/channels/types.d.ts.map +1 -0
- package/dist/channels/types.js +18 -0
- package/dist/channels/types.js.map +1 -0
- package/dist/channels/whatsapp.d.ts +23 -0
- package/dist/channels/whatsapp.d.ts.map +1 -0
- package/dist/channels/whatsapp.js +189 -0
- package/dist/channels/whatsapp.js.map +1 -0
- package/dist/config.d.ts +134 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +127 -0
- package/dist/config.js.map +1 -0
- package/dist/cron.d.ts +8 -0
- package/dist/cron.d.ts.map +1 -0
- package/dist/cron.js +35 -0
- package/dist/cron.js.map +1 -0
- package/dist/decrypt-keys.d.ts +7 -0
- package/dist/decrypt-keys.d.ts.map +1 -0
- package/dist/decrypt-keys.js +53 -0
- package/dist/decrypt-keys.js.map +1 -0
- package/dist/encrypt-keys.d.ts +8 -0
- package/dist/encrypt-keys.d.ts.map +1 -0
- package/dist/encrypt-keys.js +62 -0
- package/dist/encrypt-keys.js.map +1 -0
- package/dist/executor.d.ts +31 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +2009 -0
- package/dist/executor.js.map +1 -0
- package/dist/gemini-executor.d.ts +27 -0
- package/dist/gemini-executor.d.ts.map +1 -0
- package/dist/gemini-executor.js +160 -0
- package/dist/gemini-executor.js.map +1 -0
- package/dist/goals.d.ts +24 -0
- package/dist/goals.d.ts.map +1 -0
- package/dist/goals.js +189 -0
- package/dist/goals.js.map +1 -0
- package/dist/gym/activity-digest.d.ts +30 -0
- package/dist/gym/activity-digest.d.ts.map +1 -0
- package/dist/gym/activity-digest.js +506 -0
- package/dist/gym/activity-digest.js.map +1 -0
- package/dist/gym/dimension-scorer.d.ts +76 -0
- package/dist/gym/dimension-scorer.d.ts.map +1 -0
- package/dist/gym/dimension-scorer.js +236 -0
- package/dist/gym/dimension-scorer.js.map +1 -0
- package/dist/gym/gym-router.d.ts +7 -0
- package/dist/gym/gym-router.d.ts.map +1 -0
- package/dist/gym/gym-router.js +718 -0
- package/dist/gym/gym-router.js.map +1 -0
- package/dist/gym/index.d.ts +11 -0
- package/dist/gym/index.d.ts.map +1 -0
- package/dist/gym/index.js +11 -0
- package/dist/gym/index.js.map +1 -0
- package/dist/heartbeat.d.ts +21 -0
- package/dist/heartbeat.d.ts.map +1 -0
- package/dist/heartbeat.js +163 -0
- package/dist/heartbeat.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +254 -0
- package/dist/index.js.map +1 -0
- package/dist/keystore.d.ts +22 -0
- package/dist/keystore.d.ts.map +1 -0
- package/dist/keystore.js +178 -0
- package/dist/keystore.js.map +1 -0
- package/dist/logger.d.ts +9 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +45 -0
- package/dist/logger.js.map +1 -0
- package/dist/memory/daily.d.ts +22 -0
- package/dist/memory/daily.d.ts.map +1 -0
- package/dist/memory/daily.js +82 -0
- package/dist/memory/daily.js.map +1 -0
- package/dist/memory/embeddings.d.ts +15 -0
- package/dist/memory/embeddings.d.ts.map +1 -0
- package/dist/memory/embeddings.js +154 -0
- package/dist/memory/embeddings.js.map +1 -0
- package/dist/memory/index.d.ts +32 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +159 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/search.d.ts +21 -0
- package/dist/memory/search.d.ts.map +1 -0
- package/dist/memory/search.js +77 -0
- package/dist/memory/search.js.map +1 -0
- package/dist/memory/store.d.ts +23 -0
- package/dist/memory/store.d.ts.map +1 -0
- package/dist/memory/store.js +144 -0
- package/dist/memory/store.js.map +1 -0
- package/dist/ollama-executor.d.ts +17 -0
- package/dist/ollama-executor.d.ts.map +1 -0
- package/dist/ollama-executor.js +112 -0
- package/dist/ollama-executor.js.map +1 -0
- package/dist/openai-executor.d.ts +38 -0
- package/dist/openai-executor.d.ts.map +1 -0
- package/dist/openai-executor.js +197 -0
- package/dist/openai-executor.js.map +1 -0
- package/dist/router.d.ts +11 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +185 -0
- package/dist/router.js.map +1 -0
- package/dist/test-message.d.ts +2 -0
- package/dist/test-message.d.ts.map +1 -0
- package/dist/test-message.js +60 -0
- package/dist/test-message.js.map +1 -0
- package/dist/utils/imsg-db-reader.d.ts +24 -0
- package/dist/utils/imsg-db-reader.d.ts.map +1 -0
- package/dist/utils/imsg-db-reader.js +92 -0
- package/dist/utils/imsg-db-reader.js.map +1 -0
- package/dist/utils/imsg-rpc.d.ts +25 -0
- package/dist/utils/imsg-rpc.d.ts.map +1 -0
- package/dist/utils/imsg-rpc.js +149 -0
- package/dist/utils/imsg-rpc.js.map +1 -0
- package/dist/utils/message-formatter.d.ts +3 -0
- package/dist/utils/message-formatter.d.ts.map +1 -0
- package/dist/utils/message-formatter.js +69 -0
- package/dist/utils/message-formatter.js.map +1 -0
- package/dist/web-ui.d.ts +12 -0
- package/dist/web-ui.d.ts.map +1 -0
- package/dist/web-ui.js +5784 -0
- package/dist/web-ui.js.map +1 -0
- package/dist/whatsapp-chats.d.ts +2 -0
- package/dist/whatsapp-chats.d.ts.map +1 -0
- package/dist/whatsapp-chats.js +76 -0
- package/dist/whatsapp-chats.js.map +1 -0
- package/dist/whatsapp-login.d.ts +2 -0
- package/dist/whatsapp-login.d.ts.map +1 -0
- package/dist/whatsapp-login.js +90 -0
- package/dist/whatsapp-login.js.map +1 -0
- package/dist/wiki-sync.d.ts +21 -0
- package/dist/wiki-sync.d.ts.map +1 -0
- package/dist/wiki-sync.js +147 -0
- package/dist/wiki-sync.js.map +1 -0
- package/docs/AddNewAgentGuide.md +100 -0
- package/docs/AddNewMcpGuide.md +72 -0
- package/docs/Architecture.md +795 -0
- package/docs/CLAUDE-AI-SETUP.md +166 -0
- package/docs/Setup.md +297 -0
- package/docs/ai-gym-architecture.md +1040 -0
- package/docs/ai-gym-build-plan.md +343 -0
- package/docs/ai-gym-onboarding.md +122 -0
- package/docs/appcreator_plan.md +348 -0
- package/docs/platform-mcp-audit.md +320 -0
- package/docs/server-deployment-plan.md +503 -0
- package/docs/superpowers/plans/2026-03-25-marketplace.md +1281 -0
- package/docs/superpowers/specs/2026-03-25-marketplace-design.md +287 -0
- package/docs/user-guide.md +2016 -0
- package/mcp-catalog.json +628 -0
- package/package.json +63 -0
- package/public/MyAIforOne-logomark-512.svg +16 -0
- package/public/MyAIforOne-logomark-transparent.svg +15 -0
- package/public/activity.html +314 -0
- package/public/admin.html +1674 -0
- package/public/agent-dashboard.html +670 -0
- package/public/api-docs.html +1106 -0
- package/public/automations.html +722 -0
- package/public/canvas.css +223 -0
- package/public/canvas.js +588 -0
- package/public/changelog.html +231 -0
- package/public/gym.html +2766 -0
- package/public/home.html +1930 -0
- package/public/index.html +2809 -0
- package/public/lab.html +1643 -0
- package/public/library.html +1442 -0
- package/public/marketplace.html +1101 -0
- package/public/mcp-docs.html +441 -0
- package/public/mini.html +390 -0
- package/public/monitor.html +584 -0
- package/public/org.html +4304 -0
- package/public/projects.html +734 -0
- package/public/settings.html +645 -0
- package/public/tasks.html +932 -0
- package/public/trainers/alex.svg +12 -0
- package/public/trainers/jordan.svg +12 -0
- package/public/trainers/morgan.svg +12 -0
- package/public/trainers/riley.svg +12 -0
- package/public/trainers/sam.svg +12 -0
- package/public/user-guide.html +218 -0
- package/registry/agents.json +3 -0
- package/registry/apps.json +20 -0
- package/registry/installed-drafts.json +3 -0
- package/registry/mcps.json +1084 -0
- package/registry/prompts/personal/mcp-test-prompt.md +6 -0
- package/registry/prompts/personal/memory-recall.md +6 -0
- package/registry/prompts/platform/brainstorm.md +15 -0
- package/registry/prompts/platform/code-review.md +16 -0
- package/registry/prompts/platform/explain.md +16 -0
- package/registry/prompts.json +58 -0
- package/registry/skills/external/brainstorming.md +5 -0
- package/registry/skills/external/code-review.md +40 -0
- package/registry/skills/external/frontend-patterns.md +642 -0
- package/registry/skills/external/frontend-slides.md +184 -0
- package/registry/skills/external/systematic-debugging.md +5 -0
- package/registry/skills/external/tdd.md +328 -0
- package/registry/skills/external/verification-before-completion.md +5 -0
- package/registry/skills/external/writing-plans.md +5 -0
- package/registry/skills/platform/ai41_app_build.md +930 -0
- package/registry/skills/platform/ai41_app_deploy.md +168 -0
- package/registry/skills/platform/ai41_app_orchestrator.md +239 -0
- package/registry/skills/platform/ai41_app_patterns.md +359 -0
- package/registry/skills/platform/ai41_app_register.md +85 -0
- package/registry/skills/platform/ai41_app_scaffold.md +421 -0
- package/registry/skills/platform/ai41_app_verify.md +107 -0
- package/registry/skills/platform/opProjectCreate.md +239 -0
- package/registry/skills/platform/op_devbrowser.md +136 -0
- package/registry/skills/platform/sop_brandguidelines.md +103 -0
- package/registry/skills/platform/sop_docx.md +117 -0
- package/registry/skills/platform/sop_frontenddesign.md +44 -0
- package/registry/skills/platform/sop_frontenddesign_v2.md +659 -0
- package/registry/skills/platform/sop_mcpbuilder.md +133 -0
- package/registry/skills/platform/sop_pdf.md +172 -0
- package/registry/skills/platform/sop_pptx.md +133 -0
- package/registry/skills/platform/sop_skillcreator.md +104 -0
- package/registry/skills/platform/sop_themefactory.md +128 -0
- package/registry/skills/platform/sop_webapptesting.md +75 -0
- package/registry/skills/platform/sop_webartifactsbuilder.md +97 -0
- package/registry/skills/platform/sop_xlsx.md +134 -0
- package/registry/skills.json +1055 -0
- package/scripts/discover-chats.sh +11 -0
- package/scripts/install-service-windows.ps1 +87 -0
- package/scripts/install-service.sh +52 -0
- package/scripts/seed-registry.ts +195 -0
- package/scripts/test-send.sh +5 -0
- package/scripts/tray-indicator.ps1 +35 -0
- package/scripts/uninstall-service-windows.ps1 +23 -0
- package/scripts/uninstall-service.sh +15 -0
- package/scripts/xbar-myagent.5s.sh +32 -0
- package/server/mcp-server/dist/index.d.ts +11 -0
- package/server/mcp-server/dist/index.js +1332 -0
- package/server/mcp-server/dist/lib/api-client.d.ts +165 -0
- package/server/mcp-server/dist/lib/api-client.js +241 -0
- package/server/mcp-server/index.ts +1545 -0
- package/server/mcp-server/lib/api-client.ts +366 -0
- package/server/mcp-server/tsconfig.json +14 -0
- package/src/agent-registry.ts +180 -0
- package/src/channels/discord.ts +129 -0
- package/src/channels/imessage.ts +261 -0
- package/src/channels/slack.ts +208 -0
- package/src/channels/telegram.ts +307 -0
- package/src/channels/types.ts +62 -0
- package/src/channels/whatsapp.ts +227 -0
- package/src/config.ts +281 -0
- package/src/cron.ts +43 -0
- package/src/decrypt-keys.ts +60 -0
- package/src/encrypt-keys.ts +70 -0
- package/src/executor.ts +2190 -0
- package/src/gemini-executor.ts +212 -0
- package/src/goals.ts +240 -0
- package/src/gym/activity-digest.ts +546 -0
- package/src/gym/dimension-scorer.ts +297 -0
- package/src/gym/gym-router.ts +801 -0
- package/src/gym/index.ts +19 -0
- package/src/heartbeat.ts +220 -0
- package/src/index.ts +275 -0
- package/src/keystore.ts +190 -0
- package/src/logger.ts +51 -0
- package/src/memory/daily.ts +101 -0
- package/src/memory/embeddings.ts +185 -0
- package/src/memory/index.ts +218 -0
- package/src/memory/search.ts +124 -0
- package/src/memory/store.ts +189 -0
- package/src/ollama-executor.ts +126 -0
- package/src/openai-executor.ts +259 -0
- package/src/router.ts +230 -0
- package/src/test-message.ts +72 -0
- package/src/utils/imsg-db-reader.ts +109 -0
- package/src/utils/imsg-rpc.ts +178 -0
- package/src/utils/message-formatter.ts +90 -0
- package/src/web-ui.ts +5778 -0
- package/src/whatsapp-chats.ts +91 -0
- package/src/whatsapp-login.ts +110 -0
- package/src/wiki-sync.ts +199 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,930 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ai41_app_build
|
|
3
|
+
description: >-
|
|
4
|
+
Full app build lifecycle: scaffold, plan, build, verify, preview, deploy, register. Single runbook for building and shipping a production full-stack app (Express 5 + React 19 + Prisma + Tailwind + shadcn/ui) to Railway. Use when a user asks to build or create an app.
|
|
5
|
+
allowed-tools: Read Write Edit Glob Grep Bash WebFetch
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# App Build — Full Lifecycle Runbook
|
|
9
|
+
|
|
10
|
+
One skill. Full pipeline. Scaffold → Plan → Build → Verify → Preview → Deploy → Register.
|
|
11
|
+
|
|
12
|
+
**Arguments:** User message describes the app. Extract name and features from it.
|
|
13
|
+
|
|
14
|
+
If the user specifies a **project directory**, use it as `{PROJECT_DIR}`. Otherwise default to `{PROJECT_DIR}/`.
|
|
15
|
+
|
|
16
|
+
If no description provided, ask: "What should this app do, and who is it for?"
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Key Paths
|
|
21
|
+
|
|
22
|
+
| Resource | Path |
|
|
23
|
+
|----------|------|
|
|
24
|
+
| Apps workspace | `{PROJECT_DIR}` (user-specified or `{PROJECT_DIR}/`) |
|
|
25
|
+
| Build checklist | `{PROJECT_DIR}/BUILD_CHECKLIST.md` |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## MANDATORY: Build Checklist
|
|
30
|
+
|
|
31
|
+
**At the START, create `{PROJECT_DIR}/BUILD_CHECKLIST.md` using this template.** Update it after every phase — check boxes off as you go.
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
# App Build Checklist — {APP_NAME}
|
|
35
|
+
|
|
36
|
+
## App Info
|
|
37
|
+
- **Slug:** {APP_SLUG}
|
|
38
|
+
- **Needs DB:** {yes/no}
|
|
39
|
+
- **Needs Auth:** {yes/no}
|
|
40
|
+
- **Deploy URL:** (fill after deploy)
|
|
41
|
+
- **GitHub Repo:** (fill after deploy)
|
|
42
|
+
- **Started:** {DATE}
|
|
43
|
+
|
|
44
|
+
## Phase 1: Scaffold
|
|
45
|
+
- [ ] Directory structure created
|
|
46
|
+
- [ ] backend/package.json written
|
|
47
|
+
- [ ] backend/tsconfig.json written
|
|
48
|
+
- [ ] backend/.env written
|
|
49
|
+
- [ ] backend/prisma/schema.prisma written (if DB)
|
|
50
|
+
- [ ] backend/src/index.ts written
|
|
51
|
+
- [ ] frontend/package.json written
|
|
52
|
+
- [ ] frontend/tsconfig.json written
|
|
53
|
+
- [ ] frontend/vite.config.ts written
|
|
54
|
+
- [ ] frontend/src/main.tsx written
|
|
55
|
+
- [ ] frontend/src/App.tsx written
|
|
56
|
+
- [ ] frontend/src/lib/api.ts written
|
|
57
|
+
- [ ] frontend/src/lib/utils.ts written
|
|
58
|
+
- [ ] frontend/index.html written
|
|
59
|
+
- [ ] frontend/components.json written
|
|
60
|
+
- [ ] npm install succeeded (backend)
|
|
61
|
+
- [ ] npm install succeeded (frontend)
|
|
62
|
+
- [ ] shadcn base components installed
|
|
63
|
+
|
|
64
|
+
## Phase 2: Plan
|
|
65
|
+
- [ ] Prisma models identified
|
|
66
|
+
- [ ] API routes listed
|
|
67
|
+
- [ ] Frontend pages listed
|
|
68
|
+
- [ ] Plan outputted to user
|
|
69
|
+
|
|
70
|
+
## Phase 3: Build
|
|
71
|
+
- [ ] prisma/schema.prisma updated with models
|
|
72
|
+
- [ ] backend routes written
|
|
73
|
+
- [ ] backend middleware written
|
|
74
|
+
- [ ] backend routes registered in index.ts
|
|
75
|
+
- [ ] frontend pages written
|
|
76
|
+
- [ ] frontend components written
|
|
77
|
+
- [ ] frontend App.tsx router updated
|
|
78
|
+
- [ ] frontend api.ts covers all endpoints
|
|
79
|
+
- [ ] development-log.md created
|
|
80
|
+
|
|
81
|
+
## Phase 4: Verify
|
|
82
|
+
- [ ] prisma generate passes
|
|
83
|
+
- [ ] prisma db push passes (or skipped — no local DB)
|
|
84
|
+
- [ ] backend tsc --noEmit passes
|
|
85
|
+
- [ ] frontend tsc -b passes
|
|
86
|
+
- [ ] frontend vite build passes
|
|
87
|
+
- [ ] Developer agent created via create_agent MCP
|
|
88
|
+
- [ ] App registered as draft via create_app MCP
|
|
89
|
+
|
|
90
|
+
## Phase 5: Preview
|
|
91
|
+
- [ ] Backend running on port 3001
|
|
92
|
+
- [ ] Frontend running on port 5173
|
|
93
|
+
- [ ] User notified of preview URLs and developer agent
|
|
94
|
+
- [ ] User confirmed deploy (or requested changes)
|
|
95
|
+
|
|
96
|
+
## Phase 6: Deploy
|
|
97
|
+
- [ ] Git initialized and committed
|
|
98
|
+
- [ ] GitHub repo created
|
|
99
|
+
- [ ] Railway project initialized
|
|
100
|
+
- [ ] PostgreSQL provisioned (if DB)
|
|
101
|
+
- [ ] Backend deployed
|
|
102
|
+
- [ ] Frontend served (static or separate)
|
|
103
|
+
- [ ] Railway domain generated
|
|
104
|
+
- [ ] Health check passes at /api/health
|
|
105
|
+
- [ ] Prisma migrations run on Railway (if DB)
|
|
106
|
+
|
|
107
|
+
## Phase 7: Finalize
|
|
108
|
+
- [ ] App status updated to live via update_app MCP
|
|
109
|
+
- [ ] Developer agent heartbeat updated
|
|
110
|
+
- [ ] development-log.md updated with deploy info
|
|
111
|
+
- [ ] User given final report
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Before Starting
|
|
117
|
+
|
|
118
|
+
1. Parse the user's request. Identify:
|
|
119
|
+
- `APP_NAME` — human readable (e.g., `Month-End Close Tracker`)
|
|
120
|
+
- `APP_SLUG` — lowercase hyphenated (e.g., `month-end-close-tracker`)
|
|
121
|
+
- `APP_DIR` — `{PROJECT_DIR}`
|
|
122
|
+
- `NEEDS_DB` — default YES unless it's clearly a static/display-only app
|
|
123
|
+
- `NEEDS_AUTH` — YES if user mentions login, users, accounts, roles
|
|
124
|
+
- Sub-patterns needed (see table below)
|
|
125
|
+
|
|
126
|
+
2. Create the `BUILD_CHECKLIST.md` file now.
|
|
127
|
+
|
|
128
|
+
3. Confirm the plan with the user in 2-3 sentences:
|
|
129
|
+
> "I'll build {APP_NAME} with {features}. Stack: Express 5 + React 19 + Prisma + PostgreSQL + Tailwind + shadcn/ui. Starting scaffold now."
|
|
130
|
+
|
|
131
|
+
4. Then go silent and execute all phases. Announce each phase as you enter it.
|
|
132
|
+
|
|
133
|
+
### Sub-Pattern Selection
|
|
134
|
+
|
|
135
|
+
| If user mentions... | Pattern to apply during Build |
|
|
136
|
+
|---------------------|-------------------------------|
|
|
137
|
+
| login, users, accounts, auth | JWT auth middleware + User model |
|
|
138
|
+
| orgs, teams, multi-tenant | Tenant model + scoped queries |
|
|
139
|
+
| AI, chat, embeddings | Streaming route + OpenAI client |
|
|
140
|
+
| billing, payments | Stripe webhook route + Payment model |
|
|
141
|
+
| charts, analytics, dashboard | Recharts + aggregation queries |
|
|
142
|
+
| real-time, live updates | SSE or WebSocket route |
|
|
143
|
+
| file upload, documents | Multer + S3/local storage route |
|
|
144
|
+
| email, notifications | Nodemailer or Resend integration |
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Phase 1: SCAFFOLD
|
|
149
|
+
|
|
150
|
+
Tell the user: **"Phase 1/7: Scaffolding project..."**
|
|
151
|
+
|
|
152
|
+
### Directory Structure
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
mkdir -p {PROJECT_DIR}/backend/src/routes
|
|
156
|
+
mkdir -p {PROJECT_DIR}/backend/src/middleware
|
|
157
|
+
mkdir -p {PROJECT_DIR}/backend/src/lib
|
|
158
|
+
mkdir -p {PROJECT_DIR}/backend/prisma
|
|
159
|
+
mkdir -p {PROJECT_DIR}/frontend/src/components/ui
|
|
160
|
+
mkdir -p {PROJECT_DIR}/frontend/src/components/layout
|
|
161
|
+
mkdir -p {PROJECT_DIR}/frontend/src/pages
|
|
162
|
+
mkdir -p {PROJECT_DIR}/frontend/src/hooks
|
|
163
|
+
mkdir -p {PROJECT_DIR}/frontend/src/lib
|
|
164
|
+
mkdir -p {PROJECT_DIR}/frontend/public
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### `.gitignore` (at project root)
|
|
168
|
+
```
|
|
169
|
+
node_modules/
|
|
170
|
+
dist/
|
|
171
|
+
build/
|
|
172
|
+
.env
|
|
173
|
+
.env.local
|
|
174
|
+
*.log
|
|
175
|
+
.prisma/
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### `backend/package.json`
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"name": "{APP_SLUG}-backend",
|
|
182
|
+
"version": "1.0.0",
|
|
183
|
+
"private": true,
|
|
184
|
+
"type": "module",
|
|
185
|
+
"scripts": {
|
|
186
|
+
"dev": "tsx watch src/index.ts",
|
|
187
|
+
"build": "tsc",
|
|
188
|
+
"start": "node dist/index.js",
|
|
189
|
+
"db:push": "prisma db push",
|
|
190
|
+
"db:migrate": "prisma migrate dev",
|
|
191
|
+
"db:seed": "tsx prisma/seed.ts",
|
|
192
|
+
"db:studio": "prisma studio"
|
|
193
|
+
},
|
|
194
|
+
"dependencies": {
|
|
195
|
+
"@prisma/client": "^6.2.0",
|
|
196
|
+
"cors": "^2.8.5",
|
|
197
|
+
"dotenv": "^16.4.7",
|
|
198
|
+
"express": "^5.0.1",
|
|
199
|
+
"helmet": "^8.0.0",
|
|
200
|
+
"morgan": "^1.10.0",
|
|
201
|
+
"zod": "^3.24.2"
|
|
202
|
+
},
|
|
203
|
+
"devDependencies": {
|
|
204
|
+
"@types/cors": "^2.8.17",
|
|
205
|
+
"@types/express": "^5.0.0",
|
|
206
|
+
"@types/morgan": "^1.9.9",
|
|
207
|
+
"@types/node": "^22.10.0",
|
|
208
|
+
"prisma": "^6.2.0",
|
|
209
|
+
"tsx": "^4.19.0",
|
|
210
|
+
"typescript": "^5.7.0"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### `backend/tsconfig.json`
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"compilerOptions": {
|
|
219
|
+
"target": "ES2022",
|
|
220
|
+
"module": "ESNext",
|
|
221
|
+
"moduleResolution": "bundler",
|
|
222
|
+
"lib": ["ES2022"],
|
|
223
|
+
"outDir": "dist",
|
|
224
|
+
"rootDir": "src",
|
|
225
|
+
"strict": true,
|
|
226
|
+
"esModuleInterop": true,
|
|
227
|
+
"skipLibCheck": true,
|
|
228
|
+
"forceConsistentCasingInFileNames": true,
|
|
229
|
+
"resolveJsonModule": true,
|
|
230
|
+
"declaration": true,
|
|
231
|
+
"sourceMap": true
|
|
232
|
+
},
|
|
233
|
+
"include": ["src/**/*"],
|
|
234
|
+
"exclude": ["node_modules", "dist"]
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### `backend/.env`
|
|
239
|
+
```
|
|
240
|
+
PORT=3001
|
|
241
|
+
DATABASE_URL=postgresql://user:password@localhost:5432/{APP_SLUG}?schema=public
|
|
242
|
+
NODE_ENV=development
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### `backend/prisma/schema.prisma`
|
|
246
|
+
```prisma
|
|
247
|
+
generator client {
|
|
248
|
+
provider = "prisma-client-js"
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
datasource db {
|
|
252
|
+
provider = "postgresql"
|
|
253
|
+
url = env("DATABASE_URL")
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Models added in Phase 3
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### `backend/src/lib/prisma.ts`
|
|
260
|
+
```typescript
|
|
261
|
+
import { PrismaClient } from "@prisma/client";
|
|
262
|
+
|
|
263
|
+
export const prisma = new PrismaClient({
|
|
264
|
+
log: process.env.NODE_ENV === "development" ? ["query"] : ["error"],
|
|
265
|
+
});
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### `backend/src/index.ts`
|
|
269
|
+
```typescript
|
|
270
|
+
import "dotenv/config";
|
|
271
|
+
import express from "express";
|
|
272
|
+
import cors from "cors";
|
|
273
|
+
import helmet from "helmet";
|
|
274
|
+
import morgan from "morgan";
|
|
275
|
+
|
|
276
|
+
const app = express();
|
|
277
|
+
const PORT = parseInt(process.env.PORT || "3001");
|
|
278
|
+
|
|
279
|
+
app.use(helmet());
|
|
280
|
+
app.use(cors({ origin: process.env.CORS_ORIGIN || "http://localhost:5173", credentials: true }));
|
|
281
|
+
app.use(express.json());
|
|
282
|
+
app.use(morgan("dev"));
|
|
283
|
+
|
|
284
|
+
app.get("/api/health", (_req, res) => {
|
|
285
|
+
res.json({ status: "ok", timestamp: new Date().toISOString() });
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
// Routes registered in Phase 3
|
|
289
|
+
|
|
290
|
+
app.use((err: Error, _req: express.Request, res: express.Response, _next: express.NextFunction) => {
|
|
291
|
+
console.error(err.stack);
|
|
292
|
+
res.status(500).json({ error: process.env.NODE_ENV === "production" ? "Internal server error" : err.message });
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
app.listen(PORT, () => console.log(`Server running on port ${PORT}`));
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### `frontend/package.json`
|
|
299
|
+
```json
|
|
300
|
+
{
|
|
301
|
+
"name": "{APP_SLUG}-frontend",
|
|
302
|
+
"version": "1.0.0",
|
|
303
|
+
"private": true,
|
|
304
|
+
"type": "module",
|
|
305
|
+
"scripts": {
|
|
306
|
+
"dev": "vite",
|
|
307
|
+
"build": "tsc -b && vite build",
|
|
308
|
+
"preview": "vite preview"
|
|
309
|
+
},
|
|
310
|
+
"dependencies": {
|
|
311
|
+
"class-variance-authority": "^0.7.1",
|
|
312
|
+
"clsx": "^2.1.1",
|
|
313
|
+
"lucide-react": "^0.468.0",
|
|
314
|
+
"react": "^19.0.0",
|
|
315
|
+
"react-dom": "^19.0.0",
|
|
316
|
+
"react-router-dom": "^7.1.0",
|
|
317
|
+
"tailwind-merge": "^2.6.0"
|
|
318
|
+
},
|
|
319
|
+
"devDependencies": {
|
|
320
|
+
"@tailwindcss/vite": "^4.0.0",
|
|
321
|
+
"@types/react": "^19.0.0",
|
|
322
|
+
"@types/react-dom": "^19.0.0",
|
|
323
|
+
"@vitejs/plugin-react": "^4.3.0",
|
|
324
|
+
"tailwindcss": "^4.0.0",
|
|
325
|
+
"typescript": "^5.7.0",
|
|
326
|
+
"vite": "^6.0.0"
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### `frontend/tsconfig.json`
|
|
332
|
+
```json
|
|
333
|
+
{
|
|
334
|
+
"compilerOptions": {
|
|
335
|
+
"target": "ES2022",
|
|
336
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
337
|
+
"module": "ESNext",
|
|
338
|
+
"moduleResolution": "bundler",
|
|
339
|
+
"jsx": "react-jsx",
|
|
340
|
+
"strict": true,
|
|
341
|
+
"esModuleInterop": true,
|
|
342
|
+
"skipLibCheck": true,
|
|
343
|
+
"forceConsistentCasingInFileNames": true,
|
|
344
|
+
"resolveJsonModule": true,
|
|
345
|
+
"isolatedModules": true,
|
|
346
|
+
"noEmit": true,
|
|
347
|
+
"baseUrl": ".",
|
|
348
|
+
"paths": { "@/*": ["./src/*"] }
|
|
349
|
+
},
|
|
350
|
+
"include": ["src"],
|
|
351
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### `frontend/tsconfig.node.json`
|
|
356
|
+
```json
|
|
357
|
+
{
|
|
358
|
+
"compilerOptions": {
|
|
359
|
+
"target": "ES2022",
|
|
360
|
+
"module": "ESNext",
|
|
361
|
+
"moduleResolution": "bundler",
|
|
362
|
+
"allowImportingTsExtensions": true,
|
|
363
|
+
"isolatedModules": true,
|
|
364
|
+
"noEmit": true
|
|
365
|
+
},
|
|
366
|
+
"include": ["vite.config.ts"]
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### `frontend/vite.config.ts`
|
|
371
|
+
```typescript
|
|
372
|
+
import { defineConfig } from "vite";
|
|
373
|
+
import react from "@vitejs/plugin-react";
|
|
374
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
375
|
+
import path from "path";
|
|
376
|
+
|
|
377
|
+
export default defineConfig({
|
|
378
|
+
plugins: [react(), tailwindcss()],
|
|
379
|
+
resolve: { alias: { "@": path.resolve(__dirname, "./src") } },
|
|
380
|
+
server: {
|
|
381
|
+
port: 5173,
|
|
382
|
+
proxy: { "/api": { target: "http://localhost:3001", changeOrigin: true } },
|
|
383
|
+
},
|
|
384
|
+
});
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### `frontend/index.html`
|
|
388
|
+
```html
|
|
389
|
+
<!doctype html>
|
|
390
|
+
<html lang="en">
|
|
391
|
+
<head>
|
|
392
|
+
<meta charset="UTF-8" />
|
|
393
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
394
|
+
<title>{APP_NAME}</title>
|
|
395
|
+
</head>
|
|
396
|
+
<body>
|
|
397
|
+
<div id="root"></div>
|
|
398
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
399
|
+
</body>
|
|
400
|
+
</html>
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### `frontend/components.json`
|
|
404
|
+
```json
|
|
405
|
+
{
|
|
406
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
407
|
+
"style": "new-york",
|
|
408
|
+
"rsc": false,
|
|
409
|
+
"tsx": true,
|
|
410
|
+
"tailwind": { "config": "", "css": "src/index.css", "baseColor": "zinc", "cssVariables": true },
|
|
411
|
+
"aliases": { "components": "@/components", "utils": "@/lib/utils", "ui": "@/components/ui", "lib": "@/lib", "hooks": "@/hooks" },
|
|
412
|
+
"iconLibrary": "lucide"
|
|
413
|
+
}
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### `frontend/src/index.css`
|
|
417
|
+
```css
|
|
418
|
+
@import "tailwindcss";
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### `frontend/src/main.tsx`
|
|
422
|
+
```tsx
|
|
423
|
+
import { StrictMode } from "react";
|
|
424
|
+
import { createRoot } from "react-dom/client";
|
|
425
|
+
import { BrowserRouter } from "react-router-dom";
|
|
426
|
+
import App from "./App";
|
|
427
|
+
import "./index.css";
|
|
428
|
+
|
|
429
|
+
createRoot(document.getElementById("root")!).render(
|
|
430
|
+
<StrictMode><BrowserRouter><App /></BrowserRouter></StrictMode>
|
|
431
|
+
);
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### `frontend/src/App.tsx`
|
|
435
|
+
```tsx
|
|
436
|
+
import { Routes, Route } from "react-router-dom";
|
|
437
|
+
|
|
438
|
+
export default function App() {
|
|
439
|
+
return (
|
|
440
|
+
<div className="min-h-screen bg-gray-50">
|
|
441
|
+
<Routes>
|
|
442
|
+
<Route path="/" element={<div className="p-8 text-center text-muted-foreground">Building...</div>} />
|
|
443
|
+
</Routes>
|
|
444
|
+
</div>
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### `frontend/src/lib/utils.ts`
|
|
450
|
+
```typescript
|
|
451
|
+
import { type ClassValue, clsx } from "clsx";
|
|
452
|
+
import { twMerge } from "tailwind-merge";
|
|
453
|
+
export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); }
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### `frontend/src/lib/api.ts`
|
|
457
|
+
```typescript
|
|
458
|
+
const BASE_URL = "/api";
|
|
459
|
+
|
|
460
|
+
async function request<T>(path: string, options: RequestInit = {}): Promise<T> {
|
|
461
|
+
const res = await fetch(`${BASE_URL}${path}`, {
|
|
462
|
+
headers: { "Content-Type": "application/json", ...options.headers },
|
|
463
|
+
...options,
|
|
464
|
+
});
|
|
465
|
+
if (!res.ok) {
|
|
466
|
+
const error = await res.json().catch(() => ({ error: res.statusText }));
|
|
467
|
+
throw new Error(error.error || res.statusText);
|
|
468
|
+
}
|
|
469
|
+
return res.json();
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export const api = {
|
|
473
|
+
get: <T>(path: string) => request<T>(path),
|
|
474
|
+
post: <T>(path: string, body: unknown) => request<T>(path, { method: "POST", body: JSON.stringify(body) }),
|
|
475
|
+
put: <T>(path: string, body: unknown) => request<T>(path, { method: "PUT", body: JSON.stringify(body) }),
|
|
476
|
+
delete: <T>(path: string) => request<T>(path, { method: "DELETE" }),
|
|
477
|
+
};
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### Install Dependencies
|
|
481
|
+
|
|
482
|
+
```bash
|
|
483
|
+
cd {PROJECT_DIR}/backend && npm install
|
|
484
|
+
cd {PROJECT_DIR}/frontend && npm install
|
|
485
|
+
cd {PROJECT_DIR}/frontend && npx shadcn@latest add button card input label --yes 2>/dev/null || true
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
### Verify Scaffold
|
|
489
|
+
```bash
|
|
490
|
+
test -f {PROJECT_DIR}/backend/node_modules/.package-lock.json && echo "backend: OK" || echo "backend: FAILED"
|
|
491
|
+
test -f {PROJECT_DIR}/frontend/node_modules/.package-lock.json && echo "frontend: OK" || echo "frontend: FAILED"
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
Both must say OK. If either fails, retry `npm install` once. Update checklist ✓.
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
498
|
+
## Phase 2: PLAN
|
|
499
|
+
|
|
500
|
+
Tell the user: **"Phase 2/7: Planning..."**
|
|
501
|
+
|
|
502
|
+
Analyze the request and output a numbered plan (10 items max):
|
|
503
|
+
1. Prisma models with key fields
|
|
504
|
+
2. API routes (method + path)
|
|
505
|
+
3. Frontend pages
|
|
506
|
+
4. Auth approach if needed
|
|
507
|
+
|
|
508
|
+
Output this plan to the user. Do NOT wait for approval — immediately proceed to Phase 3.
|
|
509
|
+
|
|
510
|
+
Update checklist ✓.
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
## Phase 3: BUILD
|
|
515
|
+
|
|
516
|
+
Tell the user: **"Phase 3/7: Building..."**
|
|
517
|
+
|
|
518
|
+
### Architecture Rules
|
|
519
|
+
|
|
520
|
+
**Project structure:**
|
|
521
|
+
```
|
|
522
|
+
backend/src/
|
|
523
|
+
index.ts — registers middleware + all routes
|
|
524
|
+
routes/
|
|
525
|
+
health.ts — GET /api/health
|
|
526
|
+
{domain}.ts — one file per domain
|
|
527
|
+
index.ts — re-exports registerRoutes()
|
|
528
|
+
middleware/
|
|
529
|
+
errorHandler.ts — global error handler
|
|
530
|
+
validate.ts — zod validation helper
|
|
531
|
+
lib/
|
|
532
|
+
prisma.ts — prisma singleton
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
**Route file pattern:**
|
|
536
|
+
```typescript
|
|
537
|
+
import { Router } from "express";
|
|
538
|
+
import { prisma } from "../lib/prisma.js";
|
|
539
|
+
import { z } from "zod";
|
|
540
|
+
|
|
541
|
+
const router = Router();
|
|
542
|
+
|
|
543
|
+
const CreateSchema = z.object({ name: z.string().min(1), ... });
|
|
544
|
+
|
|
545
|
+
router.get("/", async (_req, res) => {
|
|
546
|
+
const items = await prisma.model.findMany({ orderBy: { createdAt: "desc" } });
|
|
547
|
+
res.json(items);
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
router.post("/", async (req, res) => {
|
|
551
|
+
const parsed = CreateSchema.safeParse(req.body);
|
|
552
|
+
if (!parsed.success) return res.status(400).json({ error: parsed.error.flatten() });
|
|
553
|
+
const item = await prisma.model.create({ data: parsed.data });
|
|
554
|
+
res.status(201).json(item);
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
export default router;
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
**Route registration (`src/routes/index.ts`):**
|
|
561
|
+
```typescript
|
|
562
|
+
import type { Express } from "express";
|
|
563
|
+
import health from "./health.js";
|
|
564
|
+
import items from "./items.js";
|
|
565
|
+
|
|
566
|
+
export function registerRoutes(app: Express) {
|
|
567
|
+
app.use("/api/health", health);
|
|
568
|
+
app.use("/api/items", items);
|
|
569
|
+
}
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
**Then update `src/index.ts` to call `registerRoutes(app)`.**
|
|
573
|
+
|
|
574
|
+
**Prisma conventions:**
|
|
575
|
+
- `id String @id @default(cuid())`
|
|
576
|
+
- Always include `createdAt DateTime @default(now())` and `updatedAt DateTime @updatedAt`
|
|
577
|
+
- Optional fields: `String?` not separate null checks
|
|
578
|
+
- Validate with Zod at route level, never trust raw `req.body`
|
|
579
|
+
|
|
580
|
+
**Frontend page pattern:**
|
|
581
|
+
```tsx
|
|
582
|
+
import { useState, useEffect } from "react";
|
|
583
|
+
import { api } from "@/lib/api";
|
|
584
|
+
import { Card, CardContent } from "@/components/ui/card";
|
|
585
|
+
import { Button } from "@/components/ui/button";
|
|
586
|
+
|
|
587
|
+
export default function ItemsPage() {
|
|
588
|
+
const [items, setItems] = useState<Item[]>([]);
|
|
589
|
+
const [loading, setLoading] = useState(true);
|
|
590
|
+
|
|
591
|
+
useEffect(() => {
|
|
592
|
+
api.get<Item[]>("/items").then(setItems).finally(() => setLoading(false));
|
|
593
|
+
}, []);
|
|
594
|
+
|
|
595
|
+
return (
|
|
596
|
+
<div className="container mx-auto py-8 px-4">
|
|
597
|
+
<div className="flex items-center justify-between mb-8">
|
|
598
|
+
<h1 className="text-2xl font-bold">{Title}</h1>
|
|
599
|
+
</div>
|
|
600
|
+
{loading ? (
|
|
601
|
+
<div className="text-center text-muted-foreground py-12">Loading...</div>
|
|
602
|
+
) : (
|
|
603
|
+
<div className="grid gap-4">
|
|
604
|
+
{items.map(item => (
|
|
605
|
+
<Card key={item.id}>
|
|
606
|
+
<CardContent className="p-4">{/* item content */}</CardContent>
|
|
607
|
+
</Card>
|
|
608
|
+
))}
|
|
609
|
+
</div>
|
|
610
|
+
)}
|
|
611
|
+
</div>
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
**Styling rules:**
|
|
617
|
+
- Tailwind only — no custom CSS
|
|
618
|
+
- `cn()` for conditional classes
|
|
619
|
+
- shadcn/ui for ALL interactive elements (buttons, inputs, cards, tables, dialogs, selects)
|
|
620
|
+
- Install additional shadcn components as needed: `npx shadcn@latest add {component} --yes`
|
|
621
|
+
- Responsive grids: `grid-cols-1 md:grid-cols-2 lg:grid-cols-3`
|
|
622
|
+
|
|
623
|
+
### Build Order
|
|
624
|
+
|
|
625
|
+
**Backend:**
|
|
626
|
+
1. `prisma/schema.prisma` — add all models
|
|
627
|
+
2. `src/lib/prisma.ts` — already written
|
|
628
|
+
3. `src/routes/{domain}.ts` — one per domain
|
|
629
|
+
4. `src/routes/index.ts` — registerRoutes
|
|
630
|
+
5. `src/index.ts` — call registerRoutes
|
|
631
|
+
6. `src/middleware/errorHandler.ts` if complex
|
|
632
|
+
|
|
633
|
+
**Frontend:**
|
|
634
|
+
1. Install any extra shadcn components needed
|
|
635
|
+
2. `src/components/layout/Navbar.tsx`
|
|
636
|
+
3. `src/pages/*.tsx` — one per page
|
|
637
|
+
4. `src/hooks/use{Domain}.ts` — if shared data fetching logic
|
|
638
|
+
5. `src/App.tsx` — update router with all pages
|
|
639
|
+
6. `src/lib/api.ts` — already has base, add typed helpers if needed
|
|
640
|
+
|
|
641
|
+
Write complete, production-quality code — no stubs, no TODOs, no `as any`.
|
|
642
|
+
|
|
643
|
+
### Create `development-log.md`
|
|
644
|
+
|
|
645
|
+
At the end of the build phase, write `{PROJECT_DIR}/development-log.md`:
|
|
646
|
+
|
|
647
|
+
```markdown
|
|
648
|
+
# {APP_NAME} — Development Log
|
|
649
|
+
|
|
650
|
+
## Build Record
|
|
651
|
+
- **Created:** {DATE}
|
|
652
|
+
- **Requested by:** Web UI user
|
|
653
|
+
- **Built by:** @appcreator
|
|
654
|
+
|
|
655
|
+
## Original Request
|
|
656
|
+
{paste the user's original description here}
|
|
657
|
+
|
|
658
|
+
## Tech Stack
|
|
659
|
+
- Express 5 + React 19 + Vite + TypeScript
|
|
660
|
+
- Prisma + PostgreSQL (if DB)
|
|
661
|
+
- Tailwind CSS + shadcn/ui
|
|
662
|
+
|
|
663
|
+
## What Was Built
|
|
664
|
+
|
|
665
|
+
### Database Models
|
|
666
|
+
{list each Prisma model with key fields}
|
|
667
|
+
|
|
668
|
+
### API Routes
|
|
669
|
+
{list each route: METHOD /api/path — description}
|
|
670
|
+
|
|
671
|
+
### Frontend Pages
|
|
672
|
+
{list each page component and what it shows}
|
|
673
|
+
|
|
674
|
+
### Key Decisions
|
|
675
|
+
{any non-obvious choices made during build — e.g., "Used SSE for live updates instead of WebSocket because..."}
|
|
676
|
+
|
|
677
|
+
## Build Status
|
|
678
|
+
- Scaffold: ✓
|
|
679
|
+
- Build: ✓
|
|
680
|
+
- Verify: pending
|
|
681
|
+
- Preview: pending
|
|
682
|
+
- Deploy: pending
|
|
683
|
+
- Register: pending
|
|
684
|
+
|
|
685
|
+
## Change History
|
|
686
|
+
{append entries here as changes are made}
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
This file is the **handoff document** — when the developer agent takes over, it reads this file to understand the full context of the app. Always append to the Change History section when making modifications.
|
|
690
|
+
|
|
691
|
+
Update checklist ✓.
|
|
692
|
+
|
|
693
|
+
---
|
|
694
|
+
|
|
695
|
+
## Phase 4: VERIFY
|
|
696
|
+
|
|
697
|
+
Tell the user: **"Phase 4/7: Verifying builds..."**
|
|
698
|
+
|
|
699
|
+
Run these IN ORDER. Fix errors before moving to next step.
|
|
700
|
+
|
|
701
|
+
### Step 1: Prisma Generate
|
|
702
|
+
```bash
|
|
703
|
+
cd {PROJECT_DIR}/backend && npx prisma generate 2>&1
|
|
704
|
+
```
|
|
705
|
+
Fix schema errors if any. Max 5 retries.
|
|
706
|
+
|
|
707
|
+
### Step 2: Prisma DB Push
|
|
708
|
+
```bash
|
|
709
|
+
cd {PROJECT_DIR}/backend && npx prisma db push --accept-data-loss 2>&1
|
|
710
|
+
```
|
|
711
|
+
If "connection refused" or no local DB — skip this step. DB will be created on Railway.
|
|
712
|
+
|
|
713
|
+
### Step 3: Backend TypeScript
|
|
714
|
+
```bash
|
|
715
|
+
cd {PROJECT_DIR}/backend && npx tsc --noEmit 2>&1
|
|
716
|
+
```
|
|
717
|
+
Fix ONE error at a time from the top — TypeScript errors cascade. Max 5 retries.
|
|
718
|
+
|
|
719
|
+
### Step 4: Frontend TypeScript
|
|
720
|
+
```bash
|
|
721
|
+
cd {PROJECT_DIR}/frontend && npx tsc -b 2>&1
|
|
722
|
+
```
|
|
723
|
+
Fix errors. Max 5 retries.
|
|
724
|
+
|
|
725
|
+
### Step 5: Frontend Build
|
|
726
|
+
```bash
|
|
727
|
+
cd {PROJECT_DIR}/frontend && npx vite build 2>&1
|
|
728
|
+
```
|
|
729
|
+
Fix import errors. Max 3 retries.
|
|
730
|
+
|
|
731
|
+
**Error fix strategy:**
|
|
732
|
+
1. Read the full error — don't guess from line 1
|
|
733
|
+
2. Read the file at the line number mentioned
|
|
734
|
+
3. Make the minimal fix — don't rewrite, just fix the specific issue
|
|
735
|
+
4. Re-run to verify
|
|
736
|
+
|
|
737
|
+
Never: add `// @ts-ignore`, use `as any`, delete files, or comment out code to suppress errors.
|
|
738
|
+
|
|
739
|
+
When all 5 steps pass clean, proceed to create the developer agent.
|
|
740
|
+
|
|
741
|
+
### Step 6: Create Developer Agent
|
|
742
|
+
|
|
743
|
+
The app has passed verification — create its dedicated agent now so it owns the app from this point forward.
|
|
744
|
+
|
|
745
|
+
Use the `create_agent` MCP tool:
|
|
746
|
+
```json
|
|
747
|
+
{
|
|
748
|
+
"agentId": "{APP_SLUG}-dev",
|
|
749
|
+
"name": "{APP_NAME} Developer",
|
|
750
|
+
"description": "Develops and maintains {APP_NAME}",
|
|
751
|
+
"workspace": "{PROJECT_DIR}",
|
|
752
|
+
"persistent": true,
|
|
753
|
+
"streaming": true,
|
|
754
|
+
"tools": ["Read", "Edit", "Write", "Glob", "Grep", "Bash"],
|
|
755
|
+
"mcps": ["myaiforone"],
|
|
756
|
+
"agentClass": "builder",
|
|
757
|
+
"instructions": "# {APP_NAME} Developer\n\nYou maintain and develop {APP_NAME}.\n\n## First Thing\nRead `development-log.md` in your workspace to understand the app's architecture, what was built, and the full build history.\n\n## Your Workspace\n`{PROJECT_DIR}/`\n\n## Key Files\n- `development-log.md` — build history and architecture (READ THIS FIRST)\n- `BUILD_CHECKLIST.md` — build phase tracking\n- `backend/` — Express 5 API\n- `frontend/` — React 19 + Vite\n\n## Rules\n- Always update `development-log.md` Change History when you make changes\n- Use shadcn/ui for ALL UI components\n- Run `npx tsc --noEmit` after backend changes to verify\n- Run `npm run build` after frontend changes to verify"
|
|
758
|
+
}
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
### Step 7: Register App as Draft
|
|
762
|
+
|
|
763
|
+
Use the `create_app` MCP tool:
|
|
764
|
+
```json
|
|
765
|
+
{
|
|
766
|
+
"name": "{APP_NAME}",
|
|
767
|
+
"category": "{best matching: finance|productivity|engineering|operations|infrastructure|devtools|analytics}",
|
|
768
|
+
"status": "draft",
|
|
769
|
+
"agentDeveloper": "{APP_SLUG}-dev",
|
|
770
|
+
"provider": "me",
|
|
771
|
+
"otherDetails": "Workspace: {PROJECT_DIR}"
|
|
772
|
+
}
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
Update `development-log.md` — set Verify to ✓, note the developer agent was created.
|
|
776
|
+
|
|
777
|
+
Update checklist ✓.
|
|
778
|
+
|
|
779
|
+
---
|
|
780
|
+
|
|
781
|
+
## Phase 5: PREVIEW
|
|
782
|
+
|
|
783
|
+
Tell the user: **"Phase 5/7: Starting preview servers..."**
|
|
784
|
+
|
|
785
|
+
```bash
|
|
786
|
+
cd {PROJECT_DIR}/backend && npm run dev &
|
|
787
|
+
cd {PROJECT_DIR}/frontend && npm run dev &
|
|
788
|
+
sleep 4
|
|
789
|
+
curl -s http://localhost:3001/api/health
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
Report to user:
|
|
793
|
+
```
|
|
794
|
+
Preview ready!
|
|
795
|
+
|
|
796
|
+
Frontend: http://localhost:5173
|
|
797
|
+
Backend API: http://localhost:3001
|
|
798
|
+
|
|
799
|
+
Developer agent: @{APP_SLUG}-dev (assigned to this app)
|
|
800
|
+
Status: draft (registered in platform)
|
|
801
|
+
|
|
802
|
+
Review the app. When you're happy, say "deploy" and I'll push to Railway.
|
|
803
|
+
If you want changes, describe them and I'll update the code.
|
|
804
|
+
Going forward, you can also chat with @{APP_SLUG}-dev to modify this app.
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
**STOP HERE and wait for user response.**
|
|
808
|
+
- "deploy" / "looks good" / "ship it" → Phase 6
|
|
809
|
+
- Change request → back to Phase 3 (edit existing files, don't rewrite)
|
|
810
|
+
|
|
811
|
+
Update checklist ✓.
|
|
812
|
+
|
|
813
|
+
---
|
|
814
|
+
|
|
815
|
+
## Phase 6: DEPLOY
|
|
816
|
+
|
|
817
|
+
Tell the user: **"Phase 6/7: Deploying to Railway..."**
|
|
818
|
+
|
|
819
|
+
### Step 1: Git
|
|
820
|
+
```bash
|
|
821
|
+
cd {PROJECT_DIR}
|
|
822
|
+
git init
|
|
823
|
+
git add -A
|
|
824
|
+
git commit -m "Initial commit: {APP_NAME}"
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
### Step 2: GitHub
|
|
828
|
+
```bash
|
|
829
|
+
gh repo create agenticledger/{APP_SLUG} --private --source=. --push
|
|
830
|
+
```
|
|
831
|
+
If org fails: `gh repo create {APP_SLUG} --private --source=. --push`
|
|
832
|
+
|
|
833
|
+
### Step 3: Serve Frontend from Backend
|
|
834
|
+
|
|
835
|
+
Before deploying, consolidate into a single Railway service:
|
|
836
|
+
|
|
837
|
+
1. Build frontend: `cd {PROJECT_DIR}/frontend && npm run build`
|
|
838
|
+
2. Copy dist: `cp -r {PROJECT_DIR}/frontend/dist {PROJECT_DIR}/backend/public`
|
|
839
|
+
3. Add to `backend/src/index.ts` (after routes, before error handler):
|
|
840
|
+
```typescript
|
|
841
|
+
import { fileURLToPath } from "url";
|
|
842
|
+
import { dirname, join } from "path";
|
|
843
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
844
|
+
app.use(express.static(join(__dirname, "../public")));
|
|
845
|
+
app.get("*", (_req, res) => res.sendFile(join(__dirname, "../public/index.html")));
|
|
846
|
+
```
|
|
847
|
+
4. Commit: `git add -A && git commit -m "Serve frontend from backend"`
|
|
848
|
+
5. Push: `git push`
|
|
849
|
+
|
|
850
|
+
### Step 4: Railway
|
|
851
|
+
```bash
|
|
852
|
+
cd {PROJECT_DIR}/backend
|
|
853
|
+
railway init --name {APP_SLUG}
|
|
854
|
+
railway add --database postgres
|
|
855
|
+
railway variables set PORT=3001 NODE_ENV=production
|
|
856
|
+
railway up --detach
|
|
857
|
+
```
|
|
858
|
+
|
|
859
|
+
### Step 5: Get URL and Verify
|
|
860
|
+
```bash
|
|
861
|
+
railway domain
|
|
862
|
+
sleep 15
|
|
863
|
+
curl -s https://{RAILWAY_URL}/api/health
|
|
864
|
+
```
|
|
865
|
+
|
|
866
|
+
If health fails, check logs: `railway logs --tail 50`. Fix, push, wait, recheck. Max 3 retries.
|
|
867
|
+
|
|
868
|
+
### Step 6: Run Migrations
|
|
869
|
+
```bash
|
|
870
|
+
railway run npx prisma db push
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
Update BUILD_CHECKLIST.md with deploy URL and GitHub repo. Update checklist ✓.
|
|
874
|
+
|
|
875
|
+
---
|
|
876
|
+
|
|
877
|
+
## Phase 7: FINALIZE
|
|
878
|
+
|
|
879
|
+
Tell the user: **"Phase 7/7: Finalizing registration..."**
|
|
880
|
+
|
|
881
|
+
### Step 1: Update App to Live
|
|
882
|
+
Use the `update_app` MCP tool to set the deployed URL and status:
|
|
883
|
+
```json
|
|
884
|
+
{
|
|
885
|
+
"id": "{APP_SLUG}",
|
|
886
|
+
"url": "{DEPLOY_URL}",
|
|
887
|
+
"status": "live",
|
|
888
|
+
"githubRepo": "{GITHUB_URL}",
|
|
889
|
+
"githubBranch": "main",
|
|
890
|
+
"deployPlatform": "railway"
|
|
891
|
+
}
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
### Step 2: Update Developer Agent Heartbeat
|
|
895
|
+
Use the `update_agent` MCP tool to add health monitoring now that a deploy URL exists:
|
|
896
|
+
```json
|
|
897
|
+
{
|
|
898
|
+
"agentId": "{APP_SLUG}-dev",
|
|
899
|
+
"heartbeatInstructions": "Check Railway health at {DEPLOY_URL}/api/health. If unhealthy, investigate logs, fix code, commit, and push to trigger redeploy."
|
|
900
|
+
}
|
|
901
|
+
```
|
|
902
|
+
|
|
903
|
+
### Step 3: Update Development Log
|
|
904
|
+
Append to `development-log.md`:
|
|
905
|
+
```
|
|
906
|
+
## Deployment
|
|
907
|
+
- **URL:** {DEPLOY_URL}
|
|
908
|
+
- **GitHub:** {GITHUB_URL}
|
|
909
|
+
- **Railway project:** {APP_SLUG}
|
|
910
|
+
- **Deployed:** {DATE}
|
|
911
|
+
- **Status:** live
|
|
912
|
+
```
|
|
913
|
+
|
|
914
|
+
### Step 4: Final Report
|
|
915
|
+
|
|
916
|
+
```
|
|
917
|
+
Your app is live!
|
|
918
|
+
|
|
919
|
+
App: {APP_NAME}
|
|
920
|
+
URL: {DEPLOY_URL}
|
|
921
|
+
GitHub: {GITHUB_URL}
|
|
922
|
+
Status: live (visible in Registry at /marketplace)
|
|
923
|
+
|
|
924
|
+
Developer agent: @{APP_SLUG}-dev
|
|
925
|
+
Chat with this agent to make changes, redeploy, or maintain the app.
|
|
926
|
+
|
|
927
|
+
Build log: {PROJECT_DIR}/development-log.md
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
Update checklist ✓. Done.
|