Skip to content

Quick Start ​

Get a GoForge API running locally in under 5 minutes.

1. Create a New Project ​

Pass the project directory name and Go module path:

bash
goforge new myapp github.com/acme/myapp
cd myapp

(Running goforge new with no arguments launches an interactive 4-step wizard where you can also choose which database drivers to keep: sqlite, mysql, postgresql, sqlserver.)

2. Configure Environment & Generate APP_KEY ​

Copy .env.example to .env and generate a 32-byte cryptographic APP_KEY:

bash
cp .env.example .env
goforge gen:key

Why APP_KEY is required

GoForge validates configuration before serving (ValidateForServe()). Starting the server with an empty APP_KEY fails fast so an API never boots unprotected.

3. Run Database Migrations & Seeders ​

Apply the initial schema for the built-in todo service and seed sample records:

bash
goforge migrate
goforge db:seed
  • goforge migrate uses Atlas (DB_MIGRATOR=atlas by default) or GORM AutoMigrate (DB_MIGRATOR=gorm).
  • goforge db:seed runs DatabaseSeeder, which executes TodoSeeder inside a transaction and inserts 3 sample todos idempotently.

4. Start the Application ​

bash
goforge app serve

In an interactive terminal, GoForge opens the TUI Dashboard showing live panels for All logs, HTTP, gRPC, and System with real-time request/route/error counters.

For plain log output (e.g., CI or piping):

bash
goforge app serve --no-tui

5. Test the Endpoints ​

Load APP_KEY into your shell and test the public probes and protected routes:

bash
export APP_KEY=$(grep '^APP_KEY=' .env | cut -d= -f2-)

# Public liveness & readiness probes (no X-App-Key required)
curl http://127.0.0.1:3000/health
curl http://127.0.0.1:3000/ready

# Protected Todo API (requires X-App-Key header)
curl -H "X-App-Key: $APP_KEY" http://127.0.0.1:3000/api/todos

Create a new todo:

bash
curl -X POST http://127.0.0.1:3000/api/todos \
  -H "Content-Type: application/json" \
  -H "X-App-Key: $APP_KEY" \
  -d '{"title":"Ship GoForge app","description":"Test CRUD + events"}'

6. Explore Interactive OpenAPI Docs ​

While APP_DEBUG=true in .env, OpenAPI 3.1 docs are accessible in your browser:

  • Interactive UI: http://127.0.0.1:3000/api/docs/todo
  • OpenAPI JSON spec: http://127.0.0.1:3000/api/docs/todo.json

(When APP_DEBUG=false, /api/docs/* routes require X-App-Key automatically.)


Next: Build TaskForge — Full End-to-End Tutorial (Limen Auth, CRUD, Docs, Events, gRPC & Tests) →

Released under the Apache-2.0 License.