Getting Started

Installation

Everything you need to install and configure before creating your first Grit project. This guide covers system requirements, tool installation, and the Grit CLI setup.

System Requirements

Grit runs on macOS, Linux, and Windows. You need the following tools installed:

ToolMinimum VersionRequired ForCheck Command
Go1.21+Backend API + CLIgo version
Node.js18+Frontend appsnode --version
pnpm8+Package managementpnpm --version
DockerLatestPostgreSQL, Redis, MinIOdocker --version
Docker ComposeV2Service orchestrationdocker compose version
GitAnyVersion controlgit --version

Installing Go

Go is required for both the Grit CLI and the backend API. Download the latest version from the official website or use a version manager.

macOS (Homebrew)

terminal
$ brew install go

Linux (Ubuntu/Debian)

terminal
$ wget https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
$ sudo tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz
$ export PATH=$PATH:/usr/local/go/bin

Windows

Download the MSI installer from go.dev/dl and run it. The installer adds Go to your system PATH automatically. Alternatively, use winget install GoLang.Go or scoop install go.

Installing Node.js

Node.js 18 or later is required for the Next.js frontend apps. We recommend using a version manager like nvm or fnm.

Using nvm (recommended)

terminal
$ nvm install 20
$ nvm use 20

Using Homebrew (macOS)

terminal
$ brew install node@20

Installing pnpm

Grit uses pnpm for frontend package management. It is faster, more disk-efficient, and enforces stricter dependency resolution than npm or yarn.

terminal
# Using npm (easiest)
$ npm install -g pnpm
# Or using corepack (built into Node.js)
$ corepack enable
$ corepack prepare pnpm@latest --activate

Installing Docker

Docker is used to run PostgreSQL, Redis, MinIO, and Mailhog in development. Install Docker Desktop for your platform:

After installation, verify Docker is running:

terminal
$ docker --version
$ docker compose version

Installing the Grit CLI

The Grit CLI is a Go binary that you install globally. It provides the grit command for scaffolding projects, generating resources, running migrations, and syncing types.

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

This downloads, compiles, and installs the grit binary into your $GOPATH/bin directory (usually ~/go/bin). Make sure this directory is in your system PATH.

Verifying the Installation

Run the following command to verify everything is installed correctly:

terminal
$ grit --help
____ _ _
/ ___|_ __(_)| |_
| | _| '__| || __|
| |_| | | | || |_
\____|_| |_| \__|
Go + React. Built with Grit.

Creating Your First Project

With all tools installed, you are ready to create your first Grit project:

terminal
$ grit new my-saas-app

Project Flags

The grit new command supports flags to customize what gets scaffolded:

FlagDescriptionWhat Gets Created
(default)Full-stack projectGo API + Next.js web + admin panel + shared types + Docker
--apiBackend onlyGo API with auth, Docker setup, no frontend apps
--fullEverything + mobileDefault + Expo mobile app + docs site

Examples:

terminal
# Full-stack (default)
$ grit new my-crm
# API only (no frontend)
$ grit new my-api --api
# Full + mobile + docs
$ grit new my-startup --full

Troubleshooting

grit: command not found

This means $GOPATH/bin is not in your system PATH. Add the following to your shell profile (~/.zshrc, ~/.bashrc, or ~/.profile):

~/.zshrc
export PATH=$PATH:$(go env GOPATH)/bin

Then reload your shell: source ~/.zshrc. On Windows, make sure %GOPATH%\\bin is in your system PATH environment variable.

Docker daemon not running

If docker compose up fails with a connection error, make sure Docker Desktop is running. On Linux, start the Docker daemon with sudo systemctl start docker.

Port conflicts

If ports 5432, 6379, 8080, 3000, or 3001 are already in use, edit the .env file and docker-compose.yml to use different ports. Common conflicts:

  • Port 5432 -- another PostgreSQL instance is running
  • Port 3000 -- another Next.js or React dev server is running
  • Port 8080 -- another API server or proxy is running

pnpm install fails

If pnpm install fails with peer dependency errors, try deleting the lockfile and node_modules folders and running again:

terminal
$ rm -rf node_modules pnpm-lock.yaml apps/*/node_modules packages/*/node_modules
$ pnpm install

Cloud-only setup (no Docker)

If you cannot run Docker, Grit includes a .env.cloud.example file that configures the project to use cloud services instead:

Copy the cloud example and fill in your credentials:

terminal
$ cp .env.cloud.example .env