Skip to content

Commit 1bbce6f

Browse files
committed
docs: add detailed architecture pages for all 5 modes + update knowledge base
New docs pages with full folder structures, data flow diagrams, code generation specifics, deployment guides, and example links: - /docs/concepts/architecture-modes/triple - /docs/concepts/architecture-modes/double - /docs/concepts/architecture-modes/single - /docs/concepts/architecture-modes/api-only - /docs/concepts/architecture-modes/mobile Sidebar updated with all 5 architecture sub-pages. Knowledge base updated with docs links, example links, folder structures, and key differences for each architecture.
1 parent 8dce082 commit 1bbce6f

8 files changed

Lines changed: 3258 additions & 29 deletions

File tree

GRIT_KNOWLEDGE_BASE.txt

Lines changed: 60 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -63,56 +63,87 @@ ARCHITECTURE MODES
6363
When you run "grit new myapp", the CLI enters interactive mode and asks you to choose an architecture. This is one of Grit's most powerful features — you pick the structure that matches your project's needs.
6464

6565
1. TRIPLE (Web + Admin + API)
66-
Command: grit new myapp --triple
66+
Command: grit new myapp --triple --next (or --vite)
67+
Docs: https://gritframework.dev/docs/concepts/architecture-modes/triple
68+
Example: https://github.com/MUKE-coder/grit/tree/main/examples/job-portal-triple-next
6769
Structure: Turborepo monorepo with three apps
68-
- apps/api/ — Go backend (Gin + GORM)
69-
- apps/web/ — Main frontend (Next.js or TanStack Router)
70-
- apps/admin/ — Admin panel (Next.js or TanStack Router)
71-
- packages/shared/ — Zod schemas, TypeScript types, constants
72-
Best for: SaaS applications, content platforms, e-commerce sites
73-
This is the default and most feature-complete mode.
70+
- apps/api/ — Go backend (Gin + GORM + PostgreSQL)
71+
- apps/web/ — Main frontend (Next.js App Router or TanStack Router)
72+
- apps/admin/ — Admin panel with DataTable, FormBuilder, dashboard, system pages
73+
- packages/shared/ — Zod schemas, TypeScript types, constants (shared between web + admin)
74+
- packages/grit-ui/ — 100 shadcn-compatible UI components
75+
Folder structure (abbreviated):
76+
myapp/
77+
├── .env, docker-compose.yml, turbo.json, pnpm-workspace.yaml
78+
├── .claude/skills/grit/ (SKILL.md tailored to triple)
79+
├── packages/shared/ (schemas/, types/, constants/)
80+
├── apps/api/ (cmd/server/main.go, internal/{config,database,models,handlers,services,middleware,routes,mail,storage,jobs,cache,ai,auth})
81+
├── apps/web/ (Next.js: app/ or TanStack: src/routes/)
82+
└── apps/admin/ (resources/, components/, hooks/)
83+
Code generation: Creates 8 files (Go model, service, handler + TS schema, type, hook + admin resource def + admin page) and injects into 6 marker locations
84+
Ports: API 8080, Web 3000, Admin 3001, PostgreSQL 5432, Redis 6379, MinIO 9000/9001, Mailhog 8025
85+
Deployment: grit deploy (VPS), Docker Compose, Vercel (frontend) + VPS (API)
86+
Best for: SaaS applications, content platforms, e-commerce sites, anything needing a separate admin panel
7487

7588
2. DOUBLE (Web + API)
76-
Command: grit new myapp --double
77-
Structure: Turborepo monorepo with two apps
89+
Command: grit new myapp --double --vite (or --next)
90+
Docs: https://gritframework.dev/docs/concepts/architecture-modes/double
91+
Example: https://github.com/MUKE-coder/grit/tree/main/examples/job-portal-double-vite
92+
Structure: Turborepo monorepo with two apps (NO admin panel)
7893
- apps/api/ — Go backend
79-
- apps/web/ — Frontend
94+
- apps/web/ — Frontend (admin features via role-protected routes)
8095
- packages/shared/ — Shared types
81-
Best for: Simpler apps that don't need a separate admin panel, marketing sites with a backend, blogs
96+
Key difference: No apps/admin/. ADMIN users access management features within the web app itself via role-protected routes. Code generation creates fewer files (no admin resource/page).
97+
Best for: Simpler apps, blogs, portfolios, apps where admins use the same UI as users
8298

8399
3. SINGLE (Embedded SPA)
84-
Command: grit new myapp --single
85-
Structure: Single Go binary with embedded frontend
86-
- main.go at the project root with go:embed
87-
- internal/ — Go backend code
88-
- frontend/ — React SPA (built and embedded into the binary)
89-
Best for: Laravel/Next.js developers who want one deployable unit, microservices, internal tools
90-
This is similar to how Laravel or Next.js work — one app, one deployment, one binary.
91-
In development, Go runs on port 8080 and Vite runs on port 5173 with a proxy.
92-
In production, the frontend is compiled and embedded into the Go binary using go:embed.
100+
Command: grit new myapp --single --vite
101+
Docs: https://gritframework.dev/docs/concepts/architecture-modes/single
102+
Example: https://github.com/MUKE-coder/grit/tree/main/examples/job-portal-single-vite
103+
Structure: Single Go binary with embedded frontend (go:embed)
104+
- main.go at project root with //go:embed frontend/dist/*
105+
- internal/ — Go backend (same structure as apps/api/internal/)
106+
- frontend/ — React SPA (Vite + TanStack Router)
107+
Key differences from other architectures:
108+
- NO Turborepo, NO pnpm-workspace, NO turbo.json
109+
- FLAT project structure (no apps/ directory)
110+
- Module path: just "myapp" (not "myapp/apps/api")
111+
- Schemas/types live in frontend/src/ (not packages/shared/)
112+
- Dev: Go on :8080, Vite on :5173 with proxy (/api → :8080)
113+
- Production: cd frontend && pnpm build && go build → single binary serves everything
114+
Best for: Laravel/Rails developers, solo devs, simple deploys, internal tools
93115

94116
4. API ONLY
95117
Command: grit new myapp --api
96-
Structure: Just the Go API
97-
- cmd/server/main.go — Entry point
98-
- internal/ — All Go code
99-
Best for: Headless APIs, mobile app backends, microservices
118+
Docs: https://gritframework.dev/docs/concepts/architecture-modes/api-only
119+
Example: https://github.com/MUKE-coder/grit/tree/main/examples/job-portal-api-only
120+
Structure: Pure Go API — no frontend, no React, no Node.js, no pnpm
121+
- apps/api/ — Go backend only
122+
Key differences: No TypeScript, no Zod schemas, no React. Code generation only creates Go files. All batteries still work (auth, storage, email, jobs, AI, TOTP). Test via /docs (Scalar/Swagger), curl, or Postman.
123+
Best for: Mobile app backends, microservices, headless CMS, third-party APIs
100124

101125
5. MOBILE (API + Expo)
102126
Command: grit new myapp --mobile
103-
Structure: Turborepo monorepo with API and Expo
127+
Docs: https://gritframework.dev/docs/concepts/architecture-modes/mobile
128+
Example: https://github.com/MUKE-coder/grit/tree/main/examples/job-portal-mobile-expo
129+
Structure: Turborepo monorepo with API and Expo React Native
104130
- apps/api/ — Go backend
105-
- apps/expo/ — React Native (Expo) mobile app
106-
Best for: Mobile-first applications
131+
- apps/expo/ — Expo React Native (Expo Router for navigation)
132+
- packages/shared/ — Shared types between API and mobile
133+
Key differences: SecureStore for encrypted token storage (not localStorage), Expo Router for tab/stack navigation, FlatList instead of HTML tables, push notifications via Expo Notifications, physical device needs local IP (not localhost)
134+
Best for: Mobile-first applications, cross-platform apps
107135

108136
6. DESKTOP (Wails)
109137
Command: grit new-desktop myapp
110138
Structure: Standalone Wails desktop application
111-
- Go backend with Wails v2 bindings
139+
- Go backend with Wails v2 bindings (methods callable from React)
112140
- React frontend (Vite + TanStack Router)
113-
- SQLite database (local)
141+
- SQLite database (local, no Docker needed)
114142
Best for: Cross-platform desktop tools, offline-first apps
115143

144+
ALL EXAMPLES: https://github.com/MUKE-coder/grit/tree/main/examples
145+
Same Job Portal built with every architecture — full source, setup guide, deployment config.
146+
116147

117148
FRONTEND OPTIONS
118149
================

0 commit comments

Comments
 (0)