Skip to content
Rafał Lorenz edited this page Mar 2, 2018 · 20 revisions

Prerequisites

In order to run this project you need to have Docker > 1.17.05 installed for building the production image.

Instalation

git clone [email protected]:vardius/go-api-boilerplate.git

Configuration

Create your local .env file from dist.env files.

For each of binaries when building a docker image the environment variable file will be passed (Located in the binary directory). This repository contains example .env file for server binary. There is also .env file containing local configurations and is to be git ignored where dist.env contains versioned example of project configuration.

Remember to set PKG variable pointing to your repository, also change all imports from github.com/vardius/go-api-boilerplate/* to your-repository/*

Repository structure

Repository holds two top-level directories, pkg and cmd.

pkg directory contains directories for each of libraries.

cmd directory contains directories for each of binaries.

Directory Layout

  .
  ├── /.vscode/            # Visual Studio Code remote debugging setttings
  ├── /nginx/              # Nginx docker container configuration
  ├── /cmd/                # Binaries
  │   ├── /userserver/     # User service server binary
  │   │   └── /main.go     # User domain grpc server
  │   │   └── /.env        # Binary environment configuration
  │   ├── /apiserver/      # API Server binary
  │   │   └── /main.go     # API Server application - glues together libraries
  │   │   └── /.env        # Binary environment configuration
  │   ├── /...             # etc.
  ├── /internal/           # Internal libraries
  │   ├── /user/           # User bounded context
  │   │   ├── /domain/     # User domain
  │   │   ├── /server/     # User server implementation
  │   │   ├── /client/     # User client implementation
  ├── /pkg/                # Libraries
  │   ├── /proto/          # Package proto is a generated protocol buffer package.
  │   ├── /auth/           # Authorization tools
  │   ├── /domain/         # Domain libraries
  │   ├── /http/           # Http utils
  │   ├── /...             # etc.
  ├── /vendor/             # Vendor libraries
  ├── docker-compose.yml   # Defines Docker services, networks and volumes per developer environment
  ├── Dockerfile           # Docker image for production
  ├── Makefile             # Commands for building a Docker image for production and deployment
  ├── .env                 # Project environment configuration
Clone this wiki locally