A high-performance, concurrent backend system simulating a trade settlement engine. This project demonstrates advanced patterns in Distributed Systems, including ACID transactions, worker pools for concurrency, and infrastructure-as-code.
The system mimics a real-world fintech settlement pipeline:
- Ingestion API (Producer): A Go HTTP server accepts trade orders and persists them to Postgres (
PENDINGstate) with zero latency. - Settlement Engine (Consumer): A background worker pool processes trades concurrently, simulating market latency and execution logic.
- Real-Time Dashboard: Server-Sent Events (SSE) push updates to the UI instantly upon settlement.
- Language: Go 1.23+ (Chi Router, Pgx Driver)
- Database: PostgreSQL 16 (running in Docker)
- Infrastructure: Docker Compose, Taskfile
- Frontend: Templ + Datastar (planned)
This project uses Task (go-task) for workflow automation.
- Go 1.23+
- Docker Desktop
- Task (or use
makeif preferred)
Copy the example environment file:
cp .env.example .envSpin up the Postgres database in a container. This will automatically apply the schema migrations found in /migrations.
task upStart the Go server locally. It connects to the Dockerized database automatically.
task runYou should see:
Connected to database! Starting server on :8080...
We use a Taskfile.yml to standardize commands across the team.
| Command | Description |
|---|---|
task up |
Start the database container (detached) |
task down |
Stop and remove the database container |
task run |
Run the Go application (hot-reloads .env) |
task db-shell |
Open a PSQL CLI session inside the container |
task logs |
Tail the database logs |
task build |
Compile the binary to /bin |
(Coming soon...)