This is a backend application for a notes app, developed using Go. The API supports both REST and GraphQL communication. While the application is designed to be simple in terms of business logic, it serves as a robust example of a Go project structure. It is intended to be a solid starting point for more complex applications.
- Programming language - Go
- Http server - net/http
- GraphQL library - gqlgen
- Database - PostgreSQL
- Cache - Redis
- Install Docker
- Install Bruno from here.
- Clone the repo
git clone https://github.com/daniarmas/notes.git
- Open the Bruno collections at ./api/bruno.
- Configure an object storage service compatible with the Amazon S3 API. DigitalOcean Spaces was used in the development. Ensure you update the access key, secret key and bucket name in the docker compose file enviroment variables.
- Create the
.env
file with the env vars in example.envcp example.env .env
- Deploy docker compose file
docker compose -f deploy/docker-compose.yaml up -d
- Install Go 1.22.4
- Install Docker
- Install direnv to export the environment variables. (only for development)
- Clone the repo
git clone https://github.com/daniarmas/notes.git
- Install Go dependencies
go mod download
- Deploy docker compose file
docker compose -f deploy/docker-compose-dev.yaml up -d
- Run direnv command to approve his content
direnv allow
- Create the
.envrc
file with the env vars in example.envrc -
cp example.envrc .envrc
- Create the database tables
go run main.go create database
- Seed the database. This seed the database for test purpose
go run main.go create seed
- Configure an object storage service compatible with the Amazon S3 API. DigitalOcean Spaces was used in the development. Ensure you update the access key, secret key and bucket name in the
.envrc
file. - Run the app
go run main.go run
After completing step 3 in the Setup for development section, go to http://localhost:8081 to open Swagger UI.
Distributed under the MIT License. See LICENSE.txt
for more information.