Getting Started¶
๐ Quick Start Guide¶
This guide will help you set up the Orbital Manager Backend development environment.
Prerequisites¶
- Python: 3.9 or higher
- MongoDB: 4.0+ (for order storage)
- PostgreSQL: 12+ (for batch items)
- Bazel: 6.0+ (for building)
- Git: For version control
๐ฅ Installation¶
1. Clone the Repository¶
2. Install Python Dependencies¶
3. Set Up Environment Variables¶
Create .env files for each service:
Order Management Service (.env in root or service folder):
# MongoDB
MONGO_URI=mongodb://localhost:27017
MONGO_DB=orbital_kitchen
MONGO_ORDERS_COLLECTION=orders
# gRPC
GRPC_TARGET=localhost:50051
Kitchen Batch Tool Service:
# PostgreSQL
POSTGRES_SUPABASE_URL=postgresql://user:pass@localhost:5432/orbital_kitchen
# gRPC
GRPC_PORT=50051
4. Set Up Databases¶
MongoDB:
# Start MongoDB
mongod --dbpath /path/to/data
# Create database (optional - auto-created on first insert)
mongosh
> use orbital_kitchen
> db.orders.insertOne({test: "order"})
PostgreSQL:
๐ Running Services¶
Option 1: Using uvicorn (Development)¶
Terminal 1 - Order Management Service:
Terminal 2 - Kitchen Batch Tool Service:
Option 2: Using Bazel¶
# Build all services
bazel build //...
# Run Order Management Service
bazel run //order_management_service:order_management_service
# Run Kitchen Batch Tool Service
bazel run //kitchen_batch_tool_service:kitchen_batch_tool_service
โ Verify Setup¶
Health Checks¶
# Check Order Management Service
curl http://localhost:8000/ping
# Check Kitchen Batch Tool Service
curl http://localhost:8001/ping
Test Order Flow¶
Insert a test order into MongoDB:
db.orders.insertOne({
OtterOrderId: "test-order-001",
BrandName: "Test Restaurant",
StationOrders: [
{
OwnStationName: "Test Station",
OrderItems: [
{ Name: "Test Burger", Quantity: 2 },
{ Name: "Test Fries", Quantity: 1 }
]
}
]
})
Expected Output:
- Order Management Service logs: "Order sent successfully"
- Kitchen Batch Tool Service console displays formatted order
- SSE stream (if connected) receives event
Test SSE Stream¶
๐งช Running Tests¶
# Run all tests
bazel test //...
# Run specific service tests
pytest order_management_service/tests/
pytest kitchen_batch_tool_service/tests/
# Run with coverage
pytest --cov=app tests/
๐ง Development Tools¶
Linting¶
Type Checking¶
๐ Troubleshooting¶
MongoDB Connection Issues¶
Problem: MongoDBconnection not available, retrying...
Solution:
- Verify MongoDB is running: mongosh
- Check MONGO_URI in .env
- Check firewall settings
gRPC Connection Issues¶
Problem: gRPC client not connected
Solution:
- Ensure Kitchen Batch Tool Service is running
- Check GRPC_TARGET points to correct host:port
- Verify GRPC_PORT matches on server side
Port Already in Use¶
Problem: Address already in use
Solution:
๐ Next Steps¶
๐ก Tips¶
- Use
--reloadflag during development for auto-restart - Check logs for detailed error messages
- Monitor both service consoles when testing order flow
- Use structured logging fields for better debugging