A showcase of a simple RESTful API server written in Go for storing and tracking sleep.
- Echo: router
- PostgreSQL: backend database
- JWT: bearer token authentication
- sqlc: code-gen from SQL
- Swagger: documentation
The docker compose deployment is only meant for development and not production. It does not have persistence of the database by default.
Build the image and start docker with compose
nix build .#dockerImages.x86_64-linux.sleep-track
docker load < result
docker compose up -dThe API is served to localhost:8080 at root / and the Swagger documentation is served at /docs.
A docker image is provided in packages that can be used to deploy the server on a Kubernetes cluster.
The dependency services required by the sleep tracker server:
- PostgreSQL
Optionally:
- Swagger
Running all tests (requires that PostgreSQL is set up):
just testRunning tests without PostgreSQL:
just devtest