# suhaibmalam/nutrimap architecture

> Architecture diagram of the GitHub repository suhaibmalam/nutrimap, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/suhaibmalam/nutrimap
- Repository: https://github.com/suhaibmalam/nutrimap

## Overview

NutriMap is a country-aware nutrition and food-planning app. Its documented onboarding starts with creating an account and setting a profile and country; the landing page describes localized food prices and affordable food suggestions for nutrient shortfalls. The tree also identifies dashboard, food, and meal screens, though their behavior is not shown in the sampled source. Profile API calls are session-checked, validated on update, and delegated through a service to persistence. Edges for unsampled screens and integrations are omitted rather than inferred.

Main entry points: [`src/lib/auth.ts`](https://github.com/suhaibmalam/nutrimap/blob/main/src/lib/auth.ts) (Auth service), [`src/app/api/profile/route.ts`](https://github.com/suhaibmalam/nutrimap/blob/main/src/app/api/profile/route.ts) (Profile endpoint), [`src/app/page.tsx`](https://github.com/suhaibmalam/nutrimap/blob/main/src/app/page.tsx) (Landing page), [`src/services/user-profile.service.ts`](https://github.com/suhaibmalam/nutrimap/blob/main/src/services/user-profile.service.ts) (Profile service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_landing["Landing page<br/>[page.tsx]"]
  node_app_shell["App shell<br/>[layout.tsx]"]
end

subgraph group_identity["Accounts"]
  node_register["Registration<br/>[page.tsx]"]
  node_login["Sign in<br/>[page.tsx]"]
  node_auth_ui["Auth forms<br/>[register-form.tsx]"]
  node_auth_route["Auth endpoint<br/>[route.ts]"]
  node_auth_service["Auth service<br/>[auth.ts]"]
end

subgraph group_profile["Profile and locale"]
  node_profile_page["Profile settings<br/>[page.tsx]"]
  node_profile_form["Profile form"]
  node_countries_page["Country browser<br/>[page.tsx]"]
  node_countries_ui["Country list<br/>[country-list.tsx]"]
  node_countries_api["Countries endpoint<br/>[route.ts]"]
  node_country_service["Country service<br/>[country.service.ts]"]
  node_profile_api["Profile endpoint<br/>[route.ts]"]
  node_profile_schema["Profile validation"]
  node_profile_service["Profile service"]
  node_profile_repository["Profile repository"]
  node_prisma[("Database client<br/>[prisma.ts]")]
end

subgraph group_nutrition["Nutrition experience"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_foods["Food catalog<br/>[page.tsx]"]
  node_meals["Meal tracking<br/>[page.tsx]"]
end

node_user(("Visitor / user"))

node_user -->|"visits"| node_landing
node_landing -->|"checks session"| node_auth_service
node_user -->|"registers"| node_register
node_user -->|"signs in"| node_login
node_auth_route -->|"dispatches"| node_auth_service
node_auth_service -->|"uses adapter"| node_prisma
node_user -->|"opens app"| node_app_shell
node_user -->|"configures profile"| node_profile_page
node_profile_api -->|"checks session"| node_auth_service
node_profile_api -->|"validates update"| node_profile_schema
node_profile_api -->|"gets or updates"| node_profile_service
node_profile_service -->|"reads or upserts"| node_profile_repository
node_profile_repository -->|"queries"| node_prisma
node_countries_api -->|"lists countries"| node_country_service
node_user -->|"views"| node_dashboard
node_user -->|"browses"| node_foods
node_user -->|"tracks meals"| node_meals

click node_landing "https://github.com/suhaibmalam/nutrimap/blob/main/src/app/page.tsx"
click node_app_shell "https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(app)/layout.tsx"
click node_dashboard "https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(app)/dashboard/page.tsx"
click node_foods "https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(app)/foods/page.tsx"
click node_meals "https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(app)/meals/page.tsx"
click node_register "https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(auth)/register/page.tsx"
click node_login "https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(auth)/login/page.tsx"
click node_auth_ui "https://github.com/suhaibmalam/nutrimap/blob/main/src/features/authentication/components/register-form.tsx"
click node_auth_route "https://github.com/suhaibmalam/nutrimap/blob/main/src/app/api/auth/%5B...all%5D/route.ts"
click node_auth_service "https://github.com/suhaibmalam/nutrimap/blob/main/src/lib/auth.ts"
click node_profile_page "https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(app)/settings/profile/page.tsx"
click node_profile_form "https://github.com/suhaibmalam/nutrimap/blob/main/src/features/settings/components/profile-settings-form.tsx"
click node_countries_page "https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(app)/countries/page.tsx"
click node_countries_ui "https://github.com/suhaibmalam/nutrimap/blob/main/src/features/countries/components/country-list.tsx"
click node_countries_api "https://github.com/suhaibmalam/nutrimap/blob/main/src/app/api/countries/route.ts"
click node_country_service "https://github.com/suhaibmalam/nutrimap/blob/main/src/services/country.service.ts"
click node_profile_api "https://github.com/suhaibmalam/nutrimap/blob/main/src/app/api/profile/route.ts"
click node_profile_schema "https://github.com/suhaibmalam/nutrimap/blob/main/src/schemas/user-profile.schema.ts"
click node_profile_service "https://github.com/suhaibmalam/nutrimap/blob/main/src/services/user-profile.service.ts"
click node_profile_repository "https://github.com/suhaibmalam/nutrimap/blob/main/src/repositories/user-profile.repository.ts"
click node_prisma "https://github.com/suhaibmalam/nutrimap/blob/main/src/lib/prisma.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_landing,node_app_shell,node_user toneBlue
class node_register,node_login,node_auth_ui,node_auth_route,node_auth_service toneAmber
class node_profile_page,node_profile_form,node_countries_page,node_countries_ui,node_countries_api,node_country_service,node_profile_api,node_profile_schema,node_profile_service,node_profile_repository,node_prisma toneMint
class node_dashboard,node_foods,node_meals toneRose
```

## Components

### App experience

- [Landing page](https://github.com/suhaibmalam/nutrimap/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [App shell](https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(app)/layout.tsx): `src/app/(app)/layout.tsx`

### Accounts

- [Registration](https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(auth)/register/page.tsx): `src/app/(auth)/register/page.tsx`
- [Sign in](https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(auth)/login/page.tsx): `src/app/(auth)/login/page.tsx`
- [Auth forms](https://github.com/suhaibmalam/nutrimap/blob/main/src/features/authentication/components/register-form.tsx): `src/features/authentication/components/register-form.tsx`
- [Auth endpoint](https://github.com/suhaibmalam/nutrimap/blob/main/src/app/api/auth/%5B...all%5D/route.ts): `src/app/api/auth/[...all]/route.ts`
- [Auth service](https://github.com/suhaibmalam/nutrimap/blob/main/src/lib/auth.ts): `src/lib/auth.ts`

### Profile and locale

- [Profile settings](https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(app)/settings/profile/page.tsx): `src/app/(app)/settings/profile/page.tsx`
- [Profile form](https://github.com/suhaibmalam/nutrimap/blob/main/src/features/settings/components/profile-settings-form.tsx): `src/features/settings/components/profile-settings-form.tsx`
- [Country browser](https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(app)/countries/page.tsx): `src/app/(app)/countries/page.tsx`
- [Country list](https://github.com/suhaibmalam/nutrimap/blob/main/src/features/countries/components/country-list.tsx): `src/features/countries/components/country-list.tsx`
- [Countries endpoint](https://github.com/suhaibmalam/nutrimap/blob/main/src/app/api/countries/route.ts): `src/app/api/countries/route.ts`
- [Country service](https://github.com/suhaibmalam/nutrimap/blob/main/src/services/country.service.ts): `src/services/country.service.ts`
- [Profile endpoint](https://github.com/suhaibmalam/nutrimap/blob/main/src/app/api/profile/route.ts): `src/app/api/profile/route.ts`
- [Profile validation](https://github.com/suhaibmalam/nutrimap/blob/main/src/schemas/user-profile.schema.ts): `src/schemas/user-profile.schema.ts`
- [Profile service](https://github.com/suhaibmalam/nutrimap/blob/main/src/services/user-profile.service.ts): `src/services/user-profile.service.ts`
- [Profile repository](https://github.com/suhaibmalam/nutrimap/blob/main/src/repositories/user-profile.repository.ts): `src/repositories/user-profile.repository.ts`
- [Database client](https://github.com/suhaibmalam/nutrimap/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`

### Nutrition experience

- [Dashboard](https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(app)/dashboard/page.tsx): `src/app/(app)/dashboard/page.tsx`
- [Food catalog](https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(app)/foods/page.tsx): `src/app/(app)/foods/page.tsx`
- [Meal tracking](https://github.com/suhaibmalam/nutrimap/blob/main/src/app/(app)/meals/page.tsx): `src/app/(app)/meals/page.tsx`

### Other components

- **Visitor / user**

## Connections

- Visitor / user → Landing page: visits
- Landing page → Auth service: checks session
- Visitor / user → Registration: registers
- Visitor / user → Sign in: signs in
- Auth endpoint → Auth service: dispatches
- Auth service → Database client: uses adapter
- Visitor / user → App shell: opens app
- Visitor / user → Profile settings: configures profile
- Profile endpoint → Auth service: checks session
- Profile endpoint → Profile validation: validates update
- Profile endpoint → Profile service: gets or updates
- Profile service → Profile repository: reads or upserts
- Profile repository → Database client: queries
- Countries endpoint → Country service: lists countries
- Visitor / user → Dashboard: views
- Visitor / user → Food catalog: browses
- Visitor / user → Meal tracking: tracks meals
