This repo holds the backend server for Zentra, an encrypted community chat application.
- Go 1.23 - Backend language
- PostgreSQL 16 - Primary database with partitioned tables
- Redis 7 - Session storage, caching, pub/sub
- MinIO - S3-compatible object storage
- Chi Router - HTTP routing
- gorilla/websocket - WebSocket connections
- Go 1.23+
- Docker & Docker Compose
- Make (optional)
-
Clone the repository
git clone https://github.com/zentra-chat/server.git cd server -
Set up environment
cp .env.example .env
-
Start infrastructure
docker compose up -d postgres redis minio
-
Run migrations
docker compose run --rm migrate up
-
Start the server
docker compose up -d --build api
The API will be available at http://localhost:63566 (default API_PORT).
For full API details, see API.md.
To remove containers and volumes:
docker compose down -vUse the dedicated migration container:
# apply all pending migrations
docker compose run --rm migrate up
# rollback one migration
docker compose run --rm migrate down 1
# rollback three migrations
docker compose run --rm migrate down 3Run migrations after PostgreSQL is up and before launching API changes that depend on new schema.
# Install dependencies
go mod download
# Run with hot reload (using air)
air