Scaffolding the triple
The command + what it produces.
Welcome to Building Web with Next.js + Go API. We're using the triple kit ā three apps in one monorepo (web, admin, api). By the end of this lesson, you'll have scaffolded a SaaS-shaped project ready for the rest of the course.
New to App Router or Go? Read the relevant primers first ā this course assumes basic familiarity with both, plus running Docker containers locally.
The command
$grit new saas --triple
Pick "Next.js" when prompted for the frontend framework (or use --next to skip the prompt). You'll end up with apps/web, apps/admin, and apps/api all wired together.
The shape
saas/āāā apps/ā āāā api/ Go (Gin + GORM) backendā āāā web/ Public Next.js site + customer dashboardā āāā admin/ Filament-style admin panel (Next.js)āāā packages/shared/ Zod schemas + TS typesāāā docker-compose.ymlāāā turbo.jsonāāā pnpm-workspace.yamlāāā grit.json
Three different audiences
- apps/web ā your customers. Marketing pages (public) + dashboard (logged-in).
- apps/admin ā your staff. Different auth scope, different look, behind its own subdomain in prod.
- apps/api ā same Go API serves both. Same code, different route groups for different roles.
First run
$cd saas$docker compose up -d # postgres, redis, minio, mailhog$pnpm install # installs every workspace's deps$grit migrate # creates DB tables$grit seed # creates seeded admin user$grit start # API + web + admin together
Three URLs come up: http://localhost:3000 (web), http://localhost:3001 (admin), http://localhost:8080 (API).
Quick check
Try it
Scaffold and run the full triple stack:
grit new saas --triple --nextcd saas && docker compose up -dpnpm installgrit migrate && grit seedgrit start- Open all three URLs in different browser tabs. Paste each tab's title bar text in
notes.md.
What's next
Three apps running. Next lesson ā tour each app's file structure so you know where to put new code.
Spot a typo? Have an idea?
Help us improve this lesson. One click opens a GitHub issue with the lesson URL pre-filled ā suggest clearer wording, report a bug, or request more depth. The course keeps improving thanks to learners like you.
Suggest an improvement on GitHub