Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Go Programming Bootcamp

Lesson 60 of 60 · Go

Capstone Project – Build a Todo API Service

Duration: 30 minutes

Capstone: Todo API Service

This lesson explains the main concept clearly with beginner-friendly examples and background so you can learn why the code works.

Goal

Create a production‑grade Todo service that demonstrates:

  • RESTful JSON API (net/http).
  • Persistent storage with SQLite.
  • JWT‑protected endpoints.
  • Dockerized deployment.
  • Unit & integration tests.
  • CI pipeline using GitHub Actions.

Project Layout (recommended)

/go-todo/
├── cmd/               # `main` packages
│   └── server/main.go
├── internal/
│   ├── model/        # Todo struct, DB helpers
│   ├── api/          # Handlers, middleware
│   └── auth/         # JWT utilities
├── pkg/              # Reusable utilities (e.g., logger)
├── migrations/       # SQL schema files
└── go.mod

Features to implement

  1. User registration & login – issue JWT.
  2. CRUD for Todo items – each Todo belongs to a user.
  3. Pagination (limit, offset).
  4. Graceful shutdown with context & signal handling.
  5. Health‑check endpoint (/healthz).
  6. OpenAPI spec generated via swaggo.
  7. Dockerfile (multi‑stage) and docker-compose.yml for local dev.
  8. GitHub Actions workflow that:
    • Lints (go vet, staticcheck).
    • Runs unit tests (go test ./...).
    • Builds the Docker image.
    • Publishes a release on tag.

Suggested Steps

StepDescription
1Scaffold the module (go mod init github.com/you/todo).
2Define the Todo model and SQLite schema (migrations/001_init.sql).
3Implement the repository layer (internal/model/repo.go).
4Write authentication middleware (JWT).
5Build HTTP handlers (internal/api/handlers.go).
6Add OpenAPI annotations and generate docs (swag init).
7Write unit tests for repo & handlers (*_test.go).
8Dockerize and test locally (docker-compose up).
9Create a GitHub Actions workflow (.github/workflows/ci.yml).
10Deploy to your preferred cloud (Docker, Cloud Run, or K8s).

Deliverables

  • Public GitHub repository.
  • README.md with setup, run, and API usage instructions.
  • Swagger UI available at http://localhost:8080/swagger/index.html.
  • CI badge showing build status.
  • Docker image published to GitHub Container Registry.

Success

Completing this capstone demonstrates you can take a Go project from idea to production – exactly what employers look for!

Previous: Deploying a gRPC Service on Google Cloud RunBack to Go Programming Bootcamp