# gl-ensias-community/gl-ensias architecture

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

- Interactive diagram: https://gitdiagram.com/gl-ensias-community/gl-ensias
- Repository: https://github.com/gl-ensias-community/gl-ensias

## Overview

##### Project type and purpose
- This is a full-stack JAMstack web application built with Next.js (app directory + React components).
- It delivers marketing pages (about, blog, tools, statistics), authentication flows (signin/signup), a contact form, and an admin/dashboard interface.
- It uses Netlify for hosting + serverless functions, Drizzle ORM for database migrations, and a mail service for contact form notifications.

##### File structure
- src/app/… → Next.js 13 app-folder routing: page.tsx files drive each route (about, blog, contact, dashboard, auth, etc.).
- src/components/… → Reusable React UI components grouped by domain (Blog, Features, Contact, Header, Footer, etc.).
- public/… → Static assets: HTML fallbacks, JSON data, images, favicons.
- server/… → All backend logic:
– server/functions/api.js → Netlify serverless entrypoint(s)
– server/actions/*.js → Business logic for contact, mail
– server/db/… → Drizzle ORM schemas & migrations
– server/netlify.toml → Function configuration + build settings
- config files: next.config.js, tailwind.config.js, jsconfig.json, tsconfig.json, etc.

##### README
- Confirms Next.js template usage
- Deployment on Netlify (badge)
- Node v20.x + npm install → npm run dev

##### Detail without over-fragmenting
- Subsystem (routing, data, UI, storage, external)
- Avoid drawing every single React component – group by domain (Blog, Contact, Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Browser Layer
    subgraph "Browser / User Agent"
        Browser["Browser"]:::frontend
    end

    %% Frontend Layer
    subgraph "Frontend: Next.js Application"
        subgraph "Pages (SSR/SSG)"
            Home["Home Page"]:::frontend
            About["About Page"]:::frontend
            BlogList["Blog Listing"]:::frontend
            BlogDetails["Blog Details"]:::frontend
            BlogSidebar["Blog Sidebar"]:::frontend
            ContactPage["Contact Page"]:::frontend
            StatisticsPage["Statistics Page"]:::frontend
            ToolsPage["Tools Page"]:::frontend
        end
        subgraph "Authentication Flows"
            SignIn["Sign In"]:::frontend
            SignUp["Sign Up"]:::frontend
        end
        subgraph "Dashboard (Admin)"
            DashHome["Dashboard Home"]:::frontend
            DashLayout["Dashboard Layout"]:::frontend
            DashMeta["Dashboard MetaData"]:::frontend
            DashUsers["Dashboard Users"]:::frontend
        end
    end

    %% Backend Layer
    subgraph "Backend: API Layer (Netlify Functions)"
        API["API Entrypoint"]:::server
        ContactHandler["Contact Handler"]:::server
        MailLogic["Mail Service Logic"]:::server
    end

    %% Data Layer
    subgraph "Data Layer"
        DB[(Database)]:::database
        Schema["Schema Definitions"]:::database
        Migrations["Migrations Script"]:::database
    end

    %% External Services
    subgraph "External Services"
        Email["Email Provider"]:::external
    end

    %% Hosting Layer
    subgraph "Hosting & CDN"
        Netlify["Netlify (CDN & Functions)"]:::hosting
        StaticAssets["Static Assets"]:::hosting
    end

    %% Connections
    Browser -->|"Request Page"| Home
    Browser --> About
    Browser --> BlogList
    Browser --> BlogDetails
    Browser --> BlogSidebar
    Browser --> ContactPage
    Browser --> StatisticsPage
    Browser --> ToolsPage
    Browser --> SignIn
    Browser --> SignUp
    Browser --> DashHome

    ContactPage -->|"POST /api/contact"| API
    SignIn -->|"POST /api/auth"| API
    SignUp -->|"POST /api/auth"| API
    DashHome -->|"SSR Authenticated"| API
    API --> ContactHandler
    API --> MailLogic
    API -->|"CRUD via Drizzle"| DB
    ContactHandler --> Schema
    MailLogic --> Email

    Home --> Browser
    About --> Browser
    BlogList --> Browser
    BlogDetails --> Browser
    BlogSidebar --> Browser
    StaticAssets --> Browser

    Netlify --> Home
    Netlify --> API
    StaticAssets --> Netlify

    %% Click events
    click Home "https://github.com/gl-ensias-community/gl-ensias/blob/main/src/app/page.tsx"
    click About "https://github.com/gl-ensias-community/gl-ensias/blob/main/src/app/about/page.tsx"
    click BlogList "https://github.com/gl-ensias-community/gl-ensias/blob/main/src/app/blog/page.tsx"
    click BlogDetails "https://github.com/gl-ensias-community/gl-ensias/blob/main/src/app/blog-details/page.tsx"
    click BlogSidebar "https://github.com/gl-ensias-community/gl-ensias/blob/main/src/app/blog-sidebar/page.tsx"
    click ContactPage "https://github.com/gl-ensias-community/gl-ensias/blob/main/src/app/contact/page.tsx"
    click StatisticsPage "https://github.com/gl-ensias-community/gl-ensias/blob/main/src/app/statistics/page.tsx"
    click ToolsPage "https://github.com/gl-ensias-community/gl-ensias/blob/main/src/app/tools/page.tsx"
    click DashHome "https://github.com/gl-ensias-community/gl-ensias/blob/main/src/app/dashboard/page.tsx"
    click DashLayout "https://github.com/gl-ensias-community/gl-ensias/blob/main/src/app/dashboard/layout.tsx"
    click DashMeta "https://github.com/gl-ensias-community/gl-ensias/blob/main/src/app/dashboard/dashboardMetaData.ts"
    click DashUsers "https://github.com/gl-ensias-community/gl-ensias/blob/main/src/app/dashboard/users/page.tsx"
    click SignIn "https://github.com/gl-ensias-community/gl-ensias/blob/main/src/app/(auth)/signin/page.tsx"
    click SignUp "https://github.com/gl-ensias-community/gl-ensias/blob/main/src/app/(auth)/signup/page.tsx"
    click API "https://github.com/gl-ensias-community/gl-ensias/blob/main/server/functions/api.js"
    click ContactHandler "https://github.com/gl-ensias-community/gl-ensias/blob/main/server/actions/contact.js"
    click MailLogic "https://github.com/gl-ensias-community/gl-ensias/blob/main/server/actions/mail.js"
    click Schema "https://github.com/gl-ensias-community/gl-ensias/blob/main/server/db/schemas/contact.js"
    click Migrations "https://github.com/gl-ensias-community/gl-ensias/blob/main/server/db/migrations/migrate.js"
    click StaticAssets "https://github.com/gl-ensias-community/gl-ensias/tree/main/public/"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,color:#0366D6
    classDef server fill:#DFFFE0,stroke:#2E7D32,color:#2E7D32
    classDef database fill:#FFE7D0,stroke:#D84315,color:#D84315
    classDef external fill:#FFE0F0,stroke:#C2185B,color:#C2185B
    classDef hosting fill:#F0F0F0,stroke:#616161,color:#424242
```
