# taiba275/fyp architecture

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

- Interactive diagram: https://gitdiagram.com/taiba275/fyp
- Repository: https://github.com/taiba275/fyp

## Overview

##### Project type and purpose
- This is a full-stack React/Next.js application (bootstrapped with create-next-app) that provides:
- A set of SSR/SSG web pages (Home, Jobs listing/detail, Login, Signup, UserProfile)
- A Next.js “app router” API layer for authentication, job data and posts
- A MongoDB backend for persisting Users, Jobs, Posts
- TailwindCSS for styling and static assets served from public/

##### File structure
- Top-level:
- public/Images – static assets
- src/app/… – Next.js app directory containing route‐based pages and API endpoints
- src/app/api/[…] – API route groups: auth (login/signup), jobs, posts
- src/app/models – Mongoose models (Job.js, User.js)
- src/library/mongodb.js – MongoDB connection helper
- Config/build files:
- next.config.mjs, jsconfig.json, postcss.config.mjs, tailwind.config.mjs
- .env for secrets, .gitignore for ignores
- No separate “backend” microservice—Next.js API routes live alongside the front end.

##### README for additional insights
- Confirms Next.js framework, development commands, Vercel deployment
- Uses next/font, auto-optimized fonts (Geist)

##### Detail
- Environment variables (in .env) feeding into mongodb.js

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer" 
        direction TB
        HomePage["Home Page"]:::ui
        click HomePage "https://github.com/taiba275/fyp/blob/main/src/app/page.js"
        HomeClient["Home Client Enhancements"]:::ui
        click HomeClient "https://github.com/taiba275/fyp/blob/main/src/app/HomeClient.js"
        JobDetailPage["Job Detail Page"]:::ui
        click JobDetailPage "https://github.com/taiba275/fyp/blob/main/src/app/jobs/[id]/page.js"
        LoginPage["Login Page"]:::ui
        click LoginPage "https://github.com/taiba275/fyp/blob/main/src/app/login/page.js"
        SignupPage["Signup Page"]:::ui
        click SignupPage "https://github.com/taiba275/fyp/blob/main/src/app/signup/page.js"
        ProfilePage["User Profile Page"]:::ui
        click ProfilePage "https://github.com/taiba275/fyp/blob/main/src/app/UserProfile/page.js"
        subgraph "Components" 
            direction TB
            Header["Header"]:::ui
            click Header "https://github.com/taiba275/fyp/blob/main/src/app/components/Header.js"
            Footer["Footer"]:::ui
            click Footer "https://github.com/taiba275/fyp/blob/main/src/app/components/Footer.js"
            Hero["Home Hero"]:::ui
            click Hero "https://github.com/taiba275/fyp/blob/main/src/app/components/Home/Hero.js"
            Filter["Home Filter"]:::ui
            click Filter "https://github.com/taiba275/fyp/blob/main/src/app/components/Home/Filter.js"
            PostsComp["Home Posts"]:::ui
            click PostsComp "https://github.com/taiba275/fyp/blob/main/src/app/components/Home/Posts.js"
            ScrollTop["ScrollToTop"]:::ui
            click ScrollTop "https://github.com/taiba275/fyp/blob/main/src/app/components/Home/ScrollToTop.js"
        end
    end

    %% Server Layer
    subgraph "Next.js Server" 
        direction TB
        Layout["App Layout"]:::server
        click Layout "https://github.com/taiba275/fyp/blob/main/src/app/layout.js"
        GlobalsCSS["Global Styles"]:::server
        click GlobalsCSS "https://github.com/taiba275/fyp/blob/main/src/app/globals.css"
        subgraph "API Handler"
            direction TB
            subgraph "Auth API"
                direction TB
                LoginAPI["Login Endpoint"]:::server
                click LoginAPI "https://github.com/taiba275/fyp/blob/main/src/app/api/auth/login/route.js"
                SignupAPI["Signup Endpoint"]:::server
                click SignupAPI "https://github.com/taiba275/fyp/blob/main/src/app/api/auth/signup/route.js"
            end
            subgraph "Jobs API"
                direction TB
                JobAPI["Job Detail Endpoint"]:::server
                click JobAPI "https://github.com/taiba275/fyp/blob/main/src/app/api/jobs/[id]/route.js"
            end
            subgraph "Posts API"
                direction TB
                PostsAPI["Posts Endpoint"]:::server
                click PostsAPI "https://github.com/taiba275/fyp/blob/main/src/app/api/posts/route.js"
            end
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        MongoHelper["mongodb.js"]:::data
        click MongoHelper "https://github.com/taiba275/fyp/blob/main/src/library/mongodb.js"
        UserModel["User Model"]:::data
        click UserModel "https://github.com/taiba275/fyp/blob/main/src/app/models/User.js"
        JobModel["Job Model"]:::data
        click JobModel "https://github.com/taiba275/fyp/blob/main/src/app/models/Job.js"
        DB[(MongoDB Cluster)]:::data
    end

    %% Static Assets
    StaticAssets["Static Assets (public/Images)"]:::infra
    click StaticAssets "https://github.com/taiba275/fyp/tree/main/public/Images"

    %% Build & Deployment
    Build["Next.js Build"]:::infra
    Config["Configuration Files"]:::infra
    click Config "https://github.com/taiba275/fyp/blob/main/next.config.mjs"
    CDNT["CDN"]:::infra
    Vercel["Vercel Platform"]:::infra

    %% Relationships
    HomePage -->|renders| Layout
    HomePage -->|fetches API| LoginAPI
    HomePage -->|fetches API| JobAPI
    HomePage -->|fetches API| PostsAPI
    LoginPage -->|calls| LoginAPI
    SignupPage -->|calls| SignupAPI
    ProfilePage -->|calls| PostsAPI

    Layout -->|uses| Header
    Layout -->|uses| Footer
    Layout -->|uses| GlobalsCSS

    LoginAPI -->|uses| MongoHelper
    SignupAPI -->|uses| MongoHelper
    JobAPI -->|uses| MongoHelper
    PostsAPI -->|uses| MongoHelper

    MongoHelper -->|connects| DB
    UserModel -->|maps| DB
    JobModel -->|maps| DB

    Build -->|outputs| CDNT
    Build -->|deploys| Vercel
    Vercel -->|hosts| DB
    Vercel -->|serves| StaticAssets

    %% Styles
    classDef ui fill:#DAE8FC,stroke:#6C8EBF,color:#1F4E79;
    classDef server fill:#D5E8D4,stroke:#82B366,color:#274E13;
    classDef data fill:#FFE6CC,stroke:#D79B00,color:#663C00;
    classDef infra fill:#E8E8E8,stroke:#AFAFAF,color:#4A4A4A;
```
