# sathish126/production_50 architecture

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

- Interactive diagram: https://gitdiagram.com/sathish126/production_50
- Repository: https://github.com/sathish126/production_50

## Overview

##### Project type and purpose
- This is a full-stack event management web application.
- Frontend: React + TypeScript SPA, built with Vite, styled via Tailwind/PostCSS.
- Backend: Node.js/Express API that handles user authentication, event registration, OTP, payments, QR code generation, email notifications.
- Data stores: MongoDB for persistent data, Redis for caching/rate-limiting/OTP.
- External integrations: e-mail provider (SMTP or third-party), payment gateway (Stripe/PayPal), QR-code service.

##### File structure
Top-level
- index.html, src/, package.json, vite.config.ts, tailwind.config.js → React SPA
- server/ → Express API project
server/
- config/ (database connections: mongodb.js, redis.js)
- middleware/ (auth.js, rateLimiter.js, validation.js)
- models/ (Event, User, Registration, OTP)
- routes/ (auth.js, events.js)
- services/ (emailService, paymentService, qrService)
- templates/ (HTML for transactional emails)
- scripts/ (migrations, seeding, setup, testing)
- server.js (application entry point)
src/
- main.tsx, App.tsx → entry and root component
- context/ (AuthContext, EventContext)
- components/ (UI primitives & layout)
- pages/ (Home, Dashboard, Events, Workshops, Admin, Login, Register, Contact, About)

##### README
- Rely on file tree and conventional naming to infer responsibilities.

##### Detailed capture of essential architecture
- Client initialization → React Router loads pages → AuthContext checks token → calls Express /auth or /events.
- Express server reads .env → connects to MongoDB & Redis → routes hit middleware → controllers call services.
- On registration: paymentService.charge() → payment gateway → webhook → registration.persist() → emailService.sendConfirmation() → qrService.generate() → user receives QR + email.
- On high throughput: rateLimiter uses Redis → ensures throttle.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% Client Side
  subgraph "Client Side"
    direction TB
    BrowserSPA["Browser SPA"]:::frontend
    subgraph "React Application"
      direction TB
      Main["main.tsx"]:::frontend
      App["App.tsx"]:::frontend
      Components["components/"]:::frontend
      AuthCtx["AuthContext.tsx"]:::frontend
      EventCtx["EventContext.tsx"]:::frontend
      Pages["pages/"]:::frontend
    end
    BrowserSPA --> Main
    Main --> App
    App --> Components
    App --> AuthCtx
    App --> EventCtx
    App --> Pages
  end

  CDN["Static File Host / CDN"]:::external

  BrowserSPA -->|"HTTP(S)"| CDN

  %% Server Side
  subgraph "Server Side"
    direction TB
    APIServer["Express API Server"]:::backend

    subgraph "Configuration"
      direction TB
      MongoConfig["mongodb.js"]:::backend
      RedisConfig["redis.js"]:::backend
      DBConfig["database.js"]:::backend
    end

    subgraph "Middleware Layer"
      direction TB
      AuthMW["auth.js"]:::backend
      RateMW["rateLimiter.js"]:::backend
      ValMW["validation.js"]:::backend
    end

    subgraph "Routes / Controllers"
      direction TB
      AuthRoute["auth.js"]:::backend
      EventsRoute["events.js"]:::backend
    end

    subgraph "Services Layer"
      direction TB
      EmailSvc["emailService.js"]:::backend
      PaymentSvc["paymentService.js"]:::backend
      QRSvc["qrService.js"]:::backend
    end

    subgraph "Data Models"
      direction TB
      UserModel["User.js"]:::database
      EventModel["Event.js"]:::database
      RegModel["Registration.js"]:::database
      OTPModel["OTP.js"]:::database
    end

    subgraph "Email Templates"
      direction TB
      VerEmail["verification-email.html"]:::backend
      WelcomeEmail["welcome-email.html"]:::backend
    end

    subgraph "Scripts"
      direction TB
      Migrate["migrate.js"]:::backend
      Seed["seed.js"]:::backend
      SetupScript["setup-dev.sh"]:::backend
      TestScript["test-services.js"]:::backend
    end

    EnvExample[".env.example"]:::backend

    APIServer --> MongoConfig
    APIServer --> RedisConfig
    APIServer --> DBConfig

    APIServer --> AuthMW
    APIServer --> RateMW
    APIServer --> ValMW

    AuthMW --> AuthRoute
    RateMW --> EventsRoute
    ValMW --> AuthRoute
    ValMW --> EventsRoute

    AuthRoute --> EmailSvc
    AuthRoute --> PaymentSvc
    AuthRoute --> QRSvc
    AuthRoute --> UserModel

    EventsRoute --> EventModel
    EventsRoute --> RegModel
    EventsRoute --> OTPModel
    EventsRoute --> PaymentSvc
    EventsRoute --> EmailSvc
    EventsRoute --> QRSvc

    EmailSvc --> SMTP["Email Provider"]:::external
    PaymentSvc --> PaymentGW["Payment Gateway"]:::external
    QRSvc --> QRAPI["QR-code Service"]:::external

    UserModel --> MongoDB["MongoDB"]:::database
    EventModel --> MongoDB
    RegModel --> MongoDB
    OTPModel --> RedisCache["Redis"]:::database

    MongoConfig --> MongoDB
    RedisConfig --> RedisCache
  end

  %% Click Events
  click Main "https://github.com/sathish126/production_50/blob/main/src/main.tsx"
  click App "https://github.com/sathish126/production_50/blob/main/src/App.tsx"
  click Components "https://github.com/sathish126/production_50/tree/main/src/components/"
  click AuthCtx "https://github.com/sathish126/production_50/blob/main/src/context/AuthContext.tsx"
  click EventCtx "https://github.com/sathish126/production_50/blob/main/src/context/EventContext.tsx"
  click Pages "https://github.com/sathish126/production_50/tree/main/src/pages/"
  click CDN "https://github.com/sathish126/production_50/tree/main/dist/"
  click APIServer "https://github.com/sathish126/production_50/blob/main/server/server.js"
  click MongoConfig "https://github.com/sathish126/production_50/blob/main/server/config/mongodb.js"
  click RedisConfig "https://github.com/sathish126/production_50/blob/main/server/config/redis.js"
  click DBConfig "https://github.com/sathish126/production_50/blob/main/server/config/database.js"
  click AuthMW "https://github.com/sathish126/production_50/blob/main/server/middleware/auth.js"
  click RateMW "https://github.com/sathish126/production_50/blob/main/server/middleware/rateLimiter.js"
  click ValMW "https://github.com/sathish126/production_50/blob/main/server/middleware/validation.js"
  click AuthRoute "https://github.com/sathish126/production_50/blob/main/server/routes/auth.js"
  click EventsRoute "https://github.com/sathish126/production_50/blob/main/server/routes/events.js"
  click EmailSvc "https://github.com/sathish126/production_50/blob/main/server/services/emailService.js"
  click PaymentSvc "https://github.com/sathish126/production_50/blob/main/server/services/paymentService.js"
  click QRSvc "https://github.com/sathish126/production_50/blob/main/server/services/qrService.js"
  click UserModel "https://github.com/sathish126/production_50/blob/main/server/models/User.js"
  click EventModel "https://github.com/sathish126/production_50/blob/main/server/models/Event.js"
  click RegModel "https://github.com/sathish126/production_50/blob/main/server/models/Registration.js"
  click OTPModel "https://github.com/sathish126/production_50/blob/main/server/models/OTP.js"
  click VerEmail "https://github.com/sathish126/production_50/blob/main/server/templates/verification-email.html"
  click WelcomeEmail "https://github.com/sathish126/production_50/blob/main/server/templates/welcome-email.html"
  click Migrate "https://github.com/sathish126/production_50/blob/main/server/scripts/migrate.js"
  click Seed "https://github.com/sathish126/production_50/blob/main/server/scripts/seed.js"
  click SetupScript "https://github.com/sathish126/production_50/blob/main/server/scripts/setup-dev.sh"
  click TestScript "https://github.com/sathish126/production_50/blob/main/server/scripts/test-services.js"
  click EnvExample "https://github.com/sathish126/production_50/blob/main/server/.env.example"

  %% Styles
  classDef frontend fill:#cce5ff,stroke:#333,stroke-width:1px
  classDef backend fill:#d4edda,stroke:#333,stroke-width:1px
  classDef database fill:#fff3cd,stroke:#333,stroke-width:1px
  classDef external fill:#e2e3e5,stroke:#333,stroke-width:1px
```
