Skip to content

Go boilerplate for server building head-start

Notifications You must be signed in to change notification settings

webpoint-solutions-llc/go-server

Repository files navigation

Go Server Boilerplate

Go server boilerplate with PostgreSQL

Getting Started

NOTE:

We use Makefile to run all our scripts so install it first if you don't have it

Installing Make

  • On Windows
winget install GnuWin32.Make
  • On Mac
brew install make
  • On Linux

use your distro's package manager to install

Initializing the project

  1. Clone the repository

  2. Go inside the directory

cd <dir-name>
  1. Initialize go module
go mod init <your-project-name>
  1. Organize imports
make init

Running the server

  • Start the server in Devlopment mode
make watch
  • Start the server
make run
  • Build the application
make build

Database

  • Install tern
go install github.com/jackc/tern/v2@latest
  • Make new migration
tern new -m internal/database/sql/migrations/ name_of_migration
  • Run the migration
make migrate
  • Write sql queries insite internal/database/sql/migrations/ direcotry.

to reference how to properly write the query go here

  • Generate fully type-safe idiomatic Go code from SQL.
make generate

About

Go boilerplate for server building head-start

Resources

Stars

Watchers

Forks