Skip to content

Quick start

Prerequisites

Tool Version Why
Go 1.26.11 or newer builds and runs the API
PostgreSQL 16 or newer the only database (local install, Docker, or a managed one)
Node.js 20.19+ (22.23+ for the docs site) builds the app and the developer dashboard
make any GNU make shortcuts; every target is also a plain go command

Run it

  1. Make it your repository. On GitHub, press Use this template → Create a new repository. You get your own repository with a clean history, not a fork that points back here. (Just trying it out? Clone this repository directly.)

  2. Clone and configure. Copy the example environment; every value has a working local default.

    Terminal window
    git clone <your-repository-url> ims-go-saas-kit && cd ims-go-saas-kit
    cp .env.example .env
    make key-generate # writes APP_KEY to .env

    APP_KEY encrypts what the app must read back (two-factor secrets, codes in queued jobs). Locally an empty key falls back to a public development key with a warning; staging and production refuse to start without a real one.

  3. Give it your names. One command rewrites the kit’s names everywhere: the Go module path, the binary and CLI (ims → shop), the deploy names and paths, the display title and the IMS_ deploy variables. It also renames the systemd units and regenerates the code and docs. It refuses to run with uncommitted changes, so the rename is one reviewable commit. The full story, including what it leaves alone, is in Make it yours.

    Terminal window
    make rename MODULE=github.com/acme/shop-api DRY=1 # preview
    make rename MODULE=github.com/acme/shop-api BINARY=shop TITLE="Acme Shop" # NAME, BINARY, TITLE are optional
    git add -A && git commit -m "chore: rename the kit to shop-api"

    NAME defaults to the last part of the module (shop-api), BINARY to the name, and TITLE to the name in title case (Shop API). Left as they are: the seeded @ims.com accounts and the credit links. Run it once; it refuses a project that has already been renamed. The commands below use the kit’s names: substitute yours.

  4. Install the tools once. air (hot reload) and golangci-lint, then the packages of the two web apps: the developer dashboard and the app.

    Terminal window
    make tools
    npm --prefix web/dev ci
    npm --prefix web/app ci
  5. Start Postgres — skip this if you already have one running.

    Terminal window
    make db-up # docker compose: creates ims_go_api and ims_go_api_test
  6. Create the schema and seed data. Migrations first, then permissions, the default tenant, roles and two accounts.

    Terminal window
    make migrate seed
  7. Run everything with hot reload. One command starts three processes: the developer dashboard (:8080), the app (:8082), both with Vite hot reload, and the API (:8081), rebuilt by air when you save a Go file. Both dev servers forward API calls to :8081.

    Terminal window
    make dev
make dev
$ make migrate seedgoose: successfully migrated database to version: 34River schema: v8 (0 pending)seeded permissions, tenant "Main Tenant", roles Admin + Developeraccounts: superadmin@ims.com, developer@ims.com$ make devdashboard → http://localhost:8080/dev/app       → http://localhost:8082air   → building ./cmd/app … running on :8081http server listening addr=:8081 env=local

Look around

Three addresses, one running kit:

Open What it is Sign in as
localhost:8082 the app: the organization workspace and the staff console superadmin@ims.com for the console, or press Create an organization to sign up as a new customer
localhost:8080/dev/ the developer dashboard: requests, queue, logs, commands developer@ims.com or superadmin@ims.com
localhost:8080/docs the API reference (Scalar, from api/openapi.yaml) no sign-in to read; paste a token to try calls

The seeded password is 123456 (AUTH_DEFAULT_PASSWORD).

Account E-mail Can
Super Admin superadmin@ims.com everything: the staff console, every organization, the dashboard
Developer developer@ims.com the developer dashboard

Try the app first. Sign in as the super admin: you land in the staff console. Open Organizations, pick the seeded “Main Tenant” organization and press Impersonate to see its workspace the way its members do. Then sign out and press Create an organization on the sign-in page: you go through sign-up and the setup wizard like a new customer. The tour of every screen is in The app.

The staff console home

The developer dashboard overview

Call the API

Everything the app does is an API call you can make yourself. Sign in and use the system side with just the token, the way the staff console does:

Terminal window
TOKEN=$(curl -s localhost:8080/api/v1/login -H 'Content-Type: application/json' \
-d '{"email":"superadmin@ims.com","password":"123456","device":"cli"}' | jq -r .data.token)
AUTH=(-H "Authorization: Bearer $TOKEN")
curl -s localhost:8080/api/v1/tenant "${AUTH[@]}" | jq # system panel: every tenant
curl -s localhost:8080/api/v1/branch "${AUTH[@]}" | jq # a tenant resource, read across all tenants

To work inside one tenant, add the acting headers. Reads narrow to that tenant, and writes to tenant resources need them (without them the super admin gets 403):

Terminal window
ACT=(-H "X-Acting-Tenant: 1" -H "X-Acting-Branch: 1")
curl -s localhost:8080/api/v1/branch "${AUTH[@]}" "${ACT[@]}" | jq # tenant 1 only
curl -s localhost:8080/api/v1/branch "${AUTH[@]}" "${ACT[@]}" \
-H 'Content-Type: application/json' -d '{"name":"Uptown"}' | jq # a write inside tenant 1

Background work

Queue jobs (mail, imports, backups) and scheduled tasks run in their own processes. Start them in two more terminals when you need them:

Terminal window
make queue # ims queue:work
make schedule # ims schedule

Next steps