# aarlyup/aarlytech architecture

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

- Interactive diagram: https://gitdiagram.com/aarlyup/aarlytech
- Repository: https://github.com/aarlyup/aarlytech

## Overview

##### Project type and purpose
- This is a full-stack MERN (MongoDB, Express, React, Node.js) web application called “Aarly” for startup funding discovery. It provides a React/Vite/Tailwind-based frontend, a Node/Express/MongoDB backend, and integrates with several external services (email, OAuth, file storage, WhatsApp).

##### File structure
- Top-level:
- `src/` – React application (TypeScript, Vite, Tailwind)
- `public/` & `index.html` – static assets and root HTML
- `server/` – Express API server with MVC organization:
– `controllers/`, `models/`, `routes/`, `middleware/`, `config/`, `utils/`
- Config files: `.env.example`, `netlify.toml`, `vite.config.ts`, `tsconfig*.json`, `postcss.config.js`, `tailwind.config.js`
- Backend uses environment-based config, Passport.js for Google OAuth, JWT auth, Mongoose models for various entities (User, Funding sources, Newsletter, WhatsApp, etc.).
- Frontend uses React Router, Contexts for Auth/Funding/UI state, UI components under `components/`, pages under `pages/`, API client in `src/config/api.ts`.

##### README for additional insights
- Tech stack summary, features, setup instructions, and a list of API endpoints.
- Authentication (OTP, JWT, Google OAuth), funding discovery, investor matching, news, resource library, user dashboard.

##### Detailed break-down of components
- UI Layout (Header, Footer, Sidebar)
- Pages & Routes (Home, Funding pages, Admin Dashboard, Auth)
- Context Providers (AuthContext, FundingContext, UiContext)
- API Client (`src/config/api.ts`)
- Routing layer (`server/routes/*.js`)
- Controller layer (`server/controllers/*.js`)
- Model layer (`server/models/*.js`)
- Middleware (`auth`, `adminAuth`, `errorHandler`)
- Config modules (database, passport, cloudinary, WhatsApp)
- Utility modules (email, JWT)
- External services cluster:
- Google OAuth
- Resend (email)
- Cloudinary (images)
- WhatsApp API

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Layers
    Browser["User's Browser"]:::external

    subgraph "Frontend (React SPA)"
        SPAHTML["public/index.html"]:::frontend
        MainTSX["src/main.tsx"]:::frontend
        App["src/App.tsx"]:::frontend
        Router["src/routes.tsx"]:::frontend
        APIClient["src/config/api.ts"]:::frontend
        AuthContext["src/contexts/AuthContext.tsx"]:::frontend
        FundingContext["src/contexts/FundingContext.tsx"]:::frontend
        UiContext["src/contexts/UiContext.tsx"]:::frontend
        UIComponents["src/components/ui/"]:::frontend
        LayoutComponents["src/components/layout/"]:::frontend
        HomeComponents["src/components/home/"]:::frontend
        AdminComponents["src/components/admin/"]:::frontend
        AuthComponents["src/components/auth/"]:::frontend
        Pages["src/pages/"]:::frontend
        ViteConfig["vite.config.ts"]:::frontend
        TailwindConfig["tailwind.config.js"]:::frontend
        PostCSSConfig["postcss.config.js"]:::frontend
    end

    subgraph "Backend (Express API)"
        ServerEntry["server/server.js"]:::backend
        EnvExamples[".env.example & server/.env.example"]:::backend
        ConfigDB["server/config/database.js"]:::backend
        ConfigPassport["server/config/passport.js"]:::backend
        ConfigCloudinary["server/config/cloudinary.js"]:::backend
        ConfigWhatsApp["server/config/whatsapp.js"]:::backend
        Routes["server/routes/"]:::backend
        Controllers["server/controllers/"]:::backend
        Models["server/models/"]:::backend
        Middleware["server/middleware/"]:::backend
        Utils["server/utils/"]:::backend
    end

    DB["MongoDB Atlas / Local"]:::db

    subgraph "Third-Party Services"
        OAuth["Google OAuth"]:::thirdparty
        Resend["Resend Email API"]:::thirdparty
        Cloudinary["Cloudinary"]:::thirdparty
        WhatsApp["WhatsApp API"]:::thirdparty
    end

    StaticHost["Netlify (Static Hosting)"]:::static

    %% Connections
    Browser --> SPAHTML
    Browser --> MainTSX
    SPAHTML --> MainTSX
    MainTSX --> App
    App --> Router
    Router --> Pages
    Pages --> APIClient
    APIClient --> ServerEntry
    ServerEntry --> EnvExamples
    ServerEntry --> ConfigDB
    ServerEntry --> ConfigPassport
    ServerEntry --> ConfigCloudinary
    ServerEntry --> ConfigWhatsApp
    ServerEntry --> Routes
    Routes --> Controllers
    Controllers --> Models
    Controllers --> Utils
    Controllers --> Middleware
    ConfigDB --> DB
    Controllers --> DB
    Controllers --> OAuth
    Controllers --> Resend
    Controllers --> Cloudinary
    Controllers --> WhatsApp
    StaticHost -.-> SPAHTML

    %% Click Events
    click SPAHTML "https://github.com/aarlyup/aarlytech/blob/main/public/index.html"
    click MainTSX "https://github.com/aarlyup/aarlytech/blob/main/src/main.tsx"
    click App "https://github.com/aarlyup/aarlytech/blob/main/src/App.tsx"
    click Router "https://github.com/aarlyup/aarlytech/blob/main/src/routes.tsx"
    click APIClient "https://github.com/aarlyup/aarlytech/blob/main/src/config/api.ts"
    click AuthContext "https://github.com/aarlyup/aarlytech/blob/main/src/contexts/AuthContext.tsx"
    click FundingContext "https://github.com/aarlyup/aarlytech/blob/main/src/contexts/FundingContext.tsx"
    click UiContext "https://github.com/aarlyup/aarlytech/blob/main/src/contexts/UiContext.tsx"
    click UIComponents "https://github.com/aarlyup/aarlytech/tree/main/src/components/ui/"
    click LayoutComponents "https://github.com/aarlyup/aarlytech/tree/main/src/components/layout/"
    click HomeComponents "https://github.com/aarlyup/aarlytech/tree/main/src/components/home/"
    click AdminComponents "https://github.com/aarlyup/aarlytech/tree/main/src/components/admin/"
    click AuthComponents "https://github.com/aarlyup/aarlytech/tree/main/src/components/auth/"
    click Pages "https://github.com/aarlyup/aarlytech/tree/main/src/pages/"
    click ViteConfig "https://github.com/aarlyup/aarlytech/blob/main/vite.config.ts"
    click TailwindConfig "https://github.com/aarlyup/aarlytech/blob/main/tailwind.config.js"
    click PostCSSConfig "https://github.com/aarlyup/aarlytech/blob/main/postcss.config.js"
    click ServerEntry "https://github.com/aarlyup/aarlytech/blob/main/server/server.js"
    click EnvExamples "https://github.com/aarlyup/aarlytech/blob/main/.env.example"
    click ConfigDB "https://github.com/aarlyup/aarlytech/blob/main/server/config/database.js"
    click ConfigPassport "https://github.com/aarlyup/aarlytech/blob/main/server/config/passport.js"
    click ConfigCloudinary "https://github.com/aarlyup/aarlytech/blob/main/server/config/cloudinary.js"
    click ConfigWhatsApp "https://github.com/aarlyup/aarlytech/blob/main/server/config/whatsapp.js"
    click Routes "https://github.com/aarlyup/aarlytech/tree/main/server/routes/"
    click Controllers "https://github.com/aarlyup/aarlytech/tree/main/server/controllers/"
    click Models "https://github.com/aarlyup/aarlytech/tree/main/server/models/"
    click Middleware "https://github.com/aarlyup/aarlytech/tree/main/server/middleware/"
    click Utils "https://github.com/aarlyup/aarlytech/tree/main/server/utils/"

    %% Styles
    classDef frontend fill:#E3F2FD,stroke:#1E88E5,color:#0D47A1;
    classDef backend fill:#E8F5E9,stroke:#43A047,color:#1B5E20;
    classDef db fill:#FFF3E0,stroke:#FB8C00,color:#E65100;
    classDef thirdparty fill:#F3E5F5,stroke:#8E24AA,color:#4A148C;
    classDef static fill:#ECEFF1,stroke:#607D8B,color:#263238;
    classDef external fill:#CFD8DC,stroke:#546E7A,color:#263238;
```
