# ipsayush/big-photofolio architecture

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

- Interactive diagram: https://gitdiagram.com/ipsayush/big-photofolio
- Repository: https://github.com/ipsayush/big-photofolio

## Overview

PhotoFolio is a multi-tenant event-photography SaaS: photographers manage events and upload photos, background workers create image derivatives and perform face matching, and guests use consent-based personalized galleries. The graph also preserves authentication, billing, dashboards, and admin capabilities documented in the README. Some subsystem links rely on README-level architecture and feature descriptions; unsampled implementation details are not asserted.

Main entry points: [`packages/server/src/app.js`](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/app.js) (Express API), [`packages/server/src/config/db.js`](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/config/db.js) (MongoDB), [`packages/server/src/services/upload.service.js`](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/upload.service.js) (Photo uploads), [`packages/client/src/App.jsx`](https://github.com/ipsayush/big-photofolio/blob/main/packages/client/src/App.jsx) (React application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web experiences"]
  node_web["React application<br/>[App.jsx]"]
  node_authui["Auth state<br/>[AuthContext.jsx]"]
  node_eventui["Event and upload UI"]
  node_guestui["Guest gallery UI"]
  node_adminui["Admin console"]
end

subgraph group_api["API and controls"]
  node_apiapp["Express API<br/>[app.js]"]
  node_auth["Authentication<br/>[auth.service.js]"]
  node_events["Event management<br/>[event.service.js]"]
  node_uploads["Photo uploads<br/>[upload.service.js]"]
  node_guestflow["Consent and gallery<br/>[guest.service.js]"]
end

subgraph group_media["Photo processing"]
  node_matching["Face matching"]
  node_worker["BullMQ worker<br/>[index.js]"]
  node_images["Image processing<br/>[imageProcessor.js]"]
  node_faces["Face processing<br/>[faceProcessor.js]"]
  node_faceprovider["Face provider<br/>[providerFactory.js]"]
end

subgraph group_data["State and services"]
  node_mongo[("MongoDB<br/>[db.js]")]
  node_s3[("AWS S3 and CDN<br/>[s3.js]")]
  node_redis["Redis queue<br/>[queue.js]"]
end

subgraph group_platform["Platform operations"]
  node_billing["Subscription billing"]
  node_razorpay["Razorpay"]
  node_dashboard["Dashboards and metrics"]
  node_tenantadmin["Tenant and plan controls"]
end

node_photographer(("Photographer"))
node_guest(("Guest"))
node_administrator(("Administrator"))

node_photographer -->|"uses"| node_web
node_guest -->|"uses"| node_web
node_administrator -->|"uses"| node_web
node_web -->|"uses"| node_authui
node_web -->|"calls API"| node_apiapp
node_eventui -->|"manages events"| node_apiapp
node_eventui -->|"uploads photos"| node_uploads
node_guestui -->|"requests gallery"| node_guestflow
node_adminui -->|"manages tenants"| node_tenantadmin
node_apiapp -->|"routes auth"| node_auth
node_apiapp -->|"routes events"| node_events
node_apiapp -->|"routes uploads"| node_uploads
node_apiapp -->|"routes guests"| node_guestflow
node_apiapp -->|"routes subscriptions"| node_billing
node_apiapp -->|"routes dashboards"| node_dashboard
node_uploads -->|"queues processing"| node_redis
node_redis -->|"dispatches jobs"| node_worker
node_worker -->|"runs processor"| node_images
node_worker -->|"runs processor"| node_faces
node_images -->|"reads and writes"| node_s3
node_images -->|"queues matching"| node_faces
node_faces -->|"detects faces"| node_faceprovider
node_faces -->|"matches faces"| node_matching
node_matching -->|"stores matches"| node_mongo
node_guestflow -->|"retrieves matches"| node_matching
node_guestflow -->|"delivers downloads"| node_s3
node_auth -->|"stores accounts"| node_mongo
node_events -->|"stores events"| node_mongo
node_uploads -->|"issues upload URLs"| node_s3
node_uploads -->|"tracks photos"| node_mongo
node_billing -->|"processes payments"| node_razorpay
node_billing -->|"stores subscriptions"| node_mongo
node_dashboard -->|"reads metrics"| node_mongo
node_tenantadmin -->|"manages tenant state"| node_mongo

click node_web "https://github.com/ipsayush/big-photofolio/blob/main/packages/client/src/App.jsx"
click node_authui "https://github.com/ipsayush/big-photofolio/blob/main/packages/client/src/context/AuthContext.jsx"
click node_eventui "https://github.com/ipsayush/big-photofolio/tree/main/packages/client/src/pages/events"
click node_guestui "https://github.com/ipsayush/big-photofolio/tree/main/packages/client/src/pages/guest"
click node_adminui "https://github.com/ipsayush/big-photofolio/tree/main/packages/client/src/pages/admin"
click node_apiapp "https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/app.js"
click node_auth "https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/auth.service.js"
click node_events "https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/event.service.js"
click node_uploads "https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/upload.service.js"
click node_guestflow "https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/guest.service.js"
click node_matching "https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/matching.service.js"
click node_worker "https://github.com/ipsayush/big-photofolio/blob/main/packages/worker/src/index.js"
click node_images "https://github.com/ipsayush/big-photofolio/blob/main/packages/worker/src/processors/imageProcessor.js"
click node_faces "https://github.com/ipsayush/big-photofolio/blob/main/packages/worker/src/processors/faceProcessor.js"
click node_faceprovider "https://github.com/ipsayush/big-photofolio/blob/main/packages/worker/src/providers/providerFactory.js"
click node_mongo "https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/config/db.js"
click node_s3 "https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/utils/s3.js"
click node_redis "https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/config/queue.js"
click node_billing "https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/subscription.service.js"
click node_dashboard "https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/dashboard.service.js"
click node_tenantadmin "https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/controllers/dashboard.controller.js"

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_web,node_authui,node_eventui,node_guestui,node_adminui toneBlue
class node_apiapp,node_auth,node_events,node_uploads,node_guestflow toneAmber
class node_matching,node_worker,node_images,node_faces,node_faceprovider toneMint
class node_mongo,node_s3,node_redis toneRose
class node_billing,node_razorpay,node_dashboard,node_tenantadmin,node_photographer,node_guest,node_administrator toneIndigo
```

## Components

### Web experiences

- [React application](https://github.com/ipsayush/big-photofolio/blob/main/packages/client/src/App.jsx): `packages/client/src/App.jsx`
- [Auth state](https://github.com/ipsayush/big-photofolio/blob/main/packages/client/src/context/AuthContext.jsx): `packages/client/src/context/AuthContext.jsx`
- [Event and upload UI](https://github.com/ipsayush/big-photofolio/tree/main/packages/client/src/pages/events): `packages/client/src/pages/events`
- [Guest gallery UI](https://github.com/ipsayush/big-photofolio/tree/main/packages/client/src/pages/guest): `packages/client/src/pages/guest`
- [Admin console](https://github.com/ipsayush/big-photofolio/tree/main/packages/client/src/pages/admin): `packages/client/src/pages/admin`

### API and controls

- [Express API](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/app.js): `packages/server/src/app.js`
- [Authentication](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/auth.service.js): `packages/server/src/services/auth.service.js`
- [Event management](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/event.service.js): `packages/server/src/services/event.service.js`
- [Photo uploads](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/upload.service.js): `packages/server/src/services/upload.service.js`
- [Consent and gallery](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/guest.service.js): `packages/server/src/services/guest.service.js`

### Photo processing

- [Face matching](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/matching.service.js): `packages/server/src/services/matching.service.js`
- [BullMQ worker](https://github.com/ipsayush/big-photofolio/blob/main/packages/worker/src/index.js): `packages/worker/src/index.js`
- [Image processing](https://github.com/ipsayush/big-photofolio/blob/main/packages/worker/src/processors/imageProcessor.js): `packages/worker/src/processors/imageProcessor.js`
- [Face processing](https://github.com/ipsayush/big-photofolio/blob/main/packages/worker/src/processors/faceProcessor.js): `packages/worker/src/processors/faceProcessor.js`
- [Face provider](https://github.com/ipsayush/big-photofolio/blob/main/packages/worker/src/providers/providerFactory.js): `packages/worker/src/providers/providerFactory.js`

### State and services

- [MongoDB](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/config/db.js): `packages/server/src/config/db.js`
- [AWS S3 and CDN](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/utils/s3.js): `packages/server/src/utils/s3.js`
- [Redis queue](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/config/queue.js): `packages/server/src/config/queue.js`

### Platform operations

- [Subscription billing](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/subscription.service.js): `packages/server/src/services/subscription.service.js`
- **Razorpay**
- [Dashboards and metrics](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/services/dashboard.service.js): `packages/server/src/services/dashboard.service.js`
- [Tenant and plan controls](https://github.com/ipsayush/big-photofolio/blob/main/packages/server/src/controllers/dashboard.controller.js): `packages/server/src/controllers/dashboard.controller.js`

### Other components

- **Photographer**
- **Guest**
- **Administrator**

## Connections

- Photographer → React application: uses
- Guest → React application: uses
- Administrator → React application: uses
- React application → Auth state: uses
- React application → Express API: calls API
- Event and upload UI → Express API: manages events
- Event and upload UI → Photo uploads: uploads photos
- Guest gallery UI → Consent and gallery: requests gallery
- Admin console → Tenant and plan controls: manages tenants
- Express API → Authentication: routes auth (evidence: `packages/server/src/app.js`)
- Express API → Event management: routes events (evidence: `packages/server/src/app.js`)
- Express API → Photo uploads: routes uploads (evidence: `packages/server/src/app.js`)
- Express API → Consent and gallery: routes guests (evidence: `packages/server/src/app.js`)
- Express API → Subscription billing: routes subscriptions (evidence: `packages/server/src/app.js`)
- Express API → Dashboards and metrics: routes dashboards (evidence: `packages/server/src/app.js`)
- Photo uploads → Redis queue: queues processing (evidence: `packages/server/src/services/upload.service.js`)
- Redis queue → BullMQ worker: dispatches jobs
- BullMQ worker → Image processing: runs processor (evidence: `packages/worker/src/index.js`)
- BullMQ worker → Face processing: runs processor (evidence: `packages/worker/src/index.js`)
- Image processing → AWS S3 and CDN: reads and writes (evidence: `packages/worker/src/processors/imageProcessor.js`)
- Image processing → Face processing: queues matching (evidence: `packages/worker/src/processors/imageProcessor.js`)
- Face processing → Face provider: detects faces
- Face processing → Face matching: matches faces
- Face matching → MongoDB: stores matches
- Consent and gallery → Face matching: retrieves matches
- Consent and gallery → AWS S3 and CDN: delivers downloads
- Authentication → MongoDB: stores accounts (evidence: `packages/server/src/services/auth.service.js`)
- Event management → MongoDB: stores events
- Photo uploads → AWS S3 and CDN: issues upload URLs (evidence: `packages/server/src/services/upload.service.js`)
- Photo uploads → MongoDB: tracks photos (evidence: `packages/server/src/services/upload.service.js`)
- Subscription billing → Razorpay: processes payments
- Subscription billing → MongoDB: stores subscriptions
- Dashboards and metrics → MongoDB: reads metrics
- Tenant and plan controls → MongoDB: manages tenant state
