โ ๏ธ Project Status: This repository is under active development. The documentation describes the target architecture for the complete system. See Implementation Status below for current progress.
OpenMeal is a server-side platform for food ordering and delivery from restaurants and cafes, uniting all process participants: customers, establishments, couriers, support service, and administrators.
The platform implements complete food delivery workflow:
- Customer Experience: Browse restaurants, order food, track courier in real-time, receive notifications
- Restaurant Management: Menu management, order processing, preparation status updates
- Courier Coordination: Automated courier assignment algorithm based on proximity and availability
- Support Operations: Incident handling, refunds, account management with escalation workflows
- Administration: Restaurant verification, permanent account actions, operational analytics
The platform is designed as a backend-ready system with API-first architecture, prepared for frontend integration.
Prerequisites:
- Docker & Docker Compose (v2.0+)
- Java 21+
- Make
- yq (for local development with
microservices.local)
First Time Setup:
# 1. Initialize configuration files
make init
# 2. Configure environment
cp .env.infra.example .env.infra
nano .env.infraEdit .env.infra:
- Set
ENVIRONMENT=local-dev - Configure passwords for databases
- See
config/directory documentation below
# 3. Install pre-commit hooks (recommended)
pipx install pre-commit
pre-commit install --hook-type pre-commit --hook-type commit-msg
# 4. Start infrastructure and services
make up# Check health of all services
make check-services
# View logs
make logsAccess Points:
- API Gateway: http://localhost:8080/api
- Individual microservices: Check
docker-compose.ymlfor port mappings
The project supports 4 deployment environments with different service activation:
| Environment | Profile | Active Services | Use Case |
|---|---|---|---|
| local-dev | local-dev |
Postgres, MongoDB, Redis, MinIO | Developer laptop (minimal resources) |
| shared-dev | shared-dev |
+ Keycloak, Redpanda, Nginx | Shared development VDS |
| stage | stage |
Full stack (no MinIO) | Pre-production testing |
| prod | prod |
Full + Prometheus/Grafana | Production deployment |
Environment is controlled by ENVIRONMENT variable in .env.infra.
Infrastructure & DevOps:
- โ Docker Compose orchestration with multi-environment support
- โ Ansible deployment automation (staging/production)
- โ GitHub Actions CI/CD pipeline
- โ Secrets management (Ansible Vault + GitHub Secrets)
- โ SSL/TLS automation (Let's Encrypt)
- โ Monitoring stack (Prometheus + Grafana)
Microservices (Target: 13 services):
- ๐ง API Gateway - Routing, authentication, rate limiting (In Progress)
- ๐ง User Service - User profiles, addresses, preferences (In Progress)
- ๐ง Auth Service - Authentication, JWT tokens (In Progress)
- โณ Restaurant Service - Menus, schedules, reviews (Planned)
- โณ Order Service - Order lifecycle, status management (Planned)
- โณ Payment Service - ะฎKassa integration, refunds (Planned)
- โณ Dispatch Service - Courier assignment algorithm (Planned)
- โณ Tracking Service - Real-time location tracking (Planned)
- โณ File Service - File upload, S3 storage (Planned)
- โณ External Sender - Push/SMS/Email notifications (Planned)
- โณ Support Service - Incident handling, escalation (Planned)
- โณ Admin Service - Verification, analytics (Planned)
- โณ Report Service - Data aggregation, dashboards (Planned)
Note: Documentation reflects the complete target architecture. Features marked as "Planned" are designed but not yet implemented.
.
โโโ services/
โ โโโ [microservice-name]/
โโโ infrastructure/
โ โโโ ansible/
โ โโโ keycloak/
โโโ compose/
โ โโโ infra.yml
โ โโโ monitoring.yml
โโโ config/
โ โโโ postgres/
โ โโโ mongodb/
โ โโโ redpanda/
โ โโโ nginx/
โโโ scripts/
โโโ makefiles/
โโโ docs/
Key directories:
services/- Spring Boot microservices (domain-driven modules)infrastructure/- Ansible playbooks, roles, and Keycloak customizationcompose/- Docker Compose files for infrastructure and monitoringconfig/- Initialization scripts and templates for databases, Redpanda, Nginxscripts/- Utility scripts for health checks, backups, SSL managementmakefiles/- Modular Makefile includes for different concernsdocs/- Architecture documentation and ADRs
This directory contains initialization scripts and configuration templates for infrastructure services. It solves the problem of environment-aware service initialization and secrets injection.
Structure:
config/
โโโ postgres/
โ โโโ init-db.sh
โ โโโ init-users.conf
โ โโโ init-users.conf.example
โ โโโ check-and-init.sh
โโโ mongodb/
โ โโโ init-db.sh
โ โโโ init-users.conf
โ โโโ init-users.conf.example
โโโ redpanda/
โ โโโ redpanda.yaml.template
โ โโโ generate-config.sh
โ โโโ bootstrap-user.sh
โโโ nginx/
โ โโโ default.conf.template
โ โโโ default-http-only.conf.template
โโโ minio/
โโโ init-buckets.sh
โโโ init-users.conf.example
How it works:
- Template files (
.example,.template) are committed to Git - Actual config files (
.conf,.yaml) are gitignored and generated locally or by Ansible - Init scripts read config files and create database users, buckets, etc.
- Environment variables from
.env.infraare resolved at runtime
Example: PostgreSQL User Initialization
config/postgres/init-users.conf:
keycloak:KEYCLOAK_DB_PASSWORD:keycloak
user_service:USER_SERVICE_DB_PASSWORD:users
order_service:ORDER_SERVICE_DB_PASSWORD:orders
Format: username:ENV_VAR_NAME:database
The init-db.sh script:
- Reads this file
- Resolves
$KEYCLOAK_DB_PASSWORDfrom environment - Creates user and database if they don't exist
- Grants necessary privileges
Environment-Aware Activation:
The scripts/prepare-db-configs.sh script modifies init-users.conf based on ENVIRONMENT:
local-dev- Comments out Keycloak (uses shared-dev instance)shared-dev- Only Keycloak activestage/prod- All users active
This prevents resource waste and ensures proper service isolation.
Local Development:
-
Copy example files:
make init
-
Edit
.env.infra:POSTGRES_PASSWORD=local_dev_password REDIS_PASSWORD=local_dev_redis KEYCLOAK_DB_PASSWORD=local_kc_password
-
Edit
config/postgres/init-users.conf:user_service:USER_SERVICE_DB_PASSWORD:users -
Add to
.env.infra:USER_SERVICE_DB_PASSWORD=user_svc_password
Production Deployment:
GitHub Secrets โ generate-vault.py โ vault.yml โ Ansible โ .env.infra on server
See infrastructure/README.md for details.
Problem: Running all microservices locally consumes too much RAM.
Solution: microservices.local file for selective activation.
-
Copy example:
cp microservices.local.example microservices.local
-
Uncomment services you want to run:
user-service order-service -
Generate local compose file:
make init-local
This creates
compose/docker-compose.local.ymlthat builds images from source. -
Start only selected services:
make up
How it works:
makefiles/local-dev.mkreadsmicroservices.local- Uses
yqto filter services fromdocker-compose.yml - Generates
compose/docker-compose.local.ymlwithbuild:instead ofimage: makefiles/docker.mkincludes this file whenENVIRONMENT=local-dev
This allows developers to run only the services they're working on, while infrastructure (Postgres, Redis, etc.) always runs.
Essential commands:
# Start all services
make up
# Stop all services
make down
# View logs
make logs
# Build Maven projects
make build
# Health check
make check-servicesService-specific operations:
make up SERVICES=user-service
make restart SERVICES="order-service payment-service"
make logs SERVICES=payment-serviceFor complete command reference including database operations, SSL management, backups, and advanced options, see docs/MAKEFILE.md.
- Architecture Overview - System design, deployment model, variable flow
- Makefile Reference - Complete command guide
- Infrastructure Guide - Ansible deployment process
- ADRs - Architecture decision records
Backend:
- Java 21, Spring Boot 4.0.3, Spring Cloud 2025.1.1
- Maven (multi-module monorepo)
Infrastructure:
- PostgreSQL, MongoDB, Redis
- Redpanda (Kafka-compatible event streaming)
- Keycloak (Identity & Access Management)
- MinIO (S3-compatible storage, local-dev only)
- Nginx (Reverse proxy with SSL)
DevOps:
- Docker Compose
- Ansible (deployment automation)
- GitHub Actions (CI/CD)
- Prometheus + Grafana (monitoring, prod only)
Why Docker Compose over Kubernetes?
Docker Compose chosen to minimize operational overhead and focus on application architecture. Managing Kubernetes clusters (etcd, control plane, CNI, ingress controllers) would shift focus from building microservices to infrastructure administration. For this project scope, Docker Compose provides sufficient container management without the complexity of cluster orchestration. See ADR-003 for detailed rationale.
Local Development:
- Secrets in
.env.infra(gitignored) - Database credentials in
config/*/init-users.conf(gitignored)
Production:
- GitHub Secrets โ Ansible Vault โ
.envfiles - SSL certificates via Let's Encrypt (automatic renewal)
- SASL/SCRAM authentication for Redpanda
See infrastructure/README.md for details.
# Run all tests
make test
# Test specific service
./mvnw -pl services/user-service test
# Ansible role testing (Molecule)
make test-ansible- Create
services/your-service/with Spring Boot structure - Add module to root
pom.xml - Create
services/your-service/Dockerfile - Add service to
docker-compose.yml - Create
.env.your-service.example - CI/CD workflows auto-detect changes and build new service
See existing services in services/ directory for reference implementation examples.
Services won't start:
make check-services
make logs SERVICE=user-serviceDatabase connection issues:
make exec-postgresInside PostgreSQL shell, list databases with \l command.
Port conflicts:
make down
make clean
make upSee LICENSE file for details.
Need help? Check docs/ARCHITECTURE.md for system overview or docs/MAKEFILE.md for command reference.