Skip to content

funcGoBackendStarter()Project

A production-oriented Go backend template.

GoChiPostgreSQLSQLCDockerJWTTesting
View on GitHub

What it is

GoBackend Starter is a minimal, explicit Go backend template that demonstrates the architecture used throughout the articles on GoBackend.dev: a clean separation between handlers, services, and repositories, explicit SQL via SQLC, and JWT-based authentication — without unnecessary frameworks or abstractions.

Architecture

cmd/api/            entrypoint, server wiring
internal/config/    environment configuration
internal/handler/   HTTP handlers (Chi)
internal/middleware/ auth, logging, request ID, recovery
internal/service/   business logic
internal/repository/ SQLC-generated database access
internal/model/      domain types
migrations/          SQL migrations
tests/                integration tests

API Endpoints

GET/health
GET/ready
POST/api/v1/auth/register
POST/api/v1/auth/login
GET/api/v1/users/me
GET/api/v1/posts
GET/api/v1/posts/:id
POST/api/v1/posts
PUT/api/v1/posts/:id
DELETE/api/v1/posts/:id

Quick start

git clone https://github.com/gobackend-dev/gobackend-starter
cd gobackend-starter
cp .env.example .env
docker compose up

The API is then available at http://localhost:8080. See the project's README for full setup, environment variables, migrations, and test instructions.