# tej-carpenter/foodydipti architecture

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

- Interactive diagram: https://gitdiagram.com/tej-carpenter/foodydipti
- Repository: https://github.com/tej-carpenter/foodydipti

## Overview

#### Purpose and Entry Points
A Next.js App Router recipe platform for a single food influencer: public recipe discovery, authenticated favorites/profile, and admin recipe management. The root application shell is `src/app/layout.tsx`; public landing and recipe detail entry points are `src/app/page.tsx` and `src/app/recipe/[id]/page.tsx`.

#### Route Domains
Public content routes cover about, contact, recipe browsing/detail, and login: `src/app/about/page.tsx`, `src/app/contact/page.tsx`, and `src/app/login/page.tsx`. Authenticated user and administrator surfaces are separated into `src/app/profile/page.tsx`, `src/app/admin/page.tsx`, and `src/app/admin/recipe/[id]/edit/page.tsx`.

#### Authentication and Authorization Boundary
Firebase Authentication is exposed to the React tree through `src/components/auth/AuthProvider.tsx`. Login is handled by `src/components/forms/LoginForm.tsx`; user-specific saved content is presented through `src/components/profile/SavedRecipesPanel.tsx`. Firebase security enforcement is defined outside the UI in `firestore.rules` and `storage.rules`, making client authorization and database/storage policy distinct layers.

#### Recipe Content Lifecycle
Recipes are modeled centrally in `src/types/index.ts` and persisted through Firebase-facing data access in `src/lib/firestore.ts`. Admin create/edit flows use `src/components/forms/RecipeForm.tsx` and `src/components/forms/EditRecipeForm.tsx`; deletion is isolated in `src/components/DeleteRecipeButton.tsx`. Public detail rendering consumes recipe IDs from the dynamic route at `src/app/recipe/[id]/page.tsx`.

#### Discovery and Presentation Flow
The home/discovery experience composes reusable recipe display and filtering components: `src/components/SearchFilterBar.tsx`, `src/components/PaginatedRecipeGrid.tsx`, and `src/components/RecipeCard.tsx`. Recipe-specific user actions are grouped in `src/components/RecipeActions.tsx`, creating a boundary between display cards/grids and favorites or other interaction behavior.

#### Media and External Services
Firebase is initialized and configured through `src/lib/firebase.ts`, with Firestore operations centralized in `src/lib/firestore.ts`. Recipe media has a separate Cloudinary integration boundary at `src/lib/cloudinary.ts`; Firebase Storage is also part of the declared stack and governed by `storage.rules`. Deployment targets Vercel, while the application runtime is Next.js/Node.js.

#### Contact and Administrative Operations
Contact submission handling is server-routed through `src/app/api/contact/route.ts`, with a local variant at `src/app/api/contact/local/route.ts`. Administrative review of submissions is surfaced by `src/components/admin/ContactSubmissionsPanel.tsx` and integrated into `src/app/admin/page.tsx`. This separates browser-facing contact UI from API-side submission processing and admin review.

Main entry points: [`src/lib/firestore.ts`](https://github.com/tej-carpenter/foodydipti/blob/main/src/lib/firestore.ts) (Recipe data access), [`src/app/layout.tsx`](https://github.com/tej-carpenter/foodydipti/blob/main/src/app/layout.tsx) (Application shell), [`src/app/admin/page.tsx`](https://github.com/tej-carpenter/foodydipti/blob/main/src/app/admin/page.tsx) (Admin workspace), [`src/components/forms/RecipeForm.tsx`](https://github.com/tej-carpenter/foodydipti/blob/main/src/components/forms/RecipeForm.tsx) (Recipe authoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Next.js surfaces"]
  node_shell["Application shell<br/>Next.js layout<br/>[layout.tsx]"]
  node_public["Public discovery<br/>App Router pages<br/>[page.tsx]"]
  node_detail["Recipe detail<br/>dynamic page<br/>[page.tsx]"]
  node_profile["User profile<br/>protected page<br/>[page.tsx]"]
  node_admin["Admin workspace<br/>protected page<br/>[page.tsx]"]
end

subgraph group_recipes["Recipe lifecycle"]
  node_discovery["Search and recipe grid<br/>UI composition"]
  node_actions["Recipe actions<br/>interaction component<br/>[RecipeActions.tsx]"]
  node_recipeforms["Recipe authoring<br/>admin forms<br/>[RecipeForm.tsx]"]
  node_deletion["Recipe deletion<br/>admin action"]
  node_model["Recipe model<br/>TypeScript types<br/>[index.ts]"]
  node_repository["Recipe data access<br/>Firestore client<br/>[firestore.ts]"]
end

subgraph group_auth["Identity and policy"]
  node_authprovider["Auth provider<br/>React auth boundary<br/>[AuthProvider.tsx]"]
  node_login["Login form<br/>auth form<br/>[LoginForm.tsx]"]
  node_saved["Saved recipes<br/>profile panel"]
  node_rules["Firebase policies<br/>security rules<br/>[firestore.rules]"]
end

subgraph group_contact["Contact operations"]
  node_contactapi["Contact API<br/>route handler<br/>[route.ts]"]
  node_submissions["Submission review<br/>admin panel"]
end

subgraph group_services["External services"]
  node_firebase[("Firebase<br/>Auth, Firestore, Storage<br/>[firebase.ts]")]
  node_cloudinary[("Cloudinary media<br/>media integration<br/>[cloudinary.ts]")]
end

node_shell --> node_public
node_shell --> node_detail
node_shell --> node_profile
node_shell --> node_admin
node_shell -->|"provides identity"| node_authprovider
node_public -->|"composes"| node_discovery
node_public -->|"hosts"| node_login
node_detail -->|"loads by recipe ID"| node_repository
node_detail -->|"enables"| node_actions
node_profile -->|"shows"| node_saved
node_saved -->|"reads favorites"| node_repository
node_admin -->|"manages recipes"| node_recipeforms
node_admin -->|"removes recipes"| node_deletion
node_admin -->|"reviews"| node_submissions
node_discovery -->|"queries recipes"| node_repository
node_recipeforms -->|"uses"| node_model
node_recipeforms -->|"writes recipes"| node_repository
node_recipeforms -->|"uploads media"| node_cloudinary
node_deletion -->|"deletes recipe"| node_repository
node_login -->|"signs in through"| node_authprovider
node_authprovider -->|"uses Authentication"| node_firebase
node_repository -->|"uses Firestore"| node_firebase
node_rules -.->|"enforces access"| node_firebase
node_contactapi -->|"stores submissions"| node_repository
node_submissions -->|"reads submissions"| node_repository

click node_shell "https://github.com/tej-carpenter/foodydipti/blob/main/src/app/layout.tsx"
click node_public "https://github.com/tej-carpenter/foodydipti/blob/main/src/app/page.tsx"
click node_detail "https://github.com/tej-carpenter/foodydipti/blob/main/src/app/recipe/%5Bid%5D/page.tsx"
click node_profile "https://github.com/tej-carpenter/foodydipti/blob/main/src/app/profile/page.tsx"
click node_admin "https://github.com/tej-carpenter/foodydipti/blob/main/src/app/admin/page.tsx"
click node_discovery "https://github.com/tej-carpenter/foodydipti/blob/main/src/components/PaginatedRecipeGrid.tsx"
click node_actions "https://github.com/tej-carpenter/foodydipti/blob/main/src/components/RecipeActions.tsx"
click node_recipeforms "https://github.com/tej-carpenter/foodydipti/blob/main/src/components/forms/RecipeForm.tsx"
click node_deletion "https://github.com/tej-carpenter/foodydipti/blob/main/src/components/DeleteRecipeButton.tsx"
click node_model "https://github.com/tej-carpenter/foodydipti/blob/main/src/types/index.ts"
click node_repository "https://github.com/tej-carpenter/foodydipti/blob/main/src/lib/firestore.ts"
click node_authprovider "https://github.com/tej-carpenter/foodydipti/blob/main/src/components/auth/AuthProvider.tsx"
click node_login "https://github.com/tej-carpenter/foodydipti/blob/main/src/components/forms/LoginForm.tsx"
click node_saved "https://github.com/tej-carpenter/foodydipti/blob/main/src/components/profile/SavedRecipesPanel.tsx"
click node_rules "https://github.com/tej-carpenter/foodydipti/blob/main/firestore.rules"
click node_contactapi "https://github.com/tej-carpenter/foodydipti/blob/main/src/app/api/contact/route.ts"
click node_submissions "https://github.com/tej-carpenter/foodydipti/blob/main/src/components/admin/ContactSubmissionsPanel.tsx"
click node_firebase "https://github.com/tej-carpenter/foodydipti/blob/main/src/lib/firebase.ts"
click node_cloudinary "https://github.com/tej-carpenter/foodydipti/blob/main/src/lib/cloudinary.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_shell,node_public,node_detail,node_profile,node_admin toneBlue
class node_discovery,node_actions,node_recipeforms,node_deletion,node_model,node_repository toneAmber
class node_authprovider,node_login,node_saved,node_rules toneMint
class node_contactapi,node_submissions toneRose
class node_firebase,node_cloudinary toneIndigo
```

## Components

### Next.js surfaces

- [Application shell](https://github.com/tej-carpenter/foodydipti/blob/main/src/app/layout.tsx): Next.js layout · `src/app/layout.tsx`
- [Public discovery](https://github.com/tej-carpenter/foodydipti/blob/main/src/app/page.tsx): App Router pages · Landing, browse, about, and login routes. · `src/app/page.tsx`
- [Recipe detail](https://github.com/tej-carpenter/foodydipti/blob/main/src/app/recipe/%5Bid%5D/page.tsx): dynamic page · `src/app/recipe/[id]/page.tsx`
- [User profile](https://github.com/tej-carpenter/foodydipti/blob/main/src/app/profile/page.tsx): protected page · `src/app/profile/page.tsx`
- [Admin workspace](https://github.com/tej-carpenter/foodydipti/blob/main/src/app/admin/page.tsx): protected page · Includes recipe editing and submission review. · `src/app/admin/page.tsx`

### Recipe lifecycle

- [Search and recipe grid](https://github.com/tej-carpenter/foodydipti/blob/main/src/components/PaginatedRecipeGrid.tsx): UI composition · Filters, paginates, and displays recipe cards. · `src/components/PaginatedRecipeGrid.tsx`
- [Recipe actions](https://github.com/tej-carpenter/foodydipti/blob/main/src/components/RecipeActions.tsx): interaction component · Separates favorites and other user actions from display. · `src/components/RecipeActions.tsx`
- [Recipe authoring](https://github.com/tej-carpenter/foodydipti/blob/main/src/components/forms/RecipeForm.tsx): admin forms · Create and edit recipe flows. · `src/components/forms/RecipeForm.tsx`
- [Recipe deletion](https://github.com/tej-carpenter/foodydipti/blob/main/src/components/DeleteRecipeButton.tsx): admin action · `src/components/DeleteRecipeButton.tsx`
- [Recipe model](https://github.com/tej-carpenter/foodydipti/blob/main/src/types/index.ts): TypeScript types · `src/types/index.ts`
- [Recipe data access](https://github.com/tej-carpenter/foodydipti/blob/main/src/lib/firestore.ts): Firestore client · Centralizes Firebase-facing persistence operations. · `src/lib/firestore.ts`

### Identity and policy

- [Auth provider](https://github.com/tej-carpenter/foodydipti/blob/main/src/components/auth/AuthProvider.tsx): React auth boundary · Exposes Firebase Authentication to the component tree. · `src/components/auth/AuthProvider.tsx`
- [Login form](https://github.com/tej-carpenter/foodydipti/blob/main/src/components/forms/LoginForm.tsx): auth form · `src/components/forms/LoginForm.tsx`
- [Saved recipes](https://github.com/tej-carpenter/foodydipti/blob/main/src/components/profile/SavedRecipesPanel.tsx): profile panel · `src/components/profile/SavedRecipesPanel.tsx`
- [Firebase policies](https://github.com/tej-carpenter/foodydipti/blob/main/firestore.rules): security rules · Firestore and Storage enforce backend authorization. · `firestore.rules`

### Contact operations

- [Contact API](https://github.com/tej-carpenter/foodydipti/blob/main/src/app/api/contact/route.ts): route handler · Processes browser contact submissions; includes a local variant. · `src/app/api/contact/route.ts`
- [Submission review](https://github.com/tej-carpenter/foodydipti/blob/main/src/components/admin/ContactSubmissionsPanel.tsx): admin panel · `src/components/admin/ContactSubmissionsPanel.tsx`

### External services

- [Firebase](https://github.com/tej-carpenter/foodydipti/blob/main/src/lib/firebase.ts): Auth, Firestore, Storage · Initialized by the application and protected by rules. · `src/lib/firebase.ts`
- [Cloudinary media](https://github.com/tej-carpenter/foodydipti/blob/main/src/lib/cloudinary.ts): media integration · `src/lib/cloudinary.ts`

## Connections

- Application shell → Public discovery
- Application shell → Recipe detail
- Application shell → User profile
- Application shell → Admin workspace
- Application shell → Auth provider: provides identity
- Public discovery → Search and recipe grid: composes
- Public discovery → Login form: hosts
- Recipe detail → Recipe data access: loads by recipe ID
- Recipe detail → Recipe actions: enables
- User profile → Saved recipes: shows
- Saved recipes → Recipe data access: reads favorites
- Admin workspace → Recipe authoring: manages recipes
- Admin workspace → Recipe deletion: removes recipes
- Admin workspace → Submission review: reviews
- Search and recipe grid → Recipe data access: queries recipes
- Recipe authoring → Recipe model: uses
- Recipe authoring → Recipe data access: writes recipes
- Recipe authoring → Cloudinary media: uploads media
- Recipe deletion → Recipe data access: deletes recipe
- Login form → Auth provider: signs in through
- Auth provider → Firebase: uses Authentication
- Recipe data access → Firebase: uses Firestore
- Firebase policies → Firebase: enforces access
- Contact API → Recipe data access: stores submissions
- Submission review → Recipe data access: reads submissions
