In todayโs fast-paced digital restaurant ecosystem, scalability and modularity are non-negotiable. Thatโs why our team is engineering Bivy Restaurant Microservices โ a backend system powered by FastAPI (Python) and NestJS (TypeScript) to streamline restaurant operations.
As a core backend contributor, I took ownership of:
โ
Designing critical parts of the Entity-Relationship Diagram (ERD)
โ
Leading the User Service (authentication + RBAC)
โ
Architecting the Menu Service (dynamic categorization + inventory sync)
In this article, Iโll walk you through:
๐ My ERD design process
๐ The microservices I own
๐งญ Key technical decisions & whatโs coming next
- ๐งฉ Designing the Database: My ERD Contributions
A well-designed database is the heartbeat of any microservice architecture. Hereโs how I approached Bivyโs schema design.
๐ค A. User Service Schema
The Challenge:
We needed secure authentication + flexible role management for admins, staff, and customers.
My Solution:
Built a normalized schema with USER and USER_ROLE tables
Designed it to be JWT-ready and role-extensible
erDiagram
USER {
int id PK
string email
string password_hash
string name
int role_id FK
}
USER_ROLE {
int id PK
string name
}
USER ||--o{ USER_ROLE : "has"
Why It Works:
โ Passwords are stored using bcrypt hashing
โ Roles are decoupled, enabling easy future expansions (like moderators or vendors)
๐ฝ B. Menu Service Schema
The Challenge:
Restaurants need menus that evolve โ with categories, pricing, and availability โ all while syncing with inventory without tight coupling.
My Solution:
Designed MENU_ITEM and CATEGORY tables
Introduced available flag for toggling visibility without touching inventory directly
erDiagram
MENU_ITEM {
int id PK
string name
float price
int category_id FK
bool available
}
CATEGORY {
int id PK
string name
}
MENU_ITEM }|--|| CATEGORY : "belongs_to"
Benefits:
โ Fully decoupled from inventory DB
โ Filtering is index-optimized for better performance
๐ C. Cross-Service Collaboration
To maintain modularity, we ensured services communicate via event-driven architecture instead of direct DB joins.
Examples:
Orders reference both user_id and menu_item_id
Inventory syncs availability via Kafka events
- ๐ Microservices I Lead
๐ A. User Service โ FastAPI + JWT
Stack: Python, FastAPI, PostgreSQL, JWT
Core Features:
Secure Login/Registration
Role-Based Access Control (RBAC)
User profile endpoints
๐ B. Menu Service โ Dynamic & Real-Time
Stack: Python, FastAPI, Redis (caching), PostgreSQL
Core Features:
Dynamic menu categories
Real-time item availability toggling
AWS S3 image upload support
Workflow Example:
Admin adds a new item via /menu/items
Menu service emits Kafka event to inventory
If stock is available, item is flagged available=True and shown on the customer app
- ๐ Roadmap Ahead
๐งญ User Service
[ ] OAuth2.0 integration (Google, Facebook)
[ ] Passwordless login via magic links
๐งญ Menu Service
[ ] Redis caching for fast menu queries
[ ] Seasonal menu activation (based on time or promo windows)
๐งญ DevOps Goals
[ ] Kubernetes Helm Charts for scalable deployment
[ ] Prometheus + Grafana for monitoring
๐ง Final Thoughts
By prioritizing clean ERD design, modular services, and event-driven architecture, Bivy is built to scale. This system will power:
๐ก 10,000+ concurrent users
โ๏ธ Zero-downtime deployments
๐ Real-time menu updates across all customer touchpoints
What I Learned:
The power of database-first thinking
The value of loose coupling between services
The necessity of security-by-default principles
๐ฌ Letโs Talk!
Have you ever built or contributed to a restaurant backend system?
How did you handle user roles, menu changes, or inventory sync?
Letโs discuss in the comments โ Iโd love to learn from your experience too.
๐ก Connect with Bivy Tech
๐ฆ X (Twitter)
๐ฆ LinkedIn

Top comments (0)