# mobakour/peeko architecture

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

- Interactive diagram: https://gitdiagram.com/mobakour/peeko
- Repository: https://github.com/mobakour/peeko

## Overview

##### Project type and purpose
- Peeko is a full-stack social media web application (short video reels) built with the MERN stack (MongoDB, Express, React, Node) plus AWS S3 for video storage and an email service for account verification.
- Users can register/login, upload videos, comment/like/share infinite-scroll feeds, and view profiles.

##### File structure
- Top-level directories:
- client/ – React front end
- server/ – Node/Express TypeScript back end
- client/src: React entry points (index.jsx, App.jsx), pages (Auth, Home, Profile, Video, NotFound), shared components, custom hooks, global state stores (Zustand or similar).
- server/src: Express app, controllers (video, comment, user, feedback), middleware (auth, file upload via multer, resource checks), Mongoose models (User, Video, Comment), utils (mailer, S3, validation), type definitions.
- Config/build files: client package.json + Tailwind, server tsconfig.json + nodemon.json + api.md.

##### README for additional insights
- Confirms technologies: React + TailwindCSS, Node + Express in TypeScript, MongoDB via Mongoose, AWS S3 for video, SMTP or AWS SES for email.
- Features: authentication, email verification, file uploads, social interactions (comment/like/share), infinite scroll.

##### Diagramming conventions & elements
- Use clear labels: e.g., “React Client,” “Express API,” “MongoDB,” “AWS S3,” “SMTP Service.”
- Blue rectangles for frontend components.
- Green rectangles for backend modules.
- Annotations:
- Ports (e.g., 3000 for client, 5000 for server).
- Authentication flow (login → JWT issuance → protected endpoints).

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Frontend (Browser)"
        ReactClient["React Client UI"]:::frontend
        Tailwind["TailwindCSS Config"]:::frontend
        State["State Management (Zustand)"]:::frontend
        Hooks["Custom Hooks"]:::frontend
        Pages["Pages & Components"]:::frontend
    end

    subgraph "Backend (API Server)"
        App["Express App"]:::backend
        subgraph "Middleware Pipeline"
            Auth["Authentication Middleware"]:::backend
            CheckRes["Resource & Validation Middleware"]:::backend
            Multer["File Upload Middleware"]:::backend
        end
        subgraph "Controllers"
            Controllers["Users/Videos/Comments/Feedback Controllers"]:::backend
        end
        subgraph "Utilities"
            S3["AWS S3 Utility"]:::backend
            Mailer["Email Service Utility"]:::backend
            Validation["Validation Utilities"]:::backend
            Utils["Shared Server Utilities"]:::backend
        end
        subgraph "Data Definitions"
            Models["Mongoose Models"]:::backend
            Types["Type Definitions"]:::backend
            API_DOC["API Documentation"]:::backend
        end
    end

    DB["MongoDB"]:::database
    S3Bucket["AWS S3 Bucket"]:::storage
    EmailSvc["Email Service (SMTP/SES)"]:::external

    ReactClient -->|"HTTPS REST"| App
    App --> Auth
    Auth --> CheckRes
    CheckRes --> Multer
    Multer --> Controllers
    Controllers --> Models
    Controllers --> S3Bucket
    Controllers -.->|"send email"| EmailSvc
    Controllers --> Utils
    Controllers --> Validation
    Models --> DB

    classDef frontend fill:#D0E8FF,stroke:#333,stroke-width:1px
    classDef backend fill:#DFFFD0,stroke:#333,stroke-width:1px
    classDef database fill:#FFE8D0,stroke:#333,stroke-width:1px
    classDef storage fill:#E8D0FF,stroke:#333,stroke-width:1px
    classDef external fill:#F0D0D0,stroke:#333,stroke-width:1px

    click ReactClient "https://github.com/mobakour/peeko/tree/main/client/src/"
    click Tailwind "https://github.com/mobakour/peeko/blob/main/client/tailwind.config.js"
    click State "https://github.com/mobakour/peeko/tree/main/client/src/store/"
    click Hooks "https://github.com/mobakour/peeko/tree/main/client/src/hooks/"
    click Pages "https://github.com/mobakour/peeko/tree/main/client/src/pages/"
    click Pages "https://github.com/mobakour/peeko/tree/main/client/src/components/"
    click App "https://github.com/mobakour/peeko/blob/main/server/src/app.ts"
    click Controllers "https://github.com/mobakour/peeko/tree/main/server/src/controllers/"
    click Auth "https://github.com/mobakour/peeko/blob/main/server/src/middleware/authentication.ts"
    click CheckRes "https://github.com/mobakour/peeko/blob/main/server/src/middleware/checkResourceExists.ts"
    click Multer "https://github.com/mobakour/peeko/blob/main/server/src/middleware/multer.ts"
    click Models "https://github.com/mobakour/peeko/tree/main/server/src/models/"
    click S3 "https://github.com/mobakour/peeko/blob/main/server/src/utils/s3.ts"
    click Mailer "https://github.com/mobakour/peeko/blob/main/server/src/utils/mailer.ts"
    click Validation "https://github.com/mobakour/peeko/blob/main/server/src/utils/validation.ts"
    click Utils "https://github.com/mobakour/peeko/blob/main/server/src/utils/utils.ts"
    click Types "https://github.com/mobakour/peeko/blob/main/server/src/types/types.d.ts"
    click API_DOC "https://github.com/mobakour/peeko/blob/main/server/api.md"
```
