# abhishek-ks-dev/famcare architecture

> Architecture diagram of the GitHub repository abhishek-ks-dev/famcare, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abhishek-ks-dev/famcare
- Repository: https://github.com/abhishek-ks-dev/famcare

## Overview

FamCare is a household food-safety and grocery-management app. The main workflow is to sign in, manage family profiles, enter or scan a food product, review ingredient and nutrition findings against a selected member’s profile, and consider alternatives; purchase history and budgets support ongoing grocery management. The excerpts show key API and analysis calls, but not the full app composition or several UI workflows, so those links are left unverified rather than inferred.

Main entry points: [`server/routes/api.ts`](https://github.com/abhishek-ks-dev/famcare/blob/main/server/routes/api.ts) (API routes), [`src/App.tsx`](https://github.com/abhishek-ks-dev/famcare/blob/main/src/App.tsx) (App shell), [`src/services/api.ts`](https://github.com/abhishek-ks-dev/famcare/blob/main/src/services/api.ts) (API client), [`server/services/foodIntelligenceAgent.ts`](https://github.com/abhishek-ks-dev/famcare/blob/main/server/services/foodIntelligenceAgent.ts) (Food analysis agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web app"]
  node_app["App shell<br/>[App.tsx]"]
  node_authscreen["Sign-in screen<br/>[AuthScreen.tsx]"]
  node_foodanalysis["Food analysis"]
  node_manualentry["Manual entry"]
  node_familyui["Family profiles"]
  node_otherui["Grocery tools"]
  node_ocrparser["Label text parser<br/>[ocrParser.ts]"]
  node_clientapi["API client<br/>[api.ts]"]
end

subgraph group_api["API and identity"]
  node_router["API routes<br/>[api.ts]"]
  node_auth["JWT authentication<br/>[auth.ts]"]
  node_server["Express server<br/>[server.ts]"]
end

subgraph group_analysis["Food intelligence"]
  node_agent["Food analysis agent"]
  node_rules["Safety rules"]
  node_off["Open Food Facts<br/>[openFoodFacts.ts]"]
  node_ifct["Nutrition datasets<br/>[ifct.ts]"]
end

subgraph group_household["Household records"]
  node_store[("Record storage<br/>[store.ts]")]
  node_schemas["Record schemas<br/>[schemas.ts]"]
end

node_user(("Household user"))
node_externaloff["Open Food Facts service"]
node_gemini["Gemini service"]

node_user -.->|"uses"| node_app
node_app -.->|"presents"| node_authscreen
node_app -.->|"presents"| node_foodanalysis
node_app -.->|"presents"| node_manualentry
node_app -.->|"presents"| node_familyui
node_app -.->|"presents"| node_otherui
node_authscreen -->|"requests auth"| node_clientapi
node_foodanalysis -->|"requests analysis"| node_clientapi
node_manualentry -->|"submits entries"| node_clientapi
node_familyui -->|"manages profiles"| node_clientapi
node_otherui -.->|"uses API"| node_clientapi
node_clientapi -->|"HTTP requests"| node_router
node_server -->|"mounts routes"| node_router
node_router -->|"guards requests"| node_auth
node_router -->|"reads and writes"| node_store
node_store -->|"uses models"| node_schemas
node_router -->|"runs analysis"| node_agent
node_router -->|"looks up products"| node_off
node_router -->|"ranks alternatives"| node_rules
node_agent -->|"checks compatibility"| node_rules
node_agent -->|"searches products"| node_off
node_agent -->|"searches nutrition"| node_ifct
node_off -.->|"queries service"| node_externaloff
node_agent -.->|"may request analysis"| node_gemini

click node_app "https://github.com/abhishek-ks-dev/famcare/blob/main/src/App.tsx"
click node_authscreen "https://github.com/abhishek-ks-dev/famcare/blob/main/src/components/AuthScreen.tsx"
click node_foodanalysis "https://github.com/abhishek-ks-dev/famcare/blob/main/src/components/FoodAnalysisSection.tsx"
click node_manualentry "https://github.com/abhishek-ks-dev/famcare/blob/main/src/components/ManualEntrySection.tsx"
click node_familyui "https://github.com/abhishek-ks-dev/famcare/blob/main/src/components/FamilyProfilesSection.tsx"
click node_otherui "https://github.com/abhishek-ks-dev/famcare/tree/main/src/components"
click node_ocrparser "https://github.com/abhishek-ks-dev/famcare/blob/main/src/utils/ocrParser.ts"
click node_clientapi "https://github.com/abhishek-ks-dev/famcare/blob/main/src/services/api.ts"
click node_router "https://github.com/abhishek-ks-dev/famcare/blob/main/server/routes/api.ts"
click node_auth "https://github.com/abhishek-ks-dev/famcare/blob/main/server/middleware/auth.ts"
click node_agent "https://github.com/abhishek-ks-dev/famcare/blob/main/server/services/foodIntelligenceAgent.ts"
click node_rules "https://github.com/abhishek-ks-dev/famcare/blob/main/server/services/deterministicRules.ts"
click node_off "https://github.com/abhishek-ks-dev/famcare/blob/main/server/services/openFoodFacts.ts"
click node_ifct "https://github.com/abhishek-ks-dev/famcare/blob/main/server/services/ifct.ts"
click node_store "https://github.com/abhishek-ks-dev/famcare/blob/main/server/db/store.ts"
click node_schemas "https://github.com/abhishek-ks-dev/famcare/blob/main/server/models/schemas.ts"
click node_server "https://github.com/abhishek-ks-dev/famcare/blob/main/server.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_authscreen,node_foodanalysis,node_manualentry,node_familyui,node_otherui,node_ocrparser,node_clientapi,node_user toneBlue
class node_router,node_auth,node_server toneAmber
class node_agent,node_rules,node_off,node_ifct toneMint
class node_store,node_schemas toneRose
class node_externaloff,node_gemini toneIndigo
```

## Components

### Web app

- [App shell](https://github.com/abhishek-ks-dev/famcare/blob/main/src/App.tsx): `src/App.tsx`
- [Sign-in screen](https://github.com/abhishek-ks-dev/famcare/blob/main/src/components/AuthScreen.tsx): `src/components/AuthScreen.tsx`
- [Food analysis](https://github.com/abhishek-ks-dev/famcare/blob/main/src/components/FoodAnalysisSection.tsx): `src/components/FoodAnalysisSection.tsx`
- [Manual entry](https://github.com/abhishek-ks-dev/famcare/blob/main/src/components/ManualEntrySection.tsx): `src/components/ManualEntrySection.tsx`
- [Family profiles](https://github.com/abhishek-ks-dev/famcare/blob/main/src/components/FamilyProfilesSection.tsx): `src/components/FamilyProfilesSection.tsx`
- [Grocery tools](https://github.com/abhishek-ks-dev/famcare/tree/main/src/components): `src/components`
- [Label text parser](https://github.com/abhishek-ks-dev/famcare/blob/main/src/utils/ocrParser.ts): `src/utils/ocrParser.ts`
- [API client](https://github.com/abhishek-ks-dev/famcare/blob/main/src/services/api.ts): `src/services/api.ts`

### API and identity

- [API routes](https://github.com/abhishek-ks-dev/famcare/blob/main/server/routes/api.ts): `server/routes/api.ts`
- [JWT authentication](https://github.com/abhishek-ks-dev/famcare/blob/main/server/middleware/auth.ts): `server/middleware/auth.ts`
- [Express server](https://github.com/abhishek-ks-dev/famcare/blob/main/server.ts): `server.ts`

### Food intelligence

- [Food analysis agent](https://github.com/abhishek-ks-dev/famcare/blob/main/server/services/foodIntelligenceAgent.ts): `server/services/foodIntelligenceAgent.ts`
- [Safety rules](https://github.com/abhishek-ks-dev/famcare/blob/main/server/services/deterministicRules.ts): `server/services/deterministicRules.ts`
- [Open Food Facts](https://github.com/abhishek-ks-dev/famcare/blob/main/server/services/openFoodFacts.ts): `server/services/openFoodFacts.ts`
- [Nutrition datasets](https://github.com/abhishek-ks-dev/famcare/blob/main/server/services/ifct.ts): `server/services/ifct.ts`

### Household records

- [Record storage](https://github.com/abhishek-ks-dev/famcare/blob/main/server/db/store.ts): `server/db/store.ts`
- [Record schemas](https://github.com/abhishek-ks-dev/famcare/blob/main/server/models/schemas.ts): `server/models/schemas.ts`

### Other components

- **Household user**
- **Open Food Facts service**
- **Gemini service**

## Connections

- Household user → App shell: uses
- App shell → Sign-in screen: presents
- App shell → Food analysis: presents
- App shell → Manual entry: presents
- App shell → Family profiles: presents
- App shell → Grocery tools: presents
- Sign-in screen → API client: requests auth (evidence: `src/components/AuthScreen.tsx`)
- Food analysis → API client: requests analysis (evidence: `src/components/FoodAnalysisSection.tsx`)
- Manual entry → API client: submits entries (evidence: `src/components/ManualEntrySection.tsx`)
- Family profiles → API client: manages profiles (evidence: `src/components/FamilyProfilesSection.tsx`)
- Grocery tools → API client: uses API (evidence: `src/components/AuthScreen.tsx`)
- API client → API routes: HTTP requests (evidence: `src/services/api.ts`)
- Express server → API routes: mounts routes (evidence: `server.ts`)
- API routes → JWT authentication: guards requests (evidence: `server/routes/api.ts`)
- API routes → Record storage: reads and writes (evidence: `server/routes/api.ts`)
- Record storage → Record schemas: uses models (evidence: `server/db/store.ts`)
- API routes → Food analysis agent: runs analysis (evidence: `server/routes/api.ts`)
- API routes → Open Food Facts: looks up products (evidence: `server/routes/api.ts`)
- API routes → Safety rules: ranks alternatives (evidence: `server/routes/api.ts`)
- Food analysis agent → Safety rules: checks compatibility (evidence: `server/services/foodIntelligenceAgent.ts`)
- Food analysis agent → Open Food Facts: searches products (evidence: `server/services/foodIntelligenceAgent.ts`)
- Food analysis agent → Nutrition datasets: searches nutrition (evidence: `server/services/foodIntelligenceAgent.ts`)
- Open Food Facts → Open Food Facts service: queries service
- Food analysis agent → Gemini service: may request analysis
