Go8

screenshot of Go8

Go + Postgres + Chi Router + sqlx + ent + authentication + testing + opentelemetry Starter Kit for API Development

Overview

This product is a starter kit for Go API development that is inspired by the article "How I write HTTP services after eight years". It is designed to use the popular chi router, sqlx for database operations, and implement a layered architecture for better code organization. The kit includes features such as authentication, testing, database migration, input validation, and more. It is a framework-less solution that aims to provide a clear and modular structure for building APIs in Go.

Features

  • Framework-less and net/http compatible handlers
  • Router/Mux with Chi Router
  • Database Operations with sqlx
  • Database Operations with ent
  • Database migration with goose
  • Input validation that returns multiple error strings
  • Read all configurations using a single .env file or environment variable
  • Clear directory structure for easy navigation
  • Optional request log that logs each user uniquely based on host address
  • CORS support
  • Swagger docs generation using declarative comments format
  • Custom model JSON output
  • Filters and Resources for pagination parsing and custom response
  • Cache layer
  • Authentication using cookie-based session
  • Task tool for simplifying tasks like mocking, linting, test coverage, hot reload, etc.
  • Unit testing with mocks and dockertest
  • Integration testing
  • End-to-end testing using ephemeral docker containers

Summary

The Go API starter kit is a framework-less solution for building APIs in Go. It provides a clear and modular structure for organizing code and includes several features such as authentication, testing, database operations, input validation, and more. With its use of popular libraries like chi router and sqlx, developers can easily get started with building APIs in Go while maintaining flexibility and control over the project.