TL;DR:
make upThis is a project template for golang API projects based on Clean Architecture, Hexagonal Architecture and DDD.
Aiming to be simple as possible, this project follows Golang Standard Project Layout structure applying code patterns found in Uber Style Guide being a guide with useful ideas on writing Go code in general.
We use these following technologies in this project:
- echo;
- aws-lambda;
- postgres;
- redis;
- docker;
- docker-compose;
- and other technologies.
Configure the following environment variables for local project execution:
| Variable | Default Value |
|---|---|
| SERVICE_NAME | go-project-template |
| SERVICE_VERSION | 0.0.1 |
| ENVIRONMENT | local |
| LAMBDA | false |
| LOG_LEVEL | debug |
| SERVER_HOST | 0.0.0.0 |
| SERVER_PORT | 5000 |
| SERVER_TIMEOUT | 30 |
| DB_READ_HOST | localhost |
| DB_READ_PORT | 5432 |
| DB_READ_NAME | go-project-template |
| DB_READ_USERNAME | postgres |
| DB_READ_PASSWORD | postgres123 |
| DB_READ_LAZY_CONNECTION | true |
| DB_READ_MIN_CONNECTIONS | 2 |
| DB_READ_MAX_CONNECTIONS | 10 |
| DB_READ_CONNECTION_MAX_LIFE_TIME | 900 |
| DB_READ_CONNECTION_MAX_IDLE_TIME | 60 |
| DB_WRITE_HOST | localhost |
| DB_WRITE_PORT | 5432 |
| DB_WRITE_NAME | go-project-template |
| DB_WRITE_USERNAME | postgres |
| DB_WRITE_PASSWORD | postgres123 |
| DB_WRITE_LAZY_CONNECTION | true |
| DB_WRITE_MIN_CONNECTIONS | 2 |
| DB_WRITE_MAX_CONNECTIONS | 10 |
| DB_WRITE_CONNECTION_MAX_LIFE_TIME | 900 |
| DB_WRITE_CONNECTION_MAX_IDLE_TIME | 60 |
| REDIS_HOST | localhost |
| REDIS_PORT | 6379 |
| REDIS_PASSWORD | |
| REDIS_DB | 1 |
| REDIS_LAZY_CONNECTION | true |
Environment variables separated by semicolon:
SERVICE_NAME=go-project-template;SERVICE_VERSION=0.0.1;ENVIRONMENT=local;LAMBDA=false;LOG_LEVEL=debug;SERVER_HOST=0.0.0.0;SERVER_PORT=5000;SERVER_TIMEOUT=30;DB_READ_HOST=localhost;DB_READ_PORT=5432;DB_READ_NAME=go-project-template;DB_READ_USERNAME=postgres;DB_READ_PASSWORD=postgres123;DB_READ_LAZY_CONNECTION=true;DB_READ_MIN_CONNECTIONS=2;DB_READ_MAX_CONNECTIONS=10;DB_READ_CONNECTION_MAX_LIFE_TIME=900;DB_READ_CONNECTION_MAX_IDLE_TIME=60;DB_WRITE_HOST=localhost;DB_WRITE_PORT=5432;DB_WRITE_NAME=go-project-template;DB_WRITE_USERNAME=postgres;DB_WRITE_PASSWORD=postgres123;DB_WRITE_LAZY_CONNECTION=true;DB_WRITE_MIN_CONNECTIONS=2;DB_WRITE_MAX_CONNECTIONS=10;DB_WRITE_CONNECTION_MAX_LIFE_TIME=900;DB_WRITE_CONNECTION_MAX_IDLE_TIME=60;REDIS_HOST=localhost;REDIS_PORT=6379;REDIS_PASSWORD=;REDIS_DB=1;REDIS_LAZY_CONNECTION=true;
To start application and all dependenciove in this project, run:
make upTo remove all docker containers downloaded and installed by this project, run:
make downIn progress ...
In progress ...