Scaffolding the triple

The command + what it produces.

6 mineasy

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.

The command

Terminal
$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/
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.
Why three apps? Different audiences, different security posture (you can IP-allowlist admin), different SEO needs (marketing optimised, admin isn't indexed). Separating them at build time is cleaner than trying to gate one app by role.

First run

Terminal
$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

Why does Grit ship the admin as a SEPARATE Next.js app instead of an admin section inside apps/web?

Try it

Scaffold and run the full triple stack:

  1. grit new saas --triple --next
  2. cd saas && docker compose up -d
  3. pnpm install
  4. grit migrate && grit seed
  5. grit start
  6. 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