# loosechain/zenitsu architecture

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

- Interactive diagram: https://gitdiagram.com/loosechain/zenitsu
- Repository: https://github.com/loosechain/zenitsu

## Overview

##### Project type and purpose
- This is a Next.js 13 “app directory” project—a React-based, server‐rendered web application.
- From the file tree and README, its primary purpose is to provide authentication (login), a project‐wizard flow, and a dashboard UI.

##### File structure
- src/app – the Next.js routing layer:
– app/page.js: landing page
– app/auth/login/page.js: login screen
– app/project-wizard/page.js: wizard flow
– layout.js + globals.css: global layout and styling
- src/components – reusable React components:
– AuthProvider.js: context/provider for auth state
– ProjectWizard.jsx: wizard UI
– dashboard/index.jsx: dashboard view
– ui/*: primitive UI components (Button, Card, Form, etc.)
- src/lib – application logic and utilities:
– auth.js: authentication helpers (login, logout, token storage)
– utils.js: misc utilities
- public – static assets
- Config files – next.config.mjs, tailwind.config.js, postcss.config.js, eslint.config.mjs

##### README for additional insights
- No explicit backend code or database drivers are present → likely using external APIs or serverless functions behind the scenes.
- Deployment target is Vercel.

##### Elements
- Clear labels: e.g., “Browser”, “Next.js Server”, “Auth Service”, “Project API”.
– Blue rectangles for in‐process components (pages, services).
– Orange clouds for external services.

##### Detailed breakdown of components
– Client side:
- Login Page (app/auth/login/page.js) → posts credentials
- Project Wizard (app/project-wizard/page.js) → multi‐step form
- Dashboard UI (components/dashboard/index.jsx) → data visualization
– Server side:
- Routing layer (app/layout.js, app/page.js)
- AuthProvider (components/AuthProvider.js + lib/auth.js)
- Utils layer (lib/utils.js)
– Shared UI library (components/ui/*)
– Config & build: next.config.mjs, tailwind.config.js, postcss.config.js

[Browser]
↓ HTTP GET/POST
[Next.js Server]
┌───────────────────────────────────────────┐
│  Routing (src/app)                       │
│     • Login Page                         │
│     • Wizard Page                        │
│     • Dashboard                          │
│  Auth Layer (components/AuthProvider.js)│
│  Data Calls (lib/auth.js, lib/utils.js)  │
└───────────────────────────────────────────┘
↓→ Auth API (external)
↓→ Data API / DB (external)
↓→ CDN (static assets)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    Browser["Browser"]:::frontend

    %% Next.js Server
    subgraph "Next.js Server"
        direction TB
        RoutingLayer["Routing Layer (src/app)"]:::server
        LandingPage["Landing Page\n(src/app/page.js)"]:::server
        LayoutComponent["Layout Component\n(src/app/layout.js)"]:::server
        GlobalCSS["Global CSS\n(src/app/globals.css)"]:::server
        LoginPage["Login Page\n(src/app/auth/login/page.js)"]:::server
        WizardPage["Project Wizard Page\n(src/app/project-wizard/page.js)"]:::server
        AuthProvider["Auth Context Provider\n(src/components/AuthProvider.js)"]:::server
        ProjectWizardUI["Project Wizard UI Component\n(src/components/ProjectWizard.jsx)"]:::server
        DashboardUI["Dashboard UI Component\n(src/components/dashboard/index.jsx)"]:::server
        UIPrimitives["UI Primitives Library\n(src/components/ui)"]:::server
        AuthHelpers["Authentication Helpers\n(src/lib/auth.js)"]:::server
        Utils["Utility Functions\n(src/lib/utils.js)"]:::server
        Configs["Build Configurations\n(next.config.mjs, tailwind.config.js,\npostcss.config.js, eslint.config.mjs)"]:::server
    end

    %% External services
    AuthService["Auth Service (External)"]:::external
    DataAPI["External Data API / Database"]:::db
    CDN["CDN / Static Assets"]:::cdn

    %% Flows
    Browser -->|"HTTP GET/POST"| RoutingLayer
    RoutingLayer --> LandingPage
    RoutingLayer --> LoginPage
    RoutingLayer --> WizardPage
    RoutingLayer --> DashboardUI
    LandingPage --> LayoutComponent
    LoginPage --> AuthProvider
    AuthProvider --> AuthHelpers
    WizardPage --> ProjectWizardUI
    ProjectWizardUI --> Utils
    DashboardUI --> Utils

    RoutingLayer -->|"calls"| AuthService
    RoutingLayer -->|"fetch/store"| DataAPI
    RoutingLayer -->|"serves"| CDN

    %% Click Events
    click RoutingLayer "https://github.com/loosechain/zenitsu/tree/main/src/app"
    click LandingPage "https://github.com/loosechain/zenitsu/blob/main/src/app/page.js"
    click LayoutComponent "https://github.com/loosechain/zenitsu/blob/main/src/app/layout.js"
    click GlobalCSS "https://github.com/loosechain/zenitsu/blob/main/src/app/globals.css"
    click LoginPage "https://github.com/loosechain/zenitsu/blob/main/src/app/auth/login/page.js"
    click WizardPage "https://github.com/loosechain/zenitsu/blob/main/src/app/project-wizard/page.js"
    click AuthProvider "https://github.com/loosechain/zenitsu/blob/main/src/components/AuthProvider.js"
    click ProjectWizardUI "https://github.com/loosechain/zenitsu/blob/main/src/components/ProjectWizard.jsx"
    click DashboardUI "https://github.com/loosechain/zenitsu/blob/main/src/components/dashboard/index.jsx"
    click UIPrimitives "https://github.com/loosechain/zenitsu/tree/main/src/components/ui"
    click AuthHelpers "https://github.com/loosechain/zenitsu/blob/main/src/lib/auth.js"
    click Utils "https://github.com/loosechain/zenitsu/blob/main/src/lib/utils.js"
    click CDN "https://github.com/loosechain/zenitsu/tree/main/public/"
    click Configs "https://github.com/loosechain/zenitsu/blob/main/next.config.mjs"
    click Configs "https://github.com/loosechain/zenitsu/blob/main/tailwind.config.js"
    click Configs "https://github.com/loosechain/zenitsu/blob/main/postcss.config.js"
    click Configs "https://github.com/loosechain/zenitsu/blob/main/eslint.config.mjs"

    %% Styles
    classDef frontend fill:#bbf,stroke:#333,stroke-width:1px
    classDef server fill:#bfb,stroke:#333,stroke-width:1px
    classDef external fill:#f96,stroke:#333,stroke-width:1px
    classDef db fill:#9f9,stroke:#333,stroke-width:1px
    classDef cdn fill:#ffeb99,stroke:#333,stroke-width:1px
```
