Inspiration
Coffee shops are the heartbeat of campus and community life. Yet, during peak hours, long lines accumulate, customers get frustrated, and baristas are overwhelmed. Looking closely at the workflow behind the counter, we identified a major bottleneck: baristas spend a significant amount of time executing repetitive, disjointed tasks—constantly moving back and forth to extract individual shots and steam milk for single cups.
We thought: What if we could apply the optimization principles of batch scheduling (similar to CPU instruction pipelining) to the café bar? This inspired us to build BaristaBrain—an intelligent workflow coordinator that transforms chaotic rushes into coordinated, optimized prep sequences.
What it does
BaristaBrain is a real-time workflow optimizer that acts as the scheduling core of a coffee shop. Instead of displaying orders in a traditional First-In-First-Out queue, it processes incoming tickets using a domain-driven batching algorithm to group preparation tasks:
- Espresso Extractions: Merges matching coffee bases (e.g., "Extract 4x Double Espresso"), allowing baristas to pull multiple shots simultaneously.
- Milk Steaming: Groups identical milk types and temperatures, calculating the total volume required to steam a single, unified pitcher (e.g., "Steam Oat Milk (3 cups)"). It features a strict visual color-coding system to prevent allergen cross-contamination (Oat: Blue, Whole: Green, Almond: Orange, Soy: Purple).
- Assembly & Finitions: Re-associates the ready bases and textured milks back into individual customer cups. To help the barista map tasks to physical cups, each item displays a short unique Ticket ID (e.g.,
#04) and the client's name in bold. - Analytics Board: Provides managers with real-time statistics on wait-time reduction, drinks completed, and estimation of milk waste saved.
How we built it
We built BaristaBrain with a focus on code quality, following Domain-Driven Design and Clean Architecture principles:
- Backend: Implemented with Python (FastAPI). The core batching algorithm resides strictly within the Domain Layer, completely decoupled from routers and storage. We used WebSockets to broadcast state updates in real-time.
- Frontend: Developed with React, TypeScript, and Tailwind CSS. We built a custom WebSocket client hook equipped with an auto-reconnecting backoff loop to survive network interruptions or local server restarts seamlessly. Data charts are rendered dynamically using Recharts.
- DevOps: Dockerized the entire stack using a multi-stage build setup coordinated by Docker Compose, making it deployable with a single command.
Challenges we ran into
- Pipeline Cohesion: Mapping grouped preparation tasks (extracting multiple shots or steaming milk in bulk) back to individual customer cups was complex. We solved this by modeling each drink using a sub-task state machine (
base_status,milk_status, andpreparation_status), controlled strictly by the domain layer. - Docker Hot Reloading & Network Bindings: Configuring Vite to bind to
0.0.0.0to permit access from the container host while handling the WebSocket proxy configuration required fine-tuning our server settings. - Type Safety under VerbatimModuleSyntax: Meeting strict TypeScript 5+ compilation requirements for module exports and type-only imports alongside external libraries like Lucide and Recharts.
Accomplishments that we're proud of
- Architecture Integrity: Adhering strictly to Clean Architecture and DDD boundaries. We proved that we could write modular, testable, and highly decoupled code even under hackathon time limits.
- Self-Healing WebSockets: The auto-reconnection logic works flawlessly, shielding the client from server restarts and backend changes during live demonstrations.
What we learned
- The operational friction and safety risks that baristas encounter during rush hours.
- How to write clean, maintainable software at speed by setting clear domain boundaries.
- The flexibility of WebSockets in building lightweight, low-overhead reactive user interfaces.
What's next for baristabrain
- Predictive ML Modeling: Integrating machine learning to anticipate rush periods based on campus class schedules, exam weeks, and weather patterns.
- IoT Smart Pitchers & Scales: Connecting directly to Bluetooth-enabled milk pitchers and scales to sync extraction volumes and milk temperatures automatically.
- Distributed Station Routing: Distributing batch tasks dynamically across multiple espresso machines and steaming stations for large-scale operations.
Built With
- docker
- fastapi
- python
- react
- tailwind
- typescript
- websocket
Log in or sign up for Devpost to join the conversation.