Single — one Go binary

The smallest deploy: Go + embedded React. When less infra wins.

5 mineasy

Single mode is the smallest possible Grit deploy: one Go binary with the React frontend embedded inside it. No separate frontend server, no reverse proxy juggling — drop the binary on a VPS and run it.

The shape

Terminal
$grit new my-app --single # Next.js frontend embedded
$grit new my-app --single --vite # Vite + TanStack frontend embedded

You get ONE directory (not apps/). The Go code lives at the root; the React app lives in frontend/ and gets compiled into the Go binary at build time via go:embed.

my-app/
my-app/
├── main.go # Go entry point
├── internal/ # Handlers, services, models
├── frontend/ # React source
│ ├── src/
│ └── dist/ # Built at build time, embedded into the binary
├── grit.json
└── go.mod

Why this is special

  • One file deploy. scp myapp user@host: + ./myapp on the box. Done.
  • No CORS. The frontend is served by the same Go process as the API — same origin, no preflight requests.
  • No reverse proxy required. Optional, of course — Caddy / Traefik for TLS — but not architecturally needed.
  • Smallest infra surface. Postgres + one binary. That's it.

When it shines

  • Solo / indie products
  • Internal tools deployed to a single VPS
  • Self-hosted apps you ship to customers (one binary they can run)
  • MVPs you want to iterate on without infra complexity

When to skip it

  • You need a separate admin panel for non-engineers (no admin surface in single mode by default — use triple)
  • The web and the API will be deployed independently (different regions, different scaling)
  • You're scaling to multiple frontend regions but one backend
Single + Vite (--single --vite) is the Grit demo at demo.gritframework.dev — sub-second cold starts, the same single-binary deploy. Worth considering when SEO doesn't matter.

Quick check

You're shipping a self-hosted invoicing app to customers (each runs it on their own VPS). Which mode?

Try it

In notes.md, list three real apps you'd ship as single mode. For each, write one sentence on why single beats triple for that case.

What's next

Single is the smallest. Next is its opposite — triple: the kitchen-sink SaaS shape with web + admin + API.

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