# creativetimofficial/notus-nextjs architecture

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

- Interactive diagram: https://gitdiagram.com/creativetimofficial/notus-nextjs
- Repository: https://github.com/creativetimofficial/notus-nextjs

## Overview

##### Main Components
- NextJS Framework Core – at the heart of the application, providing routing, server-side rendering, and page management.
- Presentation Layer – this includes the public and landing pages (such as index.js, landing.js, profile.js, and 404/_error pages) that form the website’s front-facing interface.
- Admin Dashboard – under the “pages/admin” directory, there are dashboard, maps, settings, and tables pages. Also note that there’s a dedicated "layouts/Admin.js" file for admin-specific structure.
- Authentication Module – under the “pages/auth” directory for login and register pages, plus an “layouts/Auth.js” file that provides layout for these pages.
- Reusable Components – a major folder, “components”, provides granular UI elements such as Cards (various card components), Dropdowns, Navbars (Admin, Auth, and Index), Footers, Headers, Sidebar, Maps, and PageChange. These pre-built UI pieces are used throughout the application to maintain consistency.
- Static Assets and Styling – the “public” directory holds images (branding assets), while “styles” and Tailwind configuration files (tailwind.config.js) manage the styling strategies.

##### Out the Relationships and Interactions
- At the core, each “page” (whether admin, auth, landing, or error pages) imports the relevant layout (Admin.js, Auth.js, or a default layout) which then composes the various UI components.
- The reusable UI components (cards, dropdowns, etc.) are integrated within the page structures to render specific content and perform dynamic behavior.
- The NextJS routing mechanism (via “pages” directory) automatically creates routes that map to these UI components and layouts.
- The Tailwind CSS system defines the styling and theming across all components, ensuring consistency through globally imported styles.

##### Architectural Patterns
- Component-Based Design: The project uses a modular approach, separating concerns into reusable components.
- Layout Abstraction: Distinct layout components for admin and auth allow for base templates tailored for different types of pages.
- Convention-over-Configuration: The NextJS file structure is used to automatically generate routing, reflecting a clear MVC-like separation (pages as views and components as view elements).
- Styling via Tailwind CSS: A utility-first CSS framework that streamlines design while allowing dynamic class management and reusability.

##### Relevant Technologies and Frameworks
- NextJS (for server-side rendering, routing, and overall React framework enhancements)
- React (as Notus NextJS is built on React components)
- Tailwind CSS (for styling and design consistency)
- Possibly additional client-side libraries (e.g., for charting within card components, although not explicitly called out, they’re likely integrated in components like CardBarChart and CardLineChart).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Layer
    subgraph "NextJS Framework Core"
        N1["next.config.js"]:::core
        N2["pages/_app.js"]:::core
        N3["pages/_document.js"]:::core
    end

    %% NextJS Router
    R["NextJS Router"]:::core

    %% Link Core to Router
    N1 --> R
    N2 --> R
    N3 --> R

    %% Presentation Tier
    subgraph "Presentation Tier"
        P1["pages/index.js"]:::tier
        P2["pages/landing.js"]:::tier
        P3["pages/profile.js"]:::tier
        P4["pages/404.js"]:::tier
        P5["pages/_error.js"]:::tier
    end

    %% Admin Tier
    subgraph "Admin Tier"
        ADL["layouts/Admin.js"]:::tier
        AD1["pages/admin/dashboard.js"]:::tier
        AD2["pages/admin/maps.js"]:::tier
        AD3["pages/admin/settings.js"]:::tier
        AD4["pages/admin/tables.js"]:::tier
    end

    %% Authentication Tier
    subgraph "Authentication Tier"
        AUL["layouts/Auth.js"]:::tier
        AU1["pages/auth/login.js"]:::tier
        AU2["pages/auth/register.js"]:::tier
    end

    %% Reusable Components
    RC["Reusable Components (Cards, Dropdowns, Navbars, etc.)"]:::component

    %% Static Assets and Styling
    SA["Static Assets & Styling (Tailwind CSS, Images, Styles)"]:::asset

    %% Data Flow Connections
    R -->|"routes to"| P1
    R --> P2
    R --> P3
    R --> P4
    R --> P5
    R --> ADL
    R --> AD1
    R --> AD2
    R --> AD3
    R --> AD4
    R --> AUL
    R --> AU1
    R --> AU2

    %% Layouts incorporate Reusable Components
    ADL -->|"includes"| RC
    AUL -->|"includes"| RC
    P1 -->|"uses components"| RC
    P2 -->|"uses components"| RC
    P3 -->|"uses components"| RC
    P4 -->|"uses components"| RC
    P5 -->|"uses components"| RC

    %% Styling flows into UI
    SA --> RC

    %% Styles
    classDef core fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;
    classDef tier fill:#AED6F1,stroke:#3498DB,stroke-width:2px;
    classDef component fill:#A9DFBF,stroke:#27AE60,stroke-width:2px;
    classDef asset fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;

    %% Click Events for NextJS Framework Core
    click N1 "https://github.com/creativetimofficial/notus-nextjs/blob/main/next.config.js"
    click N2 "https://github.com/creativetimofficial/notus-nextjs/blob/main/pages/_app.js"
    click N3 "https://github.com/creativetimofficial/notus-nextjs/blob/main/pages/_document.js"

    %% Click Events for Presentation Tier
    click P1 "https://github.com/creativetimofficial/notus-nextjs/blob/main/pages/index.js"
    click P2 "https://github.com/creativetimofficial/notus-nextjs/blob/main/pages/landing.js"
    click P3 "https://github.com/creativetimofficial/notus-nextjs/blob/main/pages/profile.js"
    click P4 "https://github.com/creativetimofficial/notus-nextjs/blob/main/pages/404.js"
    click P5 "https://github.com/creativetimofficial/notus-nextjs/blob/main/pages/_error.js"

    %% Click Events for Admin Dashboard
    click ADL "https://github.com/creativetimofficial/notus-nextjs/blob/main/layouts/Admin.js"
    click AD1 "https://github.com/creativetimofficial/notus-nextjs/blob/main/pages/admin/dashboard.js"
    click AD2 "https://github.com/creativetimofficial/notus-nextjs/blob/main/pages/admin/maps.js"
    click AD3 "https://github.com/creativetimofficial/notus-nextjs/blob/main/pages/admin/settings.js"
    click AD4 "https://github.com/creativetimofficial/notus-nextjs/blob/main/pages/admin/tables.js"

    %% Click Events for Authentication Module
    click AUL "https://github.com/creativetimofficial/notus-nextjs/blob/main/layouts/Auth.js"
    click AU1 "https://github.com/creativetimofficial/notus-nextjs/blob/main/pages/auth/login.js"
    click AU2 "https://github.com/creativetimofficial/notus-nextjs/blob/main/pages/auth/register.js"

    %% Click Event for Reusable Components
    click RC "https://github.com/creativetimofficial/notus-nextjs/tree/main/components"

    %% Click Events for Static Assets and Styling
    click SA "https://github.com/creativetimofficial/notus-nextjs/tree/main/styles"
    click SA "https://github.com/creativetimofficial/notus-nextjs/blob/main/tailwind.config.js"
    click SA "https://github.com/creativetimofficial/notus-nextjs/tree/main/public/img/brand"
```
