Local Testing
Overview
This page describes how to run and test the GitiNext backend (Gateway, Wallet, Watchers, Payment, etc.) locally for development and debugging.
Prerequisites
- Go 1.22+
- Docker and Docker Compose (optional but recommended)
- PostgreSQL 15 and Redis (or run via Compose)
Options
1. Docker Compose (recommended)
- Use the project’s
docker-compose.yml(ordocker-compose.dev.yml) to start:- PostgreSQL, Redis, NATS (if used), MinIO (if used)
- Gateway, Wallet, Account, Payment, Watchers (as defined)
- Point Gateway to local service hostnames (e.g.
wallet:7080). - Access:
- API:
http://localhost:8080(or port in compose) - Swagger:
http://localhost:8080/swagger/ - Health:
http://localhost:8080/healthz
- API:
2. Go run (per service)
- Start dependencies first (Postgres, Redis, NATS).
- From each service directory, e.g.
go run ./cmd/server. - Set env (e.g.
DB_DSN,REDIS_URL,NATS_URL) so services can connect. - Start Gateway last so it can reach other services (use
localhostports if not in Docker network).
3. Integration tests
- Use
testcontainersor a script that brings up Postgres/Redis, runs migrations, then runs Go tests. - Tests should use unique DB names or schemas to avoid clashes.
Flow (local stack)
flowchart LR
A[You] --> B[Gateway :8080]
B --> C[Wallet]
B --> D[Account]
B --> E[Payment]
C --> F[(Postgres)]
D --> F
E --> F
C --> G[Redis]
Common env vars
| Variable | Purpose |
|---|---|
DB_DSN |
PostgreSQL connection |
REDIS_URL |
Redis connection |
NATS_URL |
NATS (if used) |
GATEWAY_PORT |
Gateway HTTP port |
WALLET_ADDR |
Wallet service URL for Gateway |
Exact names may differ per service; check each service’s internal/config or env docs.