Simple template suitable for building a webapp backend MVP written in go

A simple go project structure setup with all dependencies you need to get your MVP off the ground.

The project is suited as starting point for a simple webapp MVP. Besides the core files needed to get the setup running it contains a simple user module showcasing the intended project structure. Running the project starts the app exposing a REST API using the go-shipped webserver.


  • Hot reloading.
  • sqlite3 database for local development.
  • ORM ready to go.
  • A simple database migration system.
  • Injection of environment variables into config files.
  • Simple spring-like repository structure for convenient database queries.
  • Testing setup.

Feedback and PRs welcome! I hope you find it useful.


Installation and Run Project

$ git clone
$ cd go-project-template

# You need to get air separately to get the hot reloading running 
$ go get -u

# Runs the project with hot reloading enabled
$ air

Interact with the app using the command line

$ curl localhost:8008/create?name=John
$ User with name John1 created

$ curl localhost:8008/greet?name=John
$ Hi John
$ {
$   "ID": 1,
$   "CreatedAt": "2021-04-07T21:32:14.135761+02:00",
$   "UpdatedAt": "2021-04-07T21:32:14.135761+02:00",
$   "DeletedAt": null,
$   "Name": "John"
$ }

Project Setup

  • cmd: Contains the app binaries
  • core: The app’s core functionality resides here (such as database handling, migrations etc.)
  • core/db/migrations: SQL migration files go in here. Use ./scripts/ migration_name to create a new one. Migrations in this folder are automatically executed (in order) once upon app start.
  • scripts: Automation scripts. There is a script to bootstrap a new migration and another to downgrade an already applied migration.
  • server: Exposes the app as REST API and handles the HTTP server setup.
  • user: A user module showcasing a simple structure using repository and REST handler.

Changing the Project Name

To change the project name from go-project-name to something else you need to edit the go.mod module end edit the first line module to module Imports in all files need to be changed according (your IDE probably can do that for you
). Further, you might also want change cmd/project-name and therefore you also need to change line 6 of .air.conf. But that should be it then.

Libraries Used



Issues resetting an array using Node.js when routing an API

Five day forecast for loop not returning data