Skip to content

ritza-co/orderify-microservices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Orderify — Admin Dashboard

An order management admin dashboard that integrates with the enterprise platform services.

Architecture

Browser (3000)
    └── BFF / API Gateway (5080)
            ├── Order Service (5050)   → Enterprise Order API (5003)
            ├── Analytics Service (5060) → Enterprise Analytics (5002)
            └── Job Worker (5070)      → Enterprise Order API (5003)

Enterprise Platform (must be running on host):
  Auth Service     :5001
  Analytics        :5002
  Order API        :5003
  Admin Service    :5004
  Fraud Service    :5005

Prerequisites

The enterprise platform must already be running on localhost:5001-5005 before starting these services. See the enterprise platform docs for setup instructions.

Quick Start with Docker

# Build and start all services
docker compose up --build

# Start in background
docker compose up -d --build
Service URL
Admin Dashboard http://localhost:3000
BFF API http://localhost:5080
Order Service http://localhost:5050
Analytics Service http://localhost:5060
Job Worker http://localhost:5070

Default Credentials

Admin Dashboard Login

Username Password Role
order-dashboard-user dashboard_secret_2024 Dashboard user
job-worker-user jobworker_secret_2024 Job worker
analytics-service-user analytics_secret_2024 Analytics

These credentials are used by the services to authenticate with the enterprise platform. Use any of the above usernames and their passwords to log into the admin dashboard UI.

Enterprise Platform Service Tokens (hardcoded in enterprise platform)

Token Header Purpose
super-secret-admin-token-that-changes-quarterly X-Service-Token Create users in Auth Service
approver_token_2024 X-Approver Approve high-risk orders
APR-2024-Q1-SECRET X-Approval-Code Grant permissions

Running Without Docker

Enterprise services (5001-5005) must be running first.

# BFF (port 5080)
cd services/bff
pip install -r requirements.txt
python app.py

# Order Service (port 5050)
cd services/order-service
pip install -r requirements.txt
python app.py

# Analytics Service (port 5060)
cd services/analytics-service
npm install
npm start

# Job Worker (port 5070)
cd services/job-worker
pip install -r requirements.txt
python app.py

# Frontend (port 3000)
cd frontend
npm install
npm run dev

Environment Variables

Each service reads configuration from environment variables, with sensible defaults for local development.

BFF (services/bff)

Variable Default Description
ORDER_SERVICE_URL http://localhost:5050 Order service base URL
ANALYTICS_SERVICE_URL http://localhost:5060 Analytics service base URL
JOB_WORKER_URL http://localhost:5070 Job worker base URL
AUTH_SERVICE_URL http://localhost:5001 Enterprise auth service URL
SECRET_KEY bff-secret-key-... Session signing key
DB_PATH /tmp/bff.db SQLite database path

Order Service (services/order-service)

Variable Default Description
ENTERPRISE_AUTH_URL http://localhost:5001 Enterprise auth URL
ENTERPRISE_ORDER_URL http://localhost:5003 Enterprise order API URL
DEFAULT_USERNAME order-dashboard-user Service account username
DEFAULT_PASSWORD dashboard_secret_2024 Service account password
DB_PATH /tmp/order_service.db SQLite database path

Analytics Service (services/analytics-service)

Variable Default Description
ENTERPRISE_AUTH_URL http://localhost:5001 Enterprise auth URL
ENTERPRISE_ORDER_URL http://localhost:5003 Enterprise order API URL
ENTERPRISE_ANALYTICS_URL http://localhost:5002 Enterprise analytics URL
DEFAULT_USERNAME analytics-service-user Service account username
DEFAULT_PASSWORD analytics_secret_2024 Service account password
DB_PATH /tmp/analytics_service.db SQLite database path

Job Worker (services/job-worker)

Variable Default Description
ENTERPRISE_AUTH_URL http://localhost:5001 Enterprise auth URL
ENTERPRISE_ORDER_URL http://localhost:5003 Enterprise order API URL
DEFAULT_USERNAME job-worker-user Service account username
DEFAULT_PASSWORD jobworker_secret_2024 Service account password
AUTO_APPROVE_INTERVAL 60 Auto-approve poll interval (s)
FRAUD_THRESHOLD 50 Max fraud score to auto-approve
DB_PATH /tmp/job_worker.db SQLite database path

API Overview

BFF Endpoints (port 5080)

Method Path Description
POST /api/auth/login Login, returns session token
POST /api/auth/logout Logout
GET /api/auth/session Check current session
POST /api/orders/submit Submit a new order
GET /api/orders?customer_id= List orders
GET /api/orders/<id> Get single order
POST /api/orders/<id>/update Update order status
GET /api/analytics/orders-per-month Monthly order counts
GET /api/analytics/events Analytics events
GET /api/jobs List background jobs
GET /api/jobs/<name>/runs Job run history
GET /api/jobs/<name>/logs Job logs
POST /api/jobs/<name>/pause Pause a job
POST /api/jobs/<name>/resume Resume a job

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors