# bhaveshchhimwal/popin architecture

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

- Interactive diagram: https://gitdiagram.com/bhaveshchhimwal/popin
- Repository: https://github.com/bhaveshchhimwal/popin

## Overview

PopIn is an event discovery, seller-management, and ticket-booking application. Buyers and sellers authenticate separately; users browse events, view details, and book tickets through a checkout session. A Stripe webhook confirms purchases, updates ticket inventory, creates tickets, and emails them. The client also provides event creation, profiles, and payment-result pages. Source excerpts establish the booking and webhook flow; several page and controller implementations were not sampled, so their internal behavior and some client-to-server endpoint mappings remain unspecified.

Main entry points: [`client/src/routes/Routes.jsx`](https://github.com/bhaveshchhimwal/popin/blob/main/client/src/routes/Routes.jsx) (Page routing), [`server/index.js`](https://github.com/bhaveshchhimwal/popin/blob/main/server/index.js) (HTTP API), [`server/controllers/webhook.js`](https://github.com/bhaveshchhimwal/popin/blob/main/server/controllers/webhook.js) (Purchase fulfillment), [`server/middlewares/auth.js`](https://github.com/bhaveshchhimwal/popin/blob/main/server/middlewares/auth.js) (Token authorization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_routes["Page routing<br/>[Routes.jsx]"]
  node_buyer_auth["Buyer authentication<br/>[AuthPage.jsx]"]
  node_seller_auth["Seller authentication<br/>[AuthPage.jsx]"]
  node_auth_handler["Auth request handler<br/>[authHandler.js]"]
  node_explore["Event discovery<br/>[ExploreEvents.jsx]"]
  node_event_detail["Event details"]
  node_event_hook["Event and booking state<br/>[useEventDetail.js]"]
  node_event_create["Event creation"]
  node_profile["User and seller profiles<br/>[ProfilePage.jsx]"]
  node_payment_pages["Payment results<br/>[PaymentSuccess.jsx]"]
  node_guards["Access guards<br/>[RequireAuth.jsx]"]
  node_api_client["HTTP client<br/>[axiosInstance.js]"]
  node_toast["Toast feedback<br/>[ToastContext.jsx]"]
end

subgraph group_server["Application server"]
  node_api_server["HTTP API<br/>[index.js]"]
  node_user_routes["User endpoints<br/>[user.js]"]
  node_event_routes["Event endpoints<br/>[event.js]"]
  node_payment_routes["Payment endpoints<br/>[payments.js]"]
  node_ticket_routes["Ticket endpoints<br/>[ticket.js]"]
  node_seller_routes["Seller endpoints<br/>[seller.js]"]
  node_user_controller["User operations<br/>[user.js]"]
  node_event_controller["Event operations<br/>[event.js]"]
  node_payment_controller["Checkout operations<br/>[payments.js]"]
  node_ticket_controller["Ticket operations<br/>[ticket.js]"]
  node_seller_controller["Seller operations<br/>[seller.js]"]
  node_auth_middleware["Token authorization<br/>[auth.js]"]
  node_webhook["Purchase fulfillment<br/>[webhook.js]"]
end

subgraph group_data["Persistence and services"]
  node_database[("Application database<br/>[prismaClient.js]")]
  node_ticket_number["Ticket number generator"]
  node_email["Ticket email service<br/>[emailService.js]"]
end

node_visitor(("Visitor"))
node_buyer(("Buyer"))
node_seller(("Seller"))
node_stripe["Stripe"]

node_visitor -->|"opens pages"| node_routes
node_buyer -->|"signs in"| node_buyer_auth
node_seller -->|"signs in"| node_seller_auth
node_routes -->|"routes to"| node_explore
node_routes -->|"routes to"| node_event_detail
node_routes -->|"routes to"| node_event_create
node_routes -->|"routes to"| node_profile
node_routes -->|"routes to"| node_payment_pages
node_routes -->|"guards routes"| node_guards
node_buyer_auth -->|"submits credentials"| node_auth_handler
node_seller_auth -->|"checks session"| node_api_client
node_auth_handler -->|"posts credentials"| node_api_client
node_buyer_auth -->|"shows feedback"| node_toast
node_seller_auth -->|"shows feedback"| node_toast
node_event_detail -->|"uses event state"| node_event_hook
node_event_hook -->|"loads and books"| node_api_client
node_event_hook -->|"shows feedback"| node_toast
node_api_client -.->|"sends API requests"| node_api_server
node_api_server -->|"mounts routes"| node_user_routes
node_api_server -->|"mounts routes"| node_event_routes
node_api_server -->|"mounts routes"| node_payment_routes
node_api_server -->|"mounts routes"| node_ticket_routes
node_api_server -->|"mounts routes"| node_seller_routes
node_user_routes -->|"dispatches"| node_user_controller
node_event_routes -->|"dispatches"| node_event_controller
node_payment_routes -->|"dispatches"| node_payment_controller
node_payment_routes -->|"registers webhook"| node_webhook
node_ticket_routes -->|"dispatches"| node_ticket_controller
node_seller_routes -->|"dispatches"| node_seller_controller
node_user_routes -->|"applies auth"| node_auth_middleware
node_event_routes -->|"applies auth"| node_auth_middleware
node_payment_routes -->|"applies auth"| node_auth_middleware
node_ticket_routes -->|"applies auth"| node_auth_middleware
node_seller_routes -->|"applies auth"| node_auth_middleware
node_user_controller -->|"reads and writes"| node_database
node_event_controller -->|"reads and writes"| node_database
node_payment_controller -->|"uses database"| node_database
node_ticket_controller -->|"reads and writes"| node_database
node_webhook -->|"fulfills purchase"| node_database
node_webhook -->|"generates numbers"| node_ticket_number
node_webhook -->|"sends tickets"| node_email
node_webhook -->|"verifies and refunds"| node_stripe

click node_routes "https://github.com/bhaveshchhimwal/popin/blob/main/client/src/routes/Routes.jsx"
click node_buyer_auth "https://github.com/bhaveshchhimwal/popin/blob/main/client/src/components/auth/authbuyer/AuthPage.jsx"
click node_seller_auth "https://github.com/bhaveshchhimwal/popin/blob/main/client/src/components/auth/authseller/AuthPage.jsx"
click node_auth_handler "https://github.com/bhaveshchhimwal/popin/blob/main/client/src/components/auth/authbuyer/functions/authHandler.js"
click node_explore "https://github.com/bhaveshchhimwal/popin/blob/main/client/src/pages/ExploreEvents.jsx"
click node_event_detail "https://github.com/bhaveshchhimwal/popin/blob/main/client/src/pages/EventDetailPage.jsx"
click node_event_hook "https://github.com/bhaveshchhimwal/popin/blob/main/client/src/hooks/useEventDetail.js"
click node_event_create "https://github.com/bhaveshchhimwal/popin/blob/main/client/src/pages/EventCreatePage.jsx"
click node_profile "https://github.com/bhaveshchhimwal/popin/blob/main/client/src/pages/ProfilePage.jsx"
click node_payment_pages "https://github.com/bhaveshchhimwal/popin/blob/main/client/src/pages/PaymentSuccess.jsx"
click node_guards "https://github.com/bhaveshchhimwal/popin/blob/main/client/src/route-guards/RequireAuth.jsx"
click node_api_client "https://github.com/bhaveshchhimwal/popin/blob/main/client/src/utils/axiosInstance.js"
click node_api_server "https://github.com/bhaveshchhimwal/popin/blob/main/server/index.js"
click node_user_routes "https://github.com/bhaveshchhimwal/popin/blob/main/server/routes/user.js"
click node_event_routes "https://github.com/bhaveshchhimwal/popin/blob/main/server/routes/event.js"
click node_payment_routes "https://github.com/bhaveshchhimwal/popin/blob/main/server/routes/payments.js"
click node_ticket_routes "https://github.com/bhaveshchhimwal/popin/blob/main/server/routes/ticket.js"
click node_seller_routes "https://github.com/bhaveshchhimwal/popin/blob/main/server/routes/seller.js"
click node_user_controller "https://github.com/bhaveshchhimwal/popin/blob/main/server/controllers/user.js"
click node_event_controller "https://github.com/bhaveshchhimwal/popin/blob/main/server/controllers/event.js"
click node_payment_controller "https://github.com/bhaveshchhimwal/popin/blob/main/server/controllers/payments.js"
click node_ticket_controller "https://github.com/bhaveshchhimwal/popin/blob/main/server/controllers/ticket.js"
click node_seller_controller "https://github.com/bhaveshchhimwal/popin/blob/main/server/controllers/seller.js"
click node_auth_middleware "https://github.com/bhaveshchhimwal/popin/blob/main/server/middlewares/auth.js"
click node_webhook "https://github.com/bhaveshchhimwal/popin/blob/main/server/controllers/webhook.js"
click node_database "https://github.com/bhaveshchhimwal/popin/blob/main/server/prismaClient.js"
click node_ticket_number "https://github.com/bhaveshchhimwal/popin/blob/main/server/utils/generateTicketNumber.js"
click node_email "https://github.com/bhaveshchhimwal/popin/blob/main/server/utils/emailService.js"
click node_toast "https://github.com/bhaveshchhimwal/popin/blob/main/client/src/context/ToastContext.jsx"

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_routes,node_buyer_auth,node_seller_auth,node_auth_handler,node_explore,node_event_detail,node_event_hook,node_event_create,node_profile,node_payment_pages,node_guards,node_api_client,node_toast toneBlue
class node_api_server,node_user_routes,node_event_routes,node_payment_routes,node_ticket_routes,node_seller_routes,node_user_controller,node_event_controller,node_payment_controller,node_ticket_controller,node_seller_controller,node_auth_middleware,node_webhook toneAmber
class node_database,node_ticket_number,node_email toneMint
class node_visitor,node_buyer,node_seller,node_stripe toneIndigo
```

## Components

### Client experience

- [Page routing](https://github.com/bhaveshchhimwal/popin/blob/main/client/src/routes/Routes.jsx): `client/src/routes/Routes.jsx`
- [Buyer authentication](https://github.com/bhaveshchhimwal/popin/blob/main/client/src/components/auth/authbuyer/AuthPage.jsx): `client/src/components/auth/authbuyer/AuthPage.jsx`
- [Seller authentication](https://github.com/bhaveshchhimwal/popin/blob/main/client/src/components/auth/authseller/AuthPage.jsx): `client/src/components/auth/authseller/AuthPage.jsx`
- [Auth request handler](https://github.com/bhaveshchhimwal/popin/blob/main/client/src/components/auth/authbuyer/functions/authHandler.js): `client/src/components/auth/authbuyer/functions/authHandler.js`
- [Event discovery](https://github.com/bhaveshchhimwal/popin/blob/main/client/src/pages/ExploreEvents.jsx): `client/src/pages/ExploreEvents.jsx`
- [Event details](https://github.com/bhaveshchhimwal/popin/blob/main/client/src/pages/EventDetailPage.jsx): `client/src/pages/EventDetailPage.jsx`
- [Event and booking state](https://github.com/bhaveshchhimwal/popin/blob/main/client/src/hooks/useEventDetail.js): `client/src/hooks/useEventDetail.js`
- [Event creation](https://github.com/bhaveshchhimwal/popin/blob/main/client/src/pages/EventCreatePage.jsx): `client/src/pages/EventCreatePage.jsx`
- [User and seller profiles](https://github.com/bhaveshchhimwal/popin/blob/main/client/src/pages/ProfilePage.jsx): `client/src/pages/ProfilePage.jsx`
- [Payment results](https://github.com/bhaveshchhimwal/popin/blob/main/client/src/pages/PaymentSuccess.jsx): `client/src/pages/PaymentSuccess.jsx`
- [Access guards](https://github.com/bhaveshchhimwal/popin/blob/main/client/src/route-guards/RequireAuth.jsx): `client/src/route-guards/RequireAuth.jsx`
- [HTTP client](https://github.com/bhaveshchhimwal/popin/blob/main/client/src/utils/axiosInstance.js): `client/src/utils/axiosInstance.js`
- [Toast feedback](https://github.com/bhaveshchhimwal/popin/blob/main/client/src/context/ToastContext.jsx): `client/src/context/ToastContext.jsx`

### Application server

- [HTTP API](https://github.com/bhaveshchhimwal/popin/blob/main/server/index.js): `server/index.js`
- [User endpoints](https://github.com/bhaveshchhimwal/popin/blob/main/server/routes/user.js): `server/routes/user.js`
- [Event endpoints](https://github.com/bhaveshchhimwal/popin/blob/main/server/routes/event.js): `server/routes/event.js`
- [Payment endpoints](https://github.com/bhaveshchhimwal/popin/blob/main/server/routes/payments.js): `server/routes/payments.js`
- [Ticket endpoints](https://github.com/bhaveshchhimwal/popin/blob/main/server/routes/ticket.js): `server/routes/ticket.js`
- [Seller endpoints](https://github.com/bhaveshchhimwal/popin/blob/main/server/routes/seller.js): `server/routes/seller.js`
- [User operations](https://github.com/bhaveshchhimwal/popin/blob/main/server/controllers/user.js): `server/controllers/user.js`
- [Event operations](https://github.com/bhaveshchhimwal/popin/blob/main/server/controllers/event.js): `server/controllers/event.js`
- [Checkout operations](https://github.com/bhaveshchhimwal/popin/blob/main/server/controllers/payments.js): `server/controllers/payments.js`
- [Ticket operations](https://github.com/bhaveshchhimwal/popin/blob/main/server/controllers/ticket.js): `server/controllers/ticket.js`
- [Seller operations](https://github.com/bhaveshchhimwal/popin/blob/main/server/controllers/seller.js): `server/controllers/seller.js`
- [Token authorization](https://github.com/bhaveshchhimwal/popin/blob/main/server/middlewares/auth.js): `server/middlewares/auth.js`
- [Purchase fulfillment](https://github.com/bhaveshchhimwal/popin/blob/main/server/controllers/webhook.js): `server/controllers/webhook.js`

### Persistence and services

- [Application database](https://github.com/bhaveshchhimwal/popin/blob/main/server/prismaClient.js): `server/prismaClient.js`
- [Ticket number generator](https://github.com/bhaveshchhimwal/popin/blob/main/server/utils/generateTicketNumber.js): `server/utils/generateTicketNumber.js`
- [Ticket email service](https://github.com/bhaveshchhimwal/popin/blob/main/server/utils/emailService.js): `server/utils/emailService.js`

### Other components

- **Visitor**
- **Buyer**
- **Seller**
- **Stripe**

## Connections

- Visitor → Page routing: opens pages (evidence: `client/src/routes/Routes.jsx`)
- Buyer → Buyer authentication: signs in
- Seller → Seller authentication: signs in
- Page routing → Event discovery: routes to (evidence: `client/src/routes/Routes.jsx`)
- Page routing → Event details: routes to (evidence: `client/src/routes/Routes.jsx`)
- Page routing → Event creation: routes to (evidence: `client/src/routes/Routes.jsx`)
- Page routing → User and seller profiles: routes to (evidence: `client/src/routes/Routes.jsx`)
- Page routing → Payment results: routes to (evidence: `client/src/routes/Routes.jsx`)
- Page routing → Access guards: guards routes (evidence: `client/src/routes/Routes.jsx`)
- Buyer authentication → Auth request handler: submits credentials (evidence: `client/src/components/auth/authbuyer/AuthPage.jsx`)
- Seller authentication → HTTP client: checks session (evidence: `client/src/components/auth/authseller/AuthPage.jsx`)
- Auth request handler → HTTP client: posts credentials (evidence: `client/src/components/auth/authbuyer/functions/authHandler.js`)
- Buyer authentication → Toast feedback: shows feedback (evidence: `client/src/components/auth/authbuyer/AuthPage.jsx`)
- Seller authentication → Toast feedback: shows feedback (evidence: `client/src/components/auth/authseller/AuthPage.jsx`)
- Event details → Event and booking state: uses event state (evidence: `client/src/pages/EventDetailPage.jsx`)
- Event and booking state → HTTP client: loads and books (evidence: `client/src/hooks/useEventDetail.js`)
- Event and booking state → Toast feedback: shows feedback (evidence: `client/src/hooks/useEventDetail.js`)
- HTTP client → HTTP API: sends API requests
- HTTP API → User endpoints: mounts routes (evidence: `server/index.js`)
- HTTP API → Event endpoints: mounts routes (evidence: `server/index.js`)
- HTTP API → Payment endpoints: mounts routes (evidence: `server/index.js`)
- HTTP API → Ticket endpoints: mounts routes (evidence: `server/index.js`)
- HTTP API → Seller endpoints: mounts routes (evidence: `server/index.js`)
- User endpoints → User operations: dispatches (evidence: `server/routes/user.js`)
- Event endpoints → Event operations: dispatches (evidence: `server/routes/event.js`)
- Payment endpoints → Checkout operations: dispatches (evidence: `server/routes/payments.js`)
- Payment endpoints → Purchase fulfillment: registers webhook (evidence: `server/routes/payments.js`)
- Ticket endpoints → Ticket operations: dispatches (evidence: `server/routes/ticket.js`)
- Seller endpoints → Seller operations: dispatches (evidence: `server/routes/seller.js`)
- User endpoints → Token authorization: applies auth (evidence: `server/routes/user.js`)
- Event endpoints → Token authorization: applies auth (evidence: `server/routes/event.js`)
- Payment endpoints → Token authorization: applies auth (evidence: `server/routes/payments.js`)
- Ticket endpoints → Token authorization: applies auth (evidence: `server/routes/ticket.js`)
- Seller endpoints → Token authorization: applies auth (evidence: `server/routes/seller.js`)
- User operations → Application database: reads and writes (evidence: `server/controllers/user.js`)
- Event operations → Application database: reads and writes (evidence: `server/controllers/event.js`)
- Checkout operations → Application database: uses database (evidence: `server/controllers/payments.js`)
- Ticket operations → Application database: reads and writes (evidence: `server/controllers/ticket.js`)
- Purchase fulfillment → Application database: fulfills purchase (evidence: `server/controllers/webhook.js`)
- Purchase fulfillment → Ticket number generator: generates numbers (evidence: `server/controllers/webhook.js`)
- Purchase fulfillment → Ticket email service: sends tickets (evidence: `server/controllers/webhook.js`)
- Purchase fulfillment → Stripe: verifies and refunds (evidence: `server/controllers/webhook.js`)
