Getting Started

Quick Start

Get a full-stack Grit project running in 5 minutes. This guide assumes you have Go, Node.js, pnpm, and Docker already installed. If not, see the Installation guide first.

Prerequisites

Make sure the following tools are installed on your machine before proceeding:

Go1.21+
go version
Node.js18+
node --version
pnpm8+
pnpm --version
DockerLatest
docker --version
1

Install the Grit CLI

Install the Grit CLI globally using go install. This gives you the grit command available anywhere on your system.

terminal
$ go install github.com/MUKE-coder/grit/cmd/grit@latest

Verify the installation by running grit --help. You should see the Grit ASCII art logo and a list of available commands.

Update to the latest version

Already have Grit installed? Update the CLI to the latest version with a single command. This removes the old binary and installs the newest release:

terminal
$ grit update

Run grit version afterwards to confirm you're on the latest release.

2

Create a New Project

Scaffold a complete full-stack project with one command. This creates the entire monorepo: Go API, Next.js web app, admin panel, shared types, Docker setup, and all the batteries.

terminal
$ grit new myapp
+Creating directory structure...
+Scaffolding Go API...
+Adding batteries (cache, storage, mail, jobs, cron, AI)...
+Setting up Next.js web app...
+Creating admin panel...
Project "myapp" created successfully!

The project name must be lowercase, alphanumeric, and hyphens only (e.g., my-saas-app). It must start with a letter and cannot end with a hyphen.

3

Start Infrastructure Services

Navigate into the project and start the Docker services. This launches PostgreSQL, Redis, MinIO (S3-compatible storage), and Mailhog (email testing).

terminal
$ cd myapp
$ docker compose up -d

This starts the following services in the background:

  • PostgreSQL 16 on port 5432 -- your primary database
  • Redis 7 on port 6379 -- caching and job queues
  • MinIO on port 9000 (console: 9001) -- local S3-compatible file storage
  • Mailhog on port 8025 -- catch-all email testing UI
Do not have Docker? See the Installation guide for a cloud-only setup using Neon (Postgres) and Upstash (Redis) instead.
4

Start the Go API

Navigate into the Go API directory, install dependencies with go mod tidy, then start the server. This runs the Go backend on port 8080 with auto-migration enabled.

terminal
$ cd apps/api
$ go mod tidy
$ go run cmd/server/main.go

You should see the Gin router start up and log all registered routes. The API is now running at http://localhost:8080. Interactive API docs (Scalar) are at http://localhost:8080/docs and GORM Studio is available at http://localhost:8080/studio.

The first run of go mod tidy may take a minute as Go downloads all dependencies. Subsequent runs will be instant.
5

Start the Frontend

Open a new terminal (keep the API running), navigate back to the project root, install Node.js dependencies, then start the Next.js web app.

terminal (new tab)
$ cd myapp
$ pnpm install
$ cd apps/web && pnpm dev

To also run the admin panel, open another terminal and run:

terminal (another tab)
$ cd myapp/apps/admin && pnpm dev

Alternatively, you can run everything at once with Turborepo from the project root:

terminal
# From the project root (myapp/)
$ turbo dev

Once started, you can access:

Go API
http://localhost:8080Backend + GORM Studio at /studio
Web App
http://localhost:3000Next.js frontend with auth pages
Admin Panel
http://localhost:3001Resource-based admin dashboard
API Docs
http://localhost:8080/docsInteractive Scalar API reference
Mailhog
http://localhost:8025Email testing inbox

Try registering a user at http://localhost:3000/register, then log in and explore the dashboard. Open http://localhost:3001 to see the admin panel. Visit http://localhost:8080/studio to browse your database visually with GORM Studio.

6

Generate a Resource

Now for the magic. Generate a complete full-stack resource with a single command. This creates the Go model, CRUD handler, service layer, React Query hooks, Zod schemas, TypeScript types, and an admin page -- all wired together.

terminal
$ grit generate resource Post --fields "title:string,content:text,published:bool"

This generates the following files:

  • apps/api/internal/models/post.go -- GORM model with struct tags
  • apps/api/internal/handlers/post.go -- Full CRUD handler with pagination
  • apps/api/internal/services/post.go -- Business logic layer
  • packages/shared/schemas/post.ts -- Zod validation schemas
  • packages/shared/types/post.ts -- TypeScript types
  • apps/admin/hooks/use-posts.ts -- React Query hooks
  • apps/admin/app/resources/posts/page.tsx -- Admin page with data table

It also automatically registers the routes in routes.go, adds the model to auto-migrations, and injects the resource into the admin sidebar. Restart turbo dev and visit the admin panel to see your new Posts resource with a fully functional data table and create form.

Upgrading?v0.13.0

If you have an existing Grit project and want to update the framework components (admin panel, configs, web app) to the latest version, run:

$ grit upgrade

This preserves your resource definitions and API code while updating all framework-generated files. Use grit upgrade --force to overwrite without prompting.