How lucax011/localmenu_frontendb2b works
Project type and purpose
• This is a full-stack-ish client application: an Expo + TypeScript React Native/React Web frontend for B2B merchants.
• It provides login, dashboard, business profile management, CRUD for products, an OCR-assisted menu import flow, order management, and report generation.
File structure
• Top-level files: configuration for ESLint, Prettier, Husky, Docker, Jenkins, Expo, Babel, Jest, Cypress, TypeScript.
• src/api: Axios clients for two external services (backend and OCR).
• src/features: feature-based screens/modules (auth, business, dashboard, products, orders, ocr, reports).
• src/store: global state (Zustand for auth).
• src/utils: validation helpers (zod).
• Cypress & Jest directories for E2E and unit tests.
• Dockerfile/docker-compose: containerized web build. Jenkinsfile: CI pipeline.
README for additional insights
• Stack: Expo + TS with React Navigation, Zustand, React Query, Axios, RN Paper, react-hook-form + zod.
• Two external APIs:
• Backend (NestJS) handles auth, business, products, orders, reports
• OCR service (FastAPI) handles image/PDF extraction
• Local infra: Docker for web, Jenkins for CI
• Testing: Jest + Testing Library (unit), Cypress (E2E on Expo Web)
Main components
a. Frontend Client (Expo)
• Presentation layer: feature-based screens (LoginScreen, DashboardScreen, BusinessScreen, ProductsListScreen, ProductFormScreen, OCRImportScreen, OCRReviewScreen, OrdersScreen, ReportsScreen)
• State management: Zustand (authStore)
• Data fetching: React Query + Axios
• Forms & validation: react-hook-form + zod (validators.ts)
b. API Clients
• BackendClient (src/api/client.ts + src/api/ocr.ts)
• OCRClient
c. External Services
• NestJS Backend (POST /auth/login; CRUD /products; GET/PUT /businesses/me; GET/PUT orders; POST /reports/generate)
• FastAPI OCR (POST /ocr/extract)
d. Development/CI Infrastructure
• Docker & docker-compose (web)
• Jenkins pipeline (install, lint, test, build, docker)
• Expo CLI (mobile + web dev server)
Relationships & data flow
• User interacts with Feature Screens → invokes React Query hooks → Axios clients → External APIs
• OCR flow:
1. OCRImportScreen picks media → OCRClient.upload(file) → FastAPI returns extracted items
2. OCRReviewScreen displays items → edits validated by zod → on confirm triggers BackendClient.createProducts()
• Auth flow: LoginScreen → BackendClient.login() → authStore persists token → Axios interceptors attach token
• Business/products/orders/reports flows similarly use React Query → BackendClient calls
Architectural patterns & design principles
• Feature-based modularization (each screen/domain in its own folder)
• Unidirectional data flow (React Query + Zustand for global auth)
• Separation of concerns: presentation (UI screens), data (API clients), state (store), validation (utils)
• CI/CD via Jenkins, containerization via Docker