Go Base

screenshot of Go Base

Go RESTful API Boilerplate with JWT Authentication backed by PostgreSQL

Overview

The Go Restful API Boilerplate is an easily extendible RESTful API boilerplate that aims to follow idiomatic Go and best practices. The goal of this boilerplate is to provide a solid and structured foundation for building upon. Feedback and pull requests are welcome and highly appreciated.

Features

  • Configuration using viper
  • CLI features using cobra
  • PostgreSQL support including migrations using go-pg
  • Structured logging with Logrus
  • Routing with chi router and middleware
  • JWT Authentication using lestrrat-go/jwx with example passwordless email authentication
  • Request data validation using ozzo-validation
  • HTML emails with go-mail

Using Docker Compose

  1. Start the database only:
docker-compose up -d postgres
  1. Initialize the database by running all migrations in the database/migrate folder:
docker-compose exec server ./main migrate
  1. Start the API server:
docker-compose up server

Summary

The Go Restful API Boilerplate is a flexible and feature-rich boilerplate for building RESTful APIs with Go. It provides a minimal set of typical Web API requirements and allows for easy extension and customization. The installation process is straightforward, and it can be used either locally or with Docker Compose. Overall, this boilerplate provides a solid foundation for building high-quality Go-based RESTful APIs.

fullstack
Fullstack

A fullstack boilerplate provides a starter application that includes both frontend and backend. It should include database, auth, payments, user roles and other backend services to build a fully featured saas or webapps.