# anirudhn-1149/magicflix architecture

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

- Interactive diagram: https://gitdiagram.com/anirudhn-1149/magicflix
- Repository: https://github.com/anirudhn-1149/magicflix

## Overview

MagicFlix is a movie-ticket booking application. Users browse movies and showtimes, choose seats, create a booking, and pay through Stripe; the server tracks occupied seats and processes payment-related events. The frontend also provides favorites and booking history, while administrators manage shows and review dashboard, show, and booking data. Scheduled and event-driven Inngest jobs handle payment cleanup, emails, and reminders. The README is empty, so capability coverage comes from the file tree and sampled sources; some client-to-server links are dashed where endpoint wiring was not excerpted.

Main entry points: [`client/src/App.jsx`](https://github.com/anirudhn-1149/magicflix/blob/main/client/src/App.jsx) (App routes), [`server/inngest/index.js`](https://github.com/anirudhn-1149/magicflix/blob/main/server/inngest/index.js) (Background jobs), [`server/server.js`](https://github.com/anirudhn-1149/magicflix/blob/main/server/server.js) (HTTP server), [`server/controllers/showController.js`](https://github.com/anirudhn-1149/magicflix/blob/main/server/controllers/showController.js) (Show management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Customer app"]
  node_app["App routes<br/>[App.jsx]"]
  node_context["App context<br/>[AppContext.jsx]"]
  node_catalog["Movie discovery<br/>[Movies.jsx]"]
  node_details["Movie details<br/>[MovieDetails.jsx]"]
  node_seats["Seat selection<br/>[SeatLayout.jsx]"]
  node_bookings["My bookings<br/>[MyBookings.jsx]"]
  node_favorites["Favorites<br/>[Favorite.jsx]"]
  node_home["Home and featured<br/>[Home.jsx]"]
end

subgraph group_admin["Admin app"]
  node_adminui["Admin pages"]
end

subgraph group_api["API services"]
  node_server["HTTP server<br/>[server.js]"]
  node_showroutes["Show routes<br/>[showRouter.js]"]
  node_bookingroutes["Booking routes<br/>[bookingRouter.js]"]
  node_userroutes["User routes<br/>[userRoutes.js]"]
  node_adminroutes["Admin routes<br/>[adminRoutes.js]"]
  node_showctrl["Show management<br/>[showController.js]"]
  node_bookingctrl["Booking and seats"]
  node_userctrl["User services<br/>[userController.js]"]
  node_adminctrl["Admin reporting<br/>[adminController.js]"]
  node_webhook["Stripe webhook<br/>[stripeWebhooks.js]"]
  node_auth["Auth middleware<br/>[auth.js]"]
end

subgraph group_data["Domain data"]
  node_movie[("Movie records<br/>[Movie.js]")]
  node_show[("Show records<br/>[Show.js]")]
  node_booking[("Booking records<br/>[Booking.js]")]
  node_user[("User records<br/>[User.js]")]
  node_db["Mongo connection<br/>[db.js]"]
end

subgraph group_jobs["Events and integrations"]
  node_inngest["Background jobs<br/>[index.js]"]
  node_mailer["Email delivery<br/>[nodeMailer.js]"]
end

node_customer(("Moviegoer"))
node_tmdb["TMDB"]
node_stripe["Stripe checkout"]

node_customer -->|"uses"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_catalog
node_app -->|"routes to"| node_details
node_app -->|"routes to"| node_seats
node_app -->|"routes to"| node_bookings
node_app -->|"routes to"| node_favorites
node_app -->|"routes to"| node_adminui
node_context -.->|"fetches shows"| node_showctrl
node_context -.->|"fetches favorites"| node_userctrl
node_seats -.->|"requests booking"| node_bookingctrl
node_bookings -.->|"loads history"| node_userctrl
node_adminui -.->|"requests admin data"| node_adminctrl
node_server -->|"mounts"| node_showroutes
node_server -->|"mounts"| node_bookingroutes
node_server -->|"mounts"| node_userroutes
node_server -->|"mounts"| node_adminroutes
node_server -->|"connects"| node_db
node_server -->|"serves functions"| node_inngest
node_server -->|"routes webhook"| node_webhook
node_showroutes -->|"dispatches"| node_showctrl
node_bookingroutes -->|"dispatches"| node_bookingctrl
node_userroutes -->|"dispatches"| node_userctrl
node_adminroutes -->|"dispatches"| node_adminctrl
node_adminroutes -->|"protects"| node_auth
node_showctrl -->|"reads and creates"| node_movie
node_showctrl -->|"creates and reads"| node_show
node_showctrl -->|"fetches movie data"| node_tmdb
node_showctrl -->|"sends show event"| node_inngest
node_bookingctrl -->|"checks and updates seats"| node_show
node_bookingctrl -->|"creates booking"| node_booking
node_bookingctrl -->|"creates checkout"| node_stripe
node_bookingctrl -->|"sends payment event"| node_inngest
node_adminctrl -->|"queries"| node_booking
node_adminctrl -->|"queries"| node_show
node_adminctrl -->|"queries"| node_user
node_webhook -->|"updates payment"| node_booking
node_webhook -->|"sends booking event"| node_inngest
node_inngest -->|"checks and updates"| node_booking
node_inngest -->|"reads and releases seats"| node_show
node_inngest -->|"syncs and looks up users"| node_user
node_inngest -->|"sends notifications"| node_mailer
node_auth -.->|"checks role"| node_user

click node_app "https://github.com/anirudhn-1149/magicflix/blob/main/client/src/App.jsx"
click node_context "https://github.com/anirudhn-1149/magicflix/blob/main/client/src/context/AppContext.jsx"
click node_catalog "https://github.com/anirudhn-1149/magicflix/blob/main/client/src/pages/Movies.jsx"
click node_details "https://github.com/anirudhn-1149/magicflix/blob/main/client/src/pages/MovieDetails.jsx"
click node_seats "https://github.com/anirudhn-1149/magicflix/blob/main/client/src/pages/SeatLayout.jsx"
click node_bookings "https://github.com/anirudhn-1149/magicflix/blob/main/client/src/pages/MyBookings.jsx"
click node_favorites "https://github.com/anirudhn-1149/magicflix/blob/main/client/src/pages/Favorite.jsx"
click node_home "https://github.com/anirudhn-1149/magicflix/blob/main/client/src/pages/Home.jsx"
click node_adminui "https://github.com/anirudhn-1149/magicflix/tree/main/client/src/pages/admin"
click node_server "https://github.com/anirudhn-1149/magicflix/blob/main/server/server.js"
click node_showroutes "https://github.com/anirudhn-1149/magicflix/blob/main/server/routes/showRouter.js"
click node_bookingroutes "https://github.com/anirudhn-1149/magicflix/blob/main/server/routes/bookingRouter.js"
click node_userroutes "https://github.com/anirudhn-1149/magicflix/blob/main/server/routes/userRoutes.js"
click node_adminroutes "https://github.com/anirudhn-1149/magicflix/blob/main/server/routes/adminRoutes.js"
click node_showctrl "https://github.com/anirudhn-1149/magicflix/blob/main/server/controllers/showController.js"
click node_bookingctrl "https://github.com/anirudhn-1149/magicflix/blob/main/server/controllers/bookingController.js"
click node_userctrl "https://github.com/anirudhn-1149/magicflix/blob/main/server/controllers/userController.js"
click node_adminctrl "https://github.com/anirudhn-1149/magicflix/blob/main/server/controllers/adminController.js"
click node_webhook "https://github.com/anirudhn-1149/magicflix/blob/main/server/controllers/stripeWebhooks.js"
click node_auth "https://github.com/anirudhn-1149/magicflix/blob/main/server/middleware/auth.js"
click node_movie "https://github.com/anirudhn-1149/magicflix/blob/main/server/models/Movie.js"
click node_show "https://github.com/anirudhn-1149/magicflix/blob/main/server/models/Show.js"
click node_booking "https://github.com/anirudhn-1149/magicflix/blob/main/server/models/Booking.js"
click node_user "https://github.com/anirudhn-1149/magicflix/blob/main/server/models/User.js"
click node_db "https://github.com/anirudhn-1149/magicflix/blob/main/server/configs/db.js"
click node_inngest "https://github.com/anirudhn-1149/magicflix/blob/main/server/inngest/index.js"
click node_mailer "https://github.com/anirudhn-1149/magicflix/blob/main/server/configs/nodeMailer.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_app,node_context,node_catalog,node_details,node_seats,node_bookings,node_favorites,node_home toneBlue
class node_adminui toneAmber
class node_server,node_showroutes,node_bookingroutes,node_userroutes,node_adminroutes,node_showctrl,node_bookingctrl,node_userctrl,node_adminctrl,node_webhook,node_auth toneMint
class node_movie,node_show,node_booking,node_user,node_db toneRose
class node_inngest,node_mailer,node_customer,node_tmdb,node_stripe toneIndigo
```

## Components

### Customer app

- [App routes](https://github.com/anirudhn-1149/magicflix/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [App context](https://github.com/anirudhn-1149/magicflix/blob/main/client/src/context/AppContext.jsx): `client/src/context/AppContext.jsx`
- [Movie discovery](https://github.com/anirudhn-1149/magicflix/blob/main/client/src/pages/Movies.jsx): `client/src/pages/Movies.jsx`
- [Movie details](https://github.com/anirudhn-1149/magicflix/blob/main/client/src/pages/MovieDetails.jsx): `client/src/pages/MovieDetails.jsx`
- [Seat selection](https://github.com/anirudhn-1149/magicflix/blob/main/client/src/pages/SeatLayout.jsx): `client/src/pages/SeatLayout.jsx`
- [My bookings](https://github.com/anirudhn-1149/magicflix/blob/main/client/src/pages/MyBookings.jsx): `client/src/pages/MyBookings.jsx`
- [Favorites](https://github.com/anirudhn-1149/magicflix/blob/main/client/src/pages/Favorite.jsx): `client/src/pages/Favorite.jsx`
- [Home and featured](https://github.com/anirudhn-1149/magicflix/blob/main/client/src/pages/Home.jsx): `client/src/pages/Home.jsx`

### Admin app

- [Admin pages](https://github.com/anirudhn-1149/magicflix/tree/main/client/src/pages/admin): `client/src/pages/admin`

### API services

- [HTTP server](https://github.com/anirudhn-1149/magicflix/blob/main/server/server.js): `server/server.js`
- [Show routes](https://github.com/anirudhn-1149/magicflix/blob/main/server/routes/showRouter.js): `server/routes/showRouter.js`
- [Booking routes](https://github.com/anirudhn-1149/magicflix/blob/main/server/routes/bookingRouter.js): `server/routes/bookingRouter.js`
- [User routes](https://github.com/anirudhn-1149/magicflix/blob/main/server/routes/userRoutes.js): `server/routes/userRoutes.js`
- [Admin routes](https://github.com/anirudhn-1149/magicflix/blob/main/server/routes/adminRoutes.js): `server/routes/adminRoutes.js`
- [Show management](https://github.com/anirudhn-1149/magicflix/blob/main/server/controllers/showController.js): `server/controllers/showController.js`
- [Booking and seats](https://github.com/anirudhn-1149/magicflix/blob/main/server/controllers/bookingController.js): `server/controllers/bookingController.js`
- [User services](https://github.com/anirudhn-1149/magicflix/blob/main/server/controllers/userController.js): `server/controllers/userController.js`
- [Admin reporting](https://github.com/anirudhn-1149/magicflix/blob/main/server/controllers/adminController.js): `server/controllers/adminController.js`
- [Stripe webhook](https://github.com/anirudhn-1149/magicflix/blob/main/server/controllers/stripeWebhooks.js): `server/controllers/stripeWebhooks.js`
- [Auth middleware](https://github.com/anirudhn-1149/magicflix/blob/main/server/middleware/auth.js): `server/middleware/auth.js`

### Domain data

- [Movie records](https://github.com/anirudhn-1149/magicflix/blob/main/server/models/Movie.js): `server/models/Movie.js`
- [Show records](https://github.com/anirudhn-1149/magicflix/blob/main/server/models/Show.js): `server/models/Show.js`
- [Booking records](https://github.com/anirudhn-1149/magicflix/blob/main/server/models/Booking.js): `server/models/Booking.js`
- [User records](https://github.com/anirudhn-1149/magicflix/blob/main/server/models/User.js): `server/models/User.js`
- [Mongo connection](https://github.com/anirudhn-1149/magicflix/blob/main/server/configs/db.js): `server/configs/db.js`

### Events and integrations

- [Background jobs](https://github.com/anirudhn-1149/magicflix/blob/main/server/inngest/index.js): `server/inngest/index.js`
- [Email delivery](https://github.com/anirudhn-1149/magicflix/blob/main/server/configs/nodeMailer.js): `server/configs/nodeMailer.js`

### Other components

- **Moviegoer**
- **TMDB**
- **Stripe checkout**

## Connections

- Moviegoer → App routes: uses (evidence: `client/src/App.jsx`)
- App routes → Home and featured: routes to (evidence: `client/src/App.jsx`)
- App routes → Movie discovery: routes to (evidence: `client/src/App.jsx`)
- App routes → Movie details: routes to (evidence: `client/src/App.jsx`)
- App routes → Seat selection: routes to (evidence: `client/src/App.jsx`)
- App routes → My bookings: routes to (evidence: `client/src/App.jsx`)
- App routes → Favorites: routes to (evidence: `client/src/App.jsx`)
- App routes → Admin pages: routes to (evidence: `client/src/App.jsx`)
- App context → Show management: fetches shows
- App context → User services: fetches favorites
- Seat selection → Booking and seats: requests booking
- My bookings → User services: loads history
- Admin pages → Admin reporting: requests admin data
- HTTP server → Show routes: mounts (evidence: `server/server.js`)
- HTTP server → Booking routes: mounts (evidence: `server/server.js`)
- HTTP server → User routes: mounts (evidence: `server/server.js`)
- HTTP server → Admin routes: mounts (evidence: `server/server.js`)
- HTTP server → Mongo connection: connects (evidence: `server/server.js`)
- HTTP server → Background jobs: serves functions (evidence: `server/server.js`)
- HTTP server → Stripe webhook: routes webhook (evidence: `server/server.js`)
- Show routes → Show management: dispatches (evidence: `server/routes/showRouter.js`)
- Booking routes → Booking and seats: dispatches (evidence: `server/routes/bookingRouter.js`)
- User routes → User services: dispatches (evidence: `server/routes/userRoutes.js`)
- Admin routes → Admin reporting: dispatches (evidence: `server/routes/adminRoutes.js`)
- Admin routes → Auth middleware: protects (evidence: `server/routes/adminRoutes.js`)
- Show management → Movie records: reads and creates (evidence: `server/controllers/showController.js`)
- Show management → Show records: creates and reads (evidence: `server/controllers/showController.js`)
- Show management → TMDB: fetches movie data (evidence: `server/controllers/showController.js`)
- Show management → Background jobs: sends show event (evidence: `server/controllers/showController.js`)
- Booking and seats → Show records: checks and updates seats (evidence: `server/controllers/bookingController.js`)
- Booking and seats → Booking records: creates booking (evidence: `server/controllers/bookingController.js`)
- Booking and seats → Stripe checkout: creates checkout (evidence: `server/controllers/bookingController.js`)
- Booking and seats → Background jobs: sends payment event (evidence: `server/controllers/bookingController.js`)
- Admin reporting → Booking records: queries (evidence: `server/controllers/adminController.js`)
- Admin reporting → Show records: queries (evidence: `server/controllers/adminController.js`)
- Admin reporting → User records: queries (evidence: `server/controllers/adminController.js`)
- Stripe webhook → Booking records: updates payment (evidence: `server/controllers/stripeWebhooks.js`)
- Stripe webhook → Background jobs: sends booking event (evidence: `server/controllers/stripeWebhooks.js`)
- Background jobs → Booking records: checks and updates (evidence: `server/inngest/index.js`)
- Background jobs → Show records: reads and releases seats (evidence: `server/inngest/index.js`)
- Background jobs → User records: syncs and looks up users (evidence: `server/inngest/index.js`)
- Background jobs → Email delivery: sends notifications (evidence: `server/inngest/index.js`)
- Auth middleware → User records: checks role
