How mek3911/sofra works
1. Overall shape
This is a client-side React single-page app built with TypeScript + Vite. There is no custom backend service in the repo; the browser app talks directly to Firebase for persistence, auth, and file storage.
2. App entry and shell
src/main.tsx bootstraps the app into index.html, and src/App.tsx is the top-level composition/routing layer. src/index.css and vite.config.ts indicate a standard Vite front-end build pipeline.
3. Primary user flows
The UI is split into role-specific experiences:
- Customer: Landing, Auth, CustomerFeed, Cart, CustomerOrders, Profile
- Chef: ChefDashboard, ChefList, ChefDishes, ChefOrders, ChefProfile
- Admin: AdminPanel, AdminChefs, AdminDishes, AdminOrders, AdminSettings
This suggests a marketplace/ordering domain with multiple personas operating on shared food/order data.
4. Shared application state
src/context/CartContext.tsx is the main shared client-side state boundary. It likely holds cart contents and related actions used by customer-facing components such as Cart and item browsing views.
5. Firebase integration boundary
src/firebase.ts is the central integration point for the backend services. Based on the file set, the app likely uses:
- Firebase Auth for login/session handling
- Firestore for dishes, chefs, orders, profiles, and settings
- Firebase Storage for images/uploads
The repo includes firestore.rules and storage.rules, so data access is controlled at the Firebase layer rather than through a server API.
6. Role and data governance
The presence of separate admin and chef components, plus Firebase rules, implies access control is an important architectural boundary. Role-based UI is implemented in the client, while actual enforcement is delegated to Firestore/Storage security rules.
7. Content and media handling
src/utils/imageOptimizer.ts indicates image upload or optimization is part of the data flow, probably for dish or profile images. The testUpload.ts and testUpload2.ts files reinforce that storage/media upload is a first-class path in the app.
8. Seed and maintenance tooling
src/utils/seedData.ts and scripts/updateCategories.ts are repo-level data utilities. These are not runtime UI pieces; they support bootstrapping or maintaining catalog data, which helps explain how Firestore collections are populated and kept consistent.
9. Deployment/runtime footprint
vercel.json suggests the built SPA is deployed as a static front-end, likely on Vercel. package.json, package-lock.json, and tsconfig.json define the Node/TypeScript build environment. metadata.json, firebase-applet-config.json, and firebase-blueprint.json indicate this repo was generated or managed through AI Studio/Firebase tooling.
10. Resilience and UX boundaries
src/components/ErrorBoundary.tsx provides a UI-level fault isolation layer so rendering/runtime errors don’t take down the whole experience. src/components/Navigation.tsx is the shared shell for moving across the different persona views.
11. External-service note
The README asks for a GEMINI_API_KEY, which suggests the app may have been created in AI Studio and may integrate with Gemini-assisted features or generation context, but there is no obvious dedicated Gemini service layer in the file tree. The dominant runtime architecture is still the React app + Firebase backend.
12. Diagram-friendly summary
For an architecture diagram, model this as:
- Browser SPA with shared cart state and role-based UI
- Firebase Auth / Firestore / Storage as the backend data plane
- Security rules as the enforcement boundary
- Vite/Vercel as build and deployment infrastructure
- Scripts/utils as offline maintenance and data-seeding support
Main entry points: App.tsx App shell · firebase.ts Firebase · CustomerFeed.tsx Customer flow · main.tsx main
Components 18
Browser app
Client-side React SPA and shared UI state.
- main · Bootstraps the React app into the page.
src/main.tsx - App shell · Top-level app composition and route selection.
src/App.tsx - Navigation · Shared in-app navigation across personas.
src/components/Navigation.tsx - Error boundary · Catches rendering errors in the UI tree.
src/components/ErrorBoundary.tsx - Cart context · Client-side cart state and actions.
src/context/CartContext.tsx - Landing · Public entry page for the app.
src/components/Landing.tsx - Auth · Login and session entry for customers.
src/components/Auth.tsx - Customer flow · Feed, cart, orders, and profile views for customers.
src/components/CustomerFeed.tsx - Chef flow · Dashboard and operational views for chefs.
src/components/ChefDashboard.tsx - Admin flow · Administrative management views for the marketplace.
src/components/AdminPanel.tsx
Firebase backend
Auth, database, storage, and security rules.
- Firebase · Central client integration for backend services.
src/firebase.ts - Firestore rules · Access control for database operations.
firestore.rules - Storage rules · Access control for file upload and download.
storage.rules
Build & ops
Vite build, deployment, and repo tooling.
- Seed data · Catalog bootstrap and data shaping utilities.
src/utils/seedData.ts - Image optimizer · Image processing for uploads and display.
src/utils/imageOptimizer.ts - Update categories · Offline script for category maintenance.
scripts/updateCategories.ts - Vite build · TypeScript/Vite build configuration.
vite.config.ts - Vercel deploy · Static hosting and deployment configuration.
vercel.json
Connections 19
- main → App shell: mounts · Bootstraps the top-level app.
- App shell → Navigation: uses · Renders shared navigation.
- App shell → Error boundary: wraps · Isolated UI error handling.
- App shell → Landing: routes · Public entry experience.
- App shell → Auth: routes · Authentication flow.
- App shell → Customer flow: routes · Customer-facing experience.
- App shell → Chef flow: routes · Chef-facing experience.
- App shell → Admin flow: routes · Admin-facing experience.
- Customer flow → Cart context: shares · Uses shared cart state.
- Customer flow → Firebase: reads/writes · Consumes backend data.
- Chef flow → Firebase: reads/writes · Operates on shared marketplace data.
- Admin flow → Firebase: reads/writes · Manages marketplace data and settings.
- Firebase → Firestore rules: governed by · Database access is enforced by rules.
- Firebase → Storage rules: governed by · Storage access is enforced by rules.
- Seed data → Firebase: seeds · Initializes or populates backend data.
- Update categories → Firebase: maintains · Updates catalog data offline.
- Image optimizer → Firebase: supports · Prepares media for storage workflows.
- Vite build → main: builds · Compiles the SPA entry and assets.
- Vercel deploy → Vite build: hosts · Deploys the built frontend as static output.