← The Directory
Agent rules

golid

AI-native factory for Go + SolidJS apps — Cursor rules, spec drift CI, plans, and a production starter with auth, SSR, SSE, Cloud Run deploy.

View source

Golid

Golid

CI codecov Go Echo SolidJS Tailwind CSS PostgreSQL License

An AI-native software factory for cloud-hosted Go + SolidJS apps.

Production harness — plans, module specs, 45 Cursor rules, drift CI, integration test harness — plus a runnable starter app and GCP deploy scripts.

Live example: golid.ai — marketing site built with this factory; clone the repo for the harness and template app.

Factory · Quick Start · Fork · Why Golid · Deploy · Docs


Tech Stack

LayerTechnologyLayerTechnology
BackendGo 1.26 · Echo v4 · pgx/v5FrontendSolidJS · SolidStart · Tailwind CSS 4
DatabasePostgreSQL 16InfrastructureCloud Run · Cloud SQL · GCS
AuthJWT rotation · selector/verifier tokensReal-timeSSE hub with ticket auth
EmailMailgun (IsConfigured())Job Queueasynq + Redis (goroutine fallback)
ObservabilityOpenTelemetry · Prometheus (opt-in)Feature FlagsDB-backed with 30s cache
Hot ReloadAir (Go) + Vite HMRDevContainerOne-click setup, zero config
Testing995 tests (353 Go unit + 622 Vitest + 20 E2E)Factory harnessPlans · spec-drift · rule-health · plan loop
AI Rules45 Cursor rules (auto-activate on edit)IntegrationTEST_DATABASE_URL · per-package schemas (separate go test -tags integration run)

How the factory works

Agents and humans share the same production contract — not prompt memory, not ad-hoc CI.

1. Classify & plan — workflow-routing picks risk tier (T0–T3). Write slices in docs/plans/ under planning-standards guardrails: verify schema and file claims against migrations and source; acceptance criteria per slice. New modules: plan-feature. Calibration: golden-slices.

2. Execute slices — slice-and-ship per slice: implement → test → spec/OpenAPI sync → audit-bugs pre-merge gate → commit. For multi-slice plans, invoke plan-execution-loop to orchestrate subagents: implement → audit (≥90/100) → fix → re-audit before the next slice. Archive completed plans under docs/plans/archive/.

StepWhatWhere
SpecCurrent behavior (updated as slices land)docs/modules/*/spec.md
BuildRules + scaffold enforce patterns.cursor/rules/ · make new-module
VerifyUnit + integration harness, race detectorPer-package it_<pkg>_<pid> schemas · sharded CI
GateSpec + rules stay aligned with codecheck_spec_drift.sh · check_citation_freshness.sh · check_rule_health.sh on every PR
ShipCloud deploy + full rebrand./scripts/deploy.sh · make rename (20+ file categories)

vs blank repo + AI: OpenAPI + module specs + drift CI (not prompt memory) · planning-standards → slice-and-ship / plan-execution-loop · path-filtered CI + E2E + Codecov 80% gate · make rename rebrands the whole factory.

Full map: Organism Pattern · Plans · routing eval


What's Inside

Starter modules the factory extends — use make new-module or follow example-module.md.

ModuleWhat it does
AuthRegistration, login, JWT refresh rotation, password reset, email verification
UsersProfile (/me), settings, admin user_type gates
Feature flagsPublic GET /features, admin CRUD, cached reads
SSEPer-user channels, one-time ticket auth, reconnect + backpressure
Components70+ atoms/molecules/organisms — charts, grids, date pickers, modals
Opt-in infraEmail, queue, Redis rate limiting, tracing, metrics — off by default

Also included: OpenAPI 3.1 + TypeScript codegen, sqlc queries, golang-migrate (with down migrations), CSRF + dual-tier rate limiting, scaffold generator, domain-safe rename tool, GCP deploy/teardown scripts.

Data visualization components Interactive UI components


Quick Start

Prerequisites: Docker 24+, Node.js 24+, Go 1.26+

DevContainer (recommended)

git clone https://github.com/golid-ai/golid.git my-project && cd my-project
# Open in VS Code/Cursor → "Reopen in Container"

Migrations and seed data run automatically (entrypoint.dev.sh). Backend starts on 8080. Frontend starts as a VS Code task — open the Terminal tab and wait until the frontend dev server prints its local URL before opening http://localhost:3000.

Docker Compose (local)

git clone https://github.com/golid-ai/golid.git my-project && cd my-project
make setup

# First run only — migrate + seed the dev database
export DATABASE_URL=postgres://dev:dev@localhost:5432/golid?sslmode=disable
make migrate-up seed

docker compose up          # DB + backend on :8080
cd frontend && npm run dev # frontend on :3000

Test accounts (after seed): admin@example.com / Password123! (admin) · user@example.com / Password123! (user)

Guides: Quick Start · Start Here · Forking? make rename · Upgrading? CHANGELOG (0.3.x breaking changes in 0.3.0)


Project Structure

golid/
├── backend/
│   ├── cmd/server/main.go       # Bootstrap, shutdown, background jobs
│   ├── internal/
│   │   ├── wire/                # BuildServices, BuildHandlers, RegisterRoutes
│   │   ├── service/             # Business logic (auth, user, feature, sse, email)
│   │   ├── handler/             # HTTP handlers
│   │   ├── middleware/          # JWT, CSRF, rate limiting, security
│   │   ├── pagination/          # Query normalization
│   │   ├── retry/               # Exponential backoff for fire-and-forget
│   │   └── apperror/            # Typed error responses
│   ├── migrations/              # SQL migration pairs (up + down)
│   ├── openapi.yaml             # REST API contract (OpenAPI 3.1)
│   └── seeds/                   # Development seed data
├── frontend/
│   └── src/
│       ├── components/          # 70+ components (atoms/molecules/organisms)
│       ├── lib/                 # api.ts, auth.ts, constants, validation
│       └── routes/
│           ├── (public)/        # login, signup, forgot-password, verify-email
│           └── (private)/       # dashboard, settings, component showcase
├── docs/
│   ├── modules/                 # Auth, users, feature specs (+ drift CI)
│   ├── plans/                   # Feature plans (active + archive/)
│   ├── architecture.md          # Layers, auth, SSE, wire
│   └── patterns/                # Stack quick references (Go, SolidJS, …)
├── .cursor/rules/               # 45 AI coding rules
├── config/                      # Environment files
├── scripts/                     # Deploy, drift checks, init-test-db, teardown
└── infra/                       # Cloud Run, Cloud Build configs

Commands

# First run: make setup && migrate-up seed (see Quick Start)
make dev                           # DB + backend (docker compose up)
cd frontend && npm run dev         # Frontend dev server (port 3000)
make test                          # Backend + frontend unit tests
make check                         # lint + test + build (local CI parity)

export TEST_DATABASE_URL='postgres://dev:dev@localhost:5432/golid_test?sslmode=disable'
scripts/init-test-db.sh
cd backend && TEST_MIGRATIONS_PATH="$(pwd)/migrations" \
  go test -tags integration ./internal/handler/... ./internal/service/... -race
make new-module name=notes         # Scaffold CRUD module
make rename name=myapp module=github.com/user/myapp/backend domain=myapp.com
make help                          # All Makefile targets

./scripts/deploy.sh                # Deploy to QA (Cloud Run)
./scripts/deploy.sh check          # Validate config before deploy

Integration test setup: CLI Reference (init-test-db.sh, TEST_DATABASE_URL).


Why Golid?

vs blank repo + AI

GolidBlank repo + AI
ContractOpenAPI + module specs + drift CIPrompt memory
Integration safetyTEST_DATABASE_URL, isolated schemasEasy to wipe dev DB
Agent opsworkflow-routing → planning-standards → slice-and-ship / plan-execution-loop (45 rules)Ad-hoc
Production CIPath-filtered, E2E, Codecov 80% gateOften none
Fork factorymake rename rebrands harness + appManual find-and-replace

vs other stacks

GolidNext.js + APIGo-only starters
Full-stack type safetyGo + TypeScript (OpenAPI → generated types)TypeScript (tRPC/Zod)Go only
Production UI70+ componentsBYONone
SSR + real-timeSolidStart SSR + SSEPartialNone
DeployOne-command GCP (deploy.sh); Docker elsewhereVercel-centricBYO
Memory~30MB binary~200MB+~30MB

Opt-in complexity: docker compose up works with zero Redis, Mailgun, or OTEL. Set one env var per module when you need it — see Opt-In Modules below.


Opt-In Modules

ModuleTriggerZero-configProduction
EmailMAILGUN_API_KEYLogs to stdoutMailgun delivery
Job QueueREDIS_URLGoroutine + Retryasynq + Redis
Rate LimitingREDIS_URLIn-memoryRedis fixed-window
TracingOTEL_ENDPOINTNo tracingOTLP export
MetricsMETRICS_ENABLEDNo /metricsPrometheus
Feature FlagsAlways onPostgreSQL + cacheSame

docker compose --profile production up adds Redis + worker (see CHANGELOG).


Architecture

Handlers → Middleware → Services → PostgreSQL. Wiring lives in internal/wire/ (BuildServices, BuildHandlers, RegisterRoutes); business logic in internal/service/<pkg>/. Frontend uses SolidStart SSR with file-based routing.

API surface today: /api/v1 (versioning middleware + migration path in api-versioning.md).

Full breakdown: architecture.md — auth flow, SSE ticket exchange, shutdown order, observability.


Fork and Customize

git clone https://github.com/YOUR_USER/my-app.git && cd my-app
make rename name=myapp module=github.com/YOUR_USER/my-app/backend domain=myapp.com
git diff && make check

The rename tool updates 20+ file categories (imports, Docker, CI, Cursor rules, branding, OpenAPI) with domain-safe replacements. Details: cmd/rename.


Deployment

./scripts/deploy.sh              # QA (default)
./scripts/deploy.sh prod         # Production (confirmation gate)
./scripts/deploy.sh qa api       # Backend only
./scripts/teardown.sh            # Teardown QA resources

scripts/README.md · deployment-options.md (Fly.io, Railway, Render, bare metal)


Code Quality

PatternBackendFrontend
Error handlingapperror, no leaked internalsalive guard + batch() on async
Content states—Switch/Match, no nested <Show>
SQLParameterized queries, rows.Err(), transactions—
AuthTOCTOU-safe refresh, selector/verifierSSR redirects, reactive 401 logout
Lintinggolangci-lint (see backend/.golangci.yml)ESLint + eslint-plugin-solid
TestingUnit + integration (real DB), race testsVitest 4 + axe-core + Playwright E2E
CoverageCodecov project (see badge); target: 80% gateVitest floors 75/54/78/75 (included files)
Pre-mergeaudit-bugs / audit-codebase before declaring doneSame checklists; T2+ and security slices mandatory
CIPath filters, spec-drift, rule-health, sharded coveragelint, typecheck, build, audit (non-blocking)

Documentation

GuideWhat it covers
Start HereOrientation: app flow, directories, devcontainer, rules
ArchitectureLayers, auth flow, SSE, wire, observability
Module SpecsAuth, users, feature — rules, API surface, test scenarios
Quick StartSetup in 5 minutes
CLI ReferenceMake targets, health endpoints, TEST_DATABASE_URL
Example ModuleBuild a feature end-to-end
Best PracticesCoding standards with real examples
Components70+ UI components reference
Organism PatternHow rules, specs, plans, and drift checks connect
GCP NetworkingCloud Run frontend/API network diagram
Deployment OptionsCloud Run, Fly.io, Railway, Render
API ReferenceOpenAPI 3.1 — paste into Swagger Editor
ChangelogRelease history (latest: 0.3.2; breaking changes in 0.3.0)
Full IndexComplete documentation map

Cursor rules: 45 rules in .cursor/rules/ — full index in cursor-rules.md. Factory workflow: workflow-routing → planning-standards → slice-and-ship / plan-execution-loop; pre-merge audit-bugs before declaring slices done. Split examples: solidjs-pages + solidjs-data-fetching, go-service + go-service-errors.


License

MIT. Some frontend dependencies (AG Grid Community, Observable Plot, Three.js) have their own licenses — review frontend/package.json before commercial use.

Troubleshooting

Docker or DevContainer won't start? Docker Desktop → Troubleshoot → Clean / Purge data, then retry.

Contributing

See CONTRIBUTING.md.