A curated collection of example projects demonstrating how to build production-style services with the Keel framework and the Keel CLI.
Each example is small, focused, and self-contained — you can run any of them independently in under a minute.
Keel is a modular Go framework for building web services. It provides:
- Structured modules, controllers, and services
- Built-in health checks, request logging, and OpenAPI docs
- Composable middleware and guards
- Scheduler, event bus, and tracing hooks
- First-class validation via struct tags
If you are new to Keel, work through the examples in order:
| Step | Example | Concept |
|---|---|---|
| 1 | 01-hello-world | Bootstrap a Keel app and define a route |
| 2 | 02-config-env | Load configuration from environment variables |
| 3 | 03-health-check | Add custom health checkers |
| 4 | 04-rest-crud | Build a complete CRUD REST service |
| 5 | 05-validation | Validate request bodies with struct tags |
| 6 | 06-middleware | Write and apply custom middleware |
| 7 | 07-jwt-auth | Protect routes with the ss-keel-jwt addon |
| 8 | 08-gorm-postgres | Persist data with GORM and PostgreSQL |
| 9 | 09-scheduler-cron | Schedule background jobs with cron |
| 10 | 10-addon-example | Integrate a Keel addon |
| 11 | 11-jwt-addon | JWT addon flow with refresh and RBAC |
| 12 | 12-oauth | OAuth2 login with GitHub and Google |
| 13 | 13-mongo | Document CRUD with MongoDB |
| 14 | 14-redis-cache | Cache-aside reads with Redis |
| 15 | 15-devpanel | Real-time observability UI with the DevPanel addon |
| 16 | 16-otel | Distributed tracing with the OpenTelemetry addon |
Examples 01–10 use the module pattern from ss-keel-core directly with a flat main.go at the repo root. Examples 11–16 (addon-based) follow the same flat layout intentionally, so each example stays self-contained and runnable without the Keel CLI scaffold.
Projects created with keel new use a cmd/main.go layout with application.properties and .env/.env.example. When comparing example code against a generated project, translate root-level main.go to cmd/main.go.
Minimal Keel app with a single GET /hello route. The starting point for every Keel service.
Structured configuration loader using environment variables with typed defaults.
Built-in /health endpoint plus a custom HealthChecker that inspects an in-memory dependency.
Full CRUD for a Task resource: list, get, create, update, and delete — all in-memory, no database required.
Shows how Keel uses validate struct tags together with ctx.ParseBody() to return structured 422 errors automatically.
Custom request middleware: correlation ID injection, response timing header, and a simple IP blocklist.
JWT authentication using the ss-keel-jwt addon in a minimal login flow. Issues tokens on POST /auth/login and protects routes with the addon's reusable middleware.
Database-backed CRUD using ss-keel-gorm with migrations, a repository pattern, and connection health checks.
Register recurring background jobs with the Keel scheduler. Includes a simple in-memory job that runs on a configurable cron expression.
Demonstrates how to consume a Keel addon installed via the Keel CLI (keel add).
A deeper ss-keel-jwt addon example focused on token refresh, claims inspection, and role-based access control on top of jwtProvider.Middleware().
Social login with GitHub and Google via the ss-keel-oauth addon. After the OAuth flow the addon issues a signed JWT so protected routes work identically to the JWT addon example.
Document CRUD using the ss-keel-mongo addon: EntityBase, a generic typed repository, pagination, partial updates, and a built-in MongoDB health checker.
Cache-aside reads and invalidation using the ss-keel-redis addon. The module receives *ssredis.Client, while the service depends on the generic contracts.Cache interface.
Real-time observability UI powered by the ss-keel-devpanel addon. Captures every HTTP request in a ring buffer, streams structured logs from panel.Logger(), and exposes config and route inspection — all in a browser UI at /keel/panel.
Distributed tracing and metrics via the ss-keel-otel addon. Shows automatic HTTP spans from the OTel middleware, manual child spans with app.Tracer().Start(), span attributes, and error recording — with OTLP export to Jaeger.
Each example is an independent Go module. To run any example:
# 1. Enter the example directory
cd examples/01-hello-world
# 2. Copy the environment file
cp .env.example .env
# 3. Download dependencies
go mod download
# 4. Run the service
go run main.goThe server starts on port 7331 by default.
Open the interactive API docs at http://localhost:7331/docs.
Note: Some examples (08-gorm-postgres, 12-oauth, 13-mongo, 14-redis-cache, 16-otel) require Docker or external services. See each example's README for details.
Config: Every example uses
application.properties+config.MustLoadConfigfor typed configuration — no manualos.Getenvcalls needed.
ss-keel-examples/
├── examples/ # One subdirectory per example
│ ├── 01-hello-world/
│ ├── 02-config-env/
│ └── ...
├── shared/
│ ├── docker/ # Shared Docker Compose files for dependencies
│ └── scripts/ # Helper shell scripts
└── docs/
├── learning-path.md
└── example-matrix.md
| Project | Description |
|---|---|
| ss-keel-core | The Keel framework |
| ss-keel-cli | CLI for scaffolding Keel projects |
| ss-keel-docs | Official documentation |
| ss-keel-addon-template | Template for creating Keel addons |
Examples that fix bugs, improve clarity, or add new concepts are welcome. Please open an issue first to discuss the change.
MIT — SliceSoft