NektoKZ is a high-performance, production-grade microservices platform for real-time anonymous text and voice communication. Built with Go (backend), Next.js (frontend), deployed on Oracle Cloud Infrastructure via Terraform.
The system follows a microservices architecture with all services communicating over an isolated Docker network (nektokz-network). Only the API Gateway is exposed to the public internet via Nginx Proxy Manager.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Internet β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
ββββββββββΌβββββββββ
β Nginx Proxy β
β Manager β
ββββββββββ¬βββββββββ
β
ββββββββββΌβββββββββ
β API Gateway β :8080
ββββββββββ¬βββββββββ
β nektokz-network
ββββββββββββββββΌβββββββββββββββββββ
β β β
βββββββββΌβββββββ βββββββΌβββββββ ββββββββββΌβββββββββ
β user-service β βchat-serviceβ βmatchmaking-svc β
β :8081 β β :8083 β β :8082 β
ββββββββββββββββ ββββββββββββββ βββββββββββββββββββ
β β
βββββββββΌβββββββββββββββΌββββββββ
β nektokz-postgres :5432 β
β nektokz-redis :6379 β
ββββββββββββββββββββββββββββββββ
| Service | Port | Description |
|---|---|---|
| api-gateway | 8080 | Central entry point, request routing |
| user-service | 8081 | Authentication & profile management |
| matchmaking-service | 8082 | User matching algorithms |
| chat-service | 8083 | Real-time WebSocket messaging |
| moderation-service | 8084 | Content filtering & reporting |
| notification-service | 8085 | Internal event notifications |
| Component | Technology |
|---|---|
| Backend | Go 1.25 / Chi v5 |
| Frontend | Next.js 15 |
| Database | PostgreSQL 16 / Redis 7 |
| WebRTC | Coturn (STUN/TURN) |
| Monitoring | Prometheus / Grafana / Node Exporter |
| IaC | Terraform (Oracle Cloud / OCI) |
| Reverse Proxy | Nginx Proxy Manager |
- Docker & Docker Compose v2+ β required
- Go 1.25+ β only if running services locally without Docker
- Node.js 20+ & npm β only if running frontend locally
- Make β optional, used as a shortcut for Docker Compose commands
git clone https://github.com/mathalama/anon.git
cd anon
cp .env.example .env
# Edit .env with your valuesWith Make:
make up-infraWithout Make (Docker Compose directly):
docker compose -f docker-compose.infra.yml up -dWith Make:
make migrateWithout Make:
docker compose -f docker-compose.infra.yml run --rm migrateWith Make:
make up-servicesWithout Make:
docker compose -f docker-compose.services.yml up -ddocker compose -f docker-compose.monitoring.yml up -dcd frontend
npm install
npm run dev| Command | Docker Compose Equivalent | Description |
|---|---|---|
make up |
docker compose -f docker-compose.infra.yml -f docker-compose.services.yml up -d |
Start all backend containers |
make up-infra |
docker compose -f docker-compose.infra.yml up -d |
Start PostgreSQL, Redis, Coturn |
make up-services |
docker compose -f docker-compose.services.yml up -d |
Start all microservices |
make down |
docker compose -f docker-compose.infra.yml -f docker-compose.services.yml down |
Stop and remove all containers |
make migrate |
docker compose -f docker-compose.infra.yml run --rm migrate |
Run database migrations |
make logs-services |
docker compose -f docker-compose.services.yml logs -f |
Tail logs for Go services |
make logs-infra |
docker compose -f docker-compose.infra.yml logs -f |
View logs for DBs & Redis |
βββ api-gateway/ # Central entry point & routing
βββ user-service/ # Authentication & profile management
βββ chat-service/ # Real-time WebSocket messaging
βββ matchmaking-service/ # User matching algorithms
βββ moderation-service/ # Content filtering & reporting
βββ notification-service/ # Internal event notifications
βββ frontend/ # Next.js web application
βββ docker/
β βββ postgres/init/ # DB initialization scripts
βββ terraform/ # OCI Infrastructure as Code
β βββ main.tf
β βββ variables.tf
β βββ setup.sh
β βββ outputs.tf
β βββ terraform.tfvars
βββ monitoring/
β βββ prometheus/ # Prometheus config & scrape targets
βββ docker-compose.infra.yml # PostgreSQL, Redis, Coturn
βββ docker-compose.services.yml # All microservices
βββ docker-compose.monitoring.yml # Prometheus, Grafana, Node Exporter
βββ Makefile
βββ .env.example
| Service | URL |
|---|---|
| Frontend | http://localhost:3000 |
| API Gateway | http://localhost:8080 |
| Nginx Proxy Manager Admin | http://localhost:81 |
The monitoring stack uses Prometheus for metrics collection and Grafana for visualization.
Prometheus scrapes metrics from all 6 microservices and the API Gateway via /metrics endpoints on their respective ports.
Grafana dashboards include:
- Service availability (up/down status per service)
- Node Exporter: CPU, RAM, Disk, Network for the host machine
To verify all services are UP:
- Open Prometheus through an SSH tunnel or internal access path
- All
nektokz-servicestargets should show stateUP
The server is provisioned on Oracle Cloud Infrastructure (OCI) using Terraform. See terraform/ for full configuration.
- Compute Instance:
VM.Standard.E2.1.Micro(Always Free tier) - OS: Ubuntu 24.04 LTS
- Region: EU Stockholm (eu-stockholm-1)
| Port | Protocol | Purpose |
|---|---|---|
| 22 | TCP | SSH management |
| 80 | TCP | HTTP / API Gateway |
| 443 | TCP | HTTPS |
| 81 | TCP | Nginx Proxy Manager admin |
Grafana and Prometheus should stay bound to 127.0.0.1 unless you intentionally place them behind VPN, SSH tunneling, or an allowlisted reverse proxy.
cd terraform
cp terraform.tfvars.example terraform.tfvars
# Fill in your OCI credentials
terraform init
terraform plan
terraform applyAfter apply, the public IP is printed as output: instance_public_ip.
Ansible is used to automate server configuration and application deployment.
- Ansible installed on your local machine.
- SSH access to the provisioned server.
Update ansible/inventory.ini with your server's public IP:
[servers]
server1 ansible_host=YOUR_SERVER_IP ansible_user=ubuntuTo configure the server (Docker, Swap, Git) and deploy the application:
cd ansible
ansible-playbook playbook.ymlTags:
setup: Run only server configuration tasks.deploy: Run only application deployment tasks.
Example (only deploy):
ansible-playbook playbook.yml --tags deployRefer to DEPLOYMENT.md for OCI cloud deployment details.
GitHub Actions workflows are located in .github/workflows/. The pipeline handles automated building and image publishing to ghcr.io/mathalama/.
This project is for educational and demonstration purposes. All rights reserved.