Smart Inventory. Generative Recipes. Social Cooking.
MOCC is a cloud-native application designed to revolutionize kitchen management. By leveraging Artificial Intelligence, Computer Vision, and Real-Time Connectivity, MOCC allows users to manage their inventory, minimize food waste, and discover personalized recipes.
MOCC is built on a modern, polyglot architecture:
- Framework: Flutter (Mobile & Web Support).
- State Management:
flutter_riverpodfor reactive and testable state. - Navigation:
go_routerfor declarative routing and deep linking. - API Client:
graphql_flutterwith robust caching and offline support. - Auth:
msal_auth/msal_jsfor Microsoft Entra ID integration. - Localization:
easy_localizationfor multi-language support.
- Runtime: Go 1.22+ containerized with Docker.
- API: GraphQL server using
99designs/gqlgen. - Hosting: Azure Container Apps (ACA) with KEDA auto-scaling (Scale-to-Zero).
- Security: Keyless access to Azure resources via Managed Identities.
- Runtime: Python 3.12 on Azure Functions (Flex Consumption).
- AI & ML:
- Azure AI Document Intelligence for converting receipts to structured data.
- Azure OpenAI (GPT-4o) for generative recipe creation.
- Azure Content Safety for moderating social posts.
- Triggers: Event Grid blobs, Timers, and Storage Queues.
- IaC: Entirely managed via Bicep templates.
- Gateway: Azure API Management (Consumption) as the single entry point.
- Database: Azure Cosmos DB (NoSQL) with auto-scaling (400 RU/s cap).
- Caching: Azure Redis Cache for session and data caching.
- Real-Time: Azure SignalR Service and Notification Hubs (Firebase FCM).
A quick overview of the repository organization:
MOCC/
βββ app/ # Frontend (Flutter)
β βββ lib/ # Dart source code
β βββ web/ # Web configuration
βββ backend/ # Backend (Go + GraphQL)
β βββ graph/ # GraphQL schema & resolvers
β βββ internal/ # Business logic
β βββ server.go # API Entrypoint
βββ functions/ # Azure Functions (Python)
β βββ services/ # AI & Event logic
β βββ function_app.py # Triggers definition
βββ infrastructure/ # Infrastructure as Code (Bicep)
β βββ modules/ # Resources definitions
β βββ scripts/ # Deployment scripts
βββ documentation/ # Diagrams and assets
A high-level structural overview of the cloud-native solution, illustrating the interaction between the Flutter Frontend, the API Gateway, and the underlying microservices hosted on Azure Container Apps and Functions.
Visualizes the event-driven architecture where Azure Functions orchestrate complex tasks like receipt OCR processing (Document Intelligence), recipe generation (OpenAI GPT-4), and content moderation, triggered by Event Grid events from Blob Storage.
MOCC uses a Zero-Trust approach. Services communicate via Managed Identities and RBAC assignments (e.g., Storage Blob Data Contributor) without hardcoded secrets.
- Azure CLI: Logged in to your target subscription.
- GitHub Account: For CI/CD workflows.
- Firebase Project: An active Firebase project with
google-services.jsongenerated. - Tools: Docker, Go, Flutter, Node.js installed locally for development.
Deploy the entire stack (Infrastructure, Functions, Policies, Frontend) using the master script.
Windows (Batch):
.\infrastructure\scripts\DeployAll.batNote: For infrastructure-only updates, use
DeployMain.bat.
The CI/CD pipelines depend on strict configuration. Add the following Repository Secrets to your GitHub repo:
| Category | Secret Name | Description |
|---|---|---|
| Identity | AZURE_CREDENTIALS |
JSON output from az ad sp create-for-rbac ... |
AUTH_CLIENT_ID |
The Client ID of your App Registration (Frontend) | |
AUTH_AUTHORITY |
The Authority URL (e.g., https://login.microsoftonline.com/...) |
|
AUTH_API_SCOPES |
The Scopes for Frontend (e.g., api://<backend-id>/access_as_user) |
|
EXPECTED_AUDIENCE |
The Audience for Backend validation (same as Client ID usually) | |
MANAGED_IDENTITY_CLIENT_ID |
The Client ID of the User Assigned Managed Identity (for Backend) | |
| Connecting | MOCC_API_URL |
The public URL of your Backend (Container App) |
AZURE_STATIC_WEB_APPS_API_TOKEN |
Deployment token for SWA (found in Portal overview) | |
COSMOS_URL |
The connection string or endpoint for Cosmos DB | |
REDIS_URL |
The connection string for Azure Redis Cache | |
AZURE_STORAGE_ACCOUNT_NAME |
The name of the main Storage Account | |
EVENTGRID_TOPIC_ENDPOINT |
The Endpoint URL for the Event Grid Topic | |
| Functions | AzureWebJobsStorage__accountName |
Storage Account Name for Functions runtime |
AzureWebJobsStorage__credential |
Storage Account Key/Credential for Functions | |
AZURE_OPENAI_ENDPOINT |
Endpoint for Azure OpenAI Service | |
DOCUMENT_INTELLIGENCE_ENDPOINT |
Endpoint for Document Intelligence Service | |
KEY_VAULT_URL |
URL of the Key Vault (if used) | |
| Base64 Configs | FIREBASE_OPTIONS_BASE64 |
Base64 encoded firebase_options.dart |
FIREBASE_MESSAGING_SW_BASE64 |
Base64 encoded firebase-messaging-sw.js |
|
MSAL_CONFIG_BASE64 |
Base64 encoded msal_config.json |
Since the Azure Static Web App (SWA) URL is generated dynamically upon creation, you must whitelist it in your Entra ID App Registration to allow authentication redirects.
- Go to the Azure Portal > Static Web Apps.
- Copy the URL of the deployed
mocc-swa(e.g.,https://purple-moss-012345.azurestaticapps.net). - Go to Entra ID > App Registrations > Your Client App > Authentication.
- Under Single-page application, Add the following Redirect URIs:
https://<your-swa-url>https://<your-swa-url>/auth.html(Required for popup auth flows)
Note: Without this step, users will encounter AADSTS50011 errors during login on the Web version.
Ensure the following tools are installed:
- Docker: For running containerized dependencies (Redis).
- Go 1.22+: For the backend API.
- Flutter: For the frontend application.
- Python 3.12+: For Azure Functions.
- Azure CLI (
az): Managed identity and login. - Azure Functions Core Tools (
func): For running functions locally. - Azurite: For emulating Azure Storage.
MOCC requires storage and caching emulators for local runs.
Azure Storage (Azurite)
# Install via NPM if needed: npm install -g azurite
azurite --silent --location .azurite --debug .azurite/debug.logRedis Cache
docker run --name redis -p 6379:6379 -d redisGo API Server (Port 8080)
cd backend
go mod tidy
go run server.goAzure Functions (Port 7071)
cd functions
# Create a python virtual environment if first time
# python -m venv .venv
# .venv\Scripts\activate
# pip install -r requirements.txt
func startcd app
flutter pub get
flutter run -d chromeYou can trigger local Azure Functions (e.g., Recipe Generation) by simulating Event Grid webhooks without deploying to Azure.
- Ensure your Function App is running locally on port 7071.
- Edit
functions/simulate_event.ps1to set your targetuserIdandfilename. - Run the simulation script:
./functions/simulate_event.ps1This sends a mock Microsoft.Storage.BlobCreated event to http://localhost:7071/runtime/webhooks/EventGrid, triggering the function logic.
Developed with β€οΈ for MOCC.



