Small production-ready API stack for storing and reading messages.
- Go API
- PostgreSQL
- Nginx reverse proxy
- Docker
GET /healthzPOST /messageGET /message?limit=50
Example create request:
curl -X POST http://localhost/message \
-H "Content-Type: application/json" \
-d '{"text":"hello from phone"}'Example list request:
curl http://localhost/message- Copy
.env.exampleto.envand set a real password. - Start Docker Desktop if it is not already running.
- Start the stack:
cp .env.example .env
docker compose up --build -dIf .env is missing, Docker Compose will now stop immediately with a clear error
- Check health:
curl http://localhost/healthz- Smoke test the API:
curl -X POST http://localhost/message \
-H "Content-Type: application/json" \
-d '{"text":"hello from phone"}'
curl http://localhost/messageInstall Docker and Docker Compose plugin, then place this folder on the server.
Use a firewall so only ports 80 and 443 are open publicly.
For HTTPS, terminate TLS at Nginx or put a managed proxy in front of it.
Example unit file is in deploy/systemd/personal-api-compose.service.
Install it on the server, then run:
sudo systemctl daemon-reload
sudo systemctl enable --now personal-api-compose