Skip to content

vladTrex/event-mint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EventMint

Microservices backend for user account management and authentication.

Architecture

┌─────────┐     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.

Prerequisites

  • Node.js 20+
  • npm
  • Docker & Docker Compose

Quick start

1. Start infrastructure

docker compose up -d

2. Start account service

cd account
npm install
npm run start:dev

Swagger: http://localhost:9000/api/account/docs

3. Start auth service

In a separate terminal:

cd auth
npm install
npm run start:dev

Swagger: http://localhost:9001/api/auth/docs

4. Create a user and log in

./scripts/create-user.sh
./scripts/test-auth-login.sh

Or 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"
  }'

Infrastructure

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 down

Project structure

EventMint/
├── account/          # User management microservice
├── auth/             # Authentication microservice
├── prometheus/       # Prometheus scrape config
├── scripts/          # Helper shell scripts
└── docker-compose.yml

Environment

Each service uses its own .env file:

  • account/.env — database, Redis, HTTP settings
  • auth/.env — JWT secrets, account service URL, Redis

See service READMEs for full variable lists:

Scripts

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

Monitoring

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).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors