Skip to content

42LM/go-backend-skeleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-backend-skeleton

This repository acts as a template for a simple go backend with the focus on not using too much external dependencies.

It utilizes:

Development

Copy .envrc.example

cp .envrc.example .envrc

Tip

Use a tool like direnv to load and unload environment variables depending on the current directory.

Install tools (currently only mockery)

go install tool

Setup DB (currently only dynamodb)

docker compose up -d

Run tests

go test ./...

Run server

go run main.go server

Make a request

curl localhost:8080/v1/none
curl localhost:8080/v1/msg/777
curl -X POST localhost:8080/v2/msg/777 -d '{"msg":"test-msg"}'

Generate mocks + proto

Generate mocks from interfaces with mockery and use

go generate ./...

Build

go build -ldflags "-X go-backend-skeleton/app/cmd.version=v0.0.0" -o gbs

Troubleshoot

Make sure you install the go tools:

go install tool

Make sure the protobuf is installed on your machine. For more info check protobuf.

  • brew install protobuf

About

A minimal Go backend skeleton with a focus on few dependencies.

Resources

License

Stars

Watchers

Forks