Microservices backend for user account management and authentication.
┌─────────┐ HTTP ┌─────────┐ HTTP ┌──────────┐
│ Client │ ────────────► │ auth │ ────────────► │ account │
└─────────┘ └─────────┘ └──────────┘
│ │
└──────── Redis ───────────┘
│
PostgreSQL
| Service | Port | Prefix | Description |
|---|---|---|---|
| account | 9000 |
/api/account |
User CRUD, password verification, Prometheus metrics |
| auth | 9001 |
/api/auth |
JWT login and token refresh |
Shared infrastructure (PostgreSQL, Redis, Prometheus, Grafana) is defined in docker-compose.yml.
- Node.js 20+
- npm
- Docker & Docker Compose
docker compose up -dcd account
npm install
npm run start:devSwagger: http://localhost:9000/api/account/docs
In a separate terminal:
cd auth
npm install
npm run start:devSwagger: http://localhost:9001/api/auth/docs
./scripts/create-user.sh
./scripts/test-auth-login.shOr manually:
# Create user
curl -X POST http://localhost:9000/api/account/user \
-H "Content-Type: application/json" \
-d '{
"login": "johndoe",
"password": "securePassword123",
"phone": "79001110101",
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com"
}'
# Login
curl -X POST http://localhost:9001/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"login": "johndoe",
"password": "securePassword123"
}'| Service | URL / Port | Credentials |
|---|---|---|
| PostgreSQL | localhost:5132 |
postgres / password, database account-db |
| Redis | localhost:6379 |
password redis |
| Prometheus | http://localhost:9090 | — |
| Grafana | http://localhost:3100 | admin / admin |
| Redis Commander | http://localhost:8081 | admin / admin |
Stop infrastructure:
docker compose downEventMint/
├── account/ # User management microservice
├── auth/ # Authentication microservice
├── prometheus/ # Prometheus scrape config
├── scripts/ # Helper shell scripts
└── docker-compose.yml
Each service uses its own .env file:
account/.env— database, Redis, HTTP settingsauth/.env— JWT secrets, account service URL, Redis
See service READMEs for full variable lists:
| Script | Description |
|---|---|
scripts/create-user.sh |
Create a test user in the account service |
scripts/test-auth-login.sh |
Test login via the auth service |
scripts/delete-user.sh |
Delete a user by ID |
The account service exposes Prometheus metrics at:
http://localhost:9000/api/account/metrics
Prometheus scrapes this endpoint via host.docker.internal:9000 (see prometheus/prometheus.yml).