Skip to content

Hbbb/go-backend-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Backend Template

This template repo is a starting place for any Go backends I write. It is largely inspired by the beautifully written apollo-backend (RIP 🪦).

Project structure

Most of the interesting bits live in the internal directory. I based the structure off the apollo-backend source as well as this blog post from the Go team about organizing a project. It's not prescriptive but it serves as a good starting point.

The top-level cmd folder contains a binary that serves as the entrypoint to the entire codebase. It proxies commands into internal/cmd which contains the domain-specific commands like worker, api, and scheduler. Each of those commands take their own flags and arguments to specify behavior.

Dependencies

Running services

The top-level cmd directory contains the entrypoint CLI to run all of the services. Each service exposes its own CLI that can take whatever flags & arguments it needs.

To run a service, use the root CLI like so:

go-backend-template api --with-flags args

go-backend-template worker --queue send-emails

This repo includes run configurations for VS Code as well, which allows you to run & debug the services from within the editor.

About

A template repo for building Go backends

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages