# rehanalik/zcrum architecture

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

- Interactive diagram: https://gitdiagram.com/rehanalik/zcrum
- Repository: https://github.com/rehanalik/zcrum

## Overview

##### Project type and purpose
- This is a full-stack Next.js (v13+) web application that provides a project management interface (organizations, projects, issues, sprints).
- It uses the Next.js App Router (app/ directory), React components (components/), server actions (actions/), authentication pages (app/(auth)/), onboarding & main workflows (app/(main)/), and Prisma ORM (prisma/) to persist data.

##### File structure
- Top-level:
- app/ – Next.js App Router: directory-based routes, layouts, server & client components
- actions/ – server “action” modules for CRUD operations (issues, projects, sprints, organizations)
- components/ – reusable React components (UI primitives in components/ui/)
- lib/ – low-level utilities and Prisma client instantiation (lib/prisma.js, lib/utils.js)
- prisma/ – schema and migrations for database
- data/ – static JSON reference data (companies.json, status.json)
- hooks/ – client hooks (use-fetch wrapper)
- middleware.ts – Next.js middleware (e.g., for authentication guard)
- public/ – static assets
- The file structure suggests an MVC-style boundary:
- View: app/ pages & components/ React UI
- Controller → actions/ modules, Next.js route handlers, middleware.ts
- Model: Prisma schema + database

##### Key insights from README
- Bootstrapped via create-next-app.
- Uses next/font, optimized for Vercel deployment.
- No detailed architecture in README, so infer common full-stack Next.js pattern.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend Browser" 
        direction TB
        Browser["Client Browser\n(React UI Components)"]:::frontend
        Components["Components\ncomponents/"]:::frontend
        UseFetch["use-fetch Hook\nhooks/use-fetch.js"]:::frontend
    end

    %% CDN Layer
    CDN["Static CDN\npublic/"]:::persistence

    %% Backend Layer
    subgraph "Next.js App Server" 
        direction TB
        subgraph "App Router (app/)"
            direction TB
            AppLayout["app/layout.js"]:::backend
            GlobalsCSS["app/globals.css"]:::backend
            AppPage["app/page.js"]:::backend
            AuthLayout["app/(auth)/layout.js"]:::backend
            SignInPage["app/(auth)/sign-in/page.jsx"]:::backend
            SignUpPage["app/(auth)/sign-up/page.jsx"]:::backend
            MainLayout["app/(main)/layout.js"]:::backend
            OnboardingPage["app/(main)/onboarding/page.jsx"]:::backend
            OrgPage["app/(main)/organization/[orgId]/page.jsx"]:::backend
            ProjectCreatePage["app/(main)/project/create/page.jsx"]:::backend
            ProjectPage["app/(main)/project/[projectId]/page.jsx"]:::backend
            OrgComponents["org _components"]:::backend
            ProjectComponents["project _components"]:::backend
        end
        subgraph "Server Actions (actions/)"
            direction TB
            IssuesAction["actions/issues.js"]:::backend
            ProjectsAction["actions/projects.js"]:::backend
            SprintsAction["actions/sprints.js"]:::backend
            OrgsAction["actions/organizations.js"]:::backend
        end
        Middleware["middleware.ts"]:::backend
        subgraph "Utilities (lib/)"
            direction TB
            PrismaClient["lib/prisma.js"]:::backend
            Utils["lib/utils.js"]:::backend
            CheckUser["lib/checkUser.js"]:::backend
            Validators["app/lib/validators.js"]:::backend
        end
    end

    %% Persistence Layer
    subgraph "Database & ORM"
        direction TB
        PrismaSchema["prisma/schema.prisma"]:::persistence
        Migrations["prisma/migrations/20250701153708_create_tables/migration.sql\nprisma/migrations/migration_lock.toml"]:::persistence
        Database["PostgreSQL Database"]:::persistence
    end

    %% Reference Data
    Data["Reference Data\ndata/companies.json\nstatus.json"]:::persistence

    %% Configuration
    Config["Configuration & Deployment\nnext.config.mjs\npostcss.config.mjs\njsconfig.json\n.eslintrc.json\npackage.json\npackage-lock.json"]:::config

    %% External Services
    AuthProvider["External Auth Provider"]:::external

    %% Connections
    Browser -->|"HTTP GET/POST"| AppLayout
    Browser -->|"Loads Assets"| CDN
    CDN -->|Serves| Browser
    Browser <-->|"OAuth Sign-in"| AuthProvider
    AuthProvider -->|Token| Browser

    AppLayout --> AppPage
    AppPage --> IssuesAction
    AppPage --> ProjectsAction
    AppPage --> SprintsAction
    AppPage --> OrgsAction

    IssuesAction -->|CRUD Queries| PrismaClient
    ProjectsAction -->|CRUD Queries| PrismaClient
    SprintsAction -->|CRUD Queries| PrismaClient
    OrgsAction -->|CRUD Queries| PrismaClient

    PrismaClient --> PrismaSchema
    PrismaSchema --> Database
    Migrations --> Database

    AppLayout --> GlobalsCSS
    AppLayout --> Components
    AppLayout --> UseFetch

    AppLayout --> Middleware
    Middleware --> AppPage

    AppLayout --> Validators
    AppPage --> Validators

    AppLayout --> CheckUser
    CheckUser --> OrgsAction

    AppLayout --> Utils
    AppPage --> Utils

    Browser -->|"Fetch Data"| UseFetch
    UseFetch --> AppPage

    AppLayout --> Data
    AppPage --> Data

    AppLayout --> Config

    %% Click Events
    click Components "https://github.com/rehanalik/zcrum/tree/master/components/"
    click UseFetch "https://github.com/rehanalik/zcrum/blob/master/hooks/use-fetch.js"
    click AppLayout "https://github.com/rehanalik/zcrum/blob/master/app/layout.js"
    click GlobalsCSS "https://github.com/rehanalik/zcrum/blob/master/app/globals.css"
    click AppPage "https://github.com/rehanalik/zcrum/blob/master/app/page.js"
    click AuthLayout "https://github.com/rehanalik/zcrum/blob/master/app/(auth)/layout.js"
    click SignInPage "https://github.com/rehanalik/zcrum/blob/master/app/(auth)/sign-in/[[...sign-in]]/page.jsx"
    click SignUpPage "https://github.com/rehanalik/zcrum/blob/master/app/(auth)/sign-up/[[...sign-up]]/page.jsx"
    click MainLayout "https://github.com/rehanalik/zcrum/blob/master/app/(main)/layout.js"
    click OnboardingPage "https://github.com/rehanalik/zcrum/blob/master/app/(main)/onboarding/[[...onboarding]]/page.jsx"
    click OrgPage "https://github.com/rehanalik/zcrum/blob/master/app/(main)/organization/[orgId]/page.jsx"
    click ProjectCreatePage "https://github.com/rehanalik/zcrum/blob/master/app/(main)/project/create/page.jsx"
    click ProjectPage "https://github.com/rehanalik/zcrum/blob/master/app/(main)/project/[projectId]/page.jsx"
    click OrgComponents "https://github.com/rehanalik/zcrum/tree/master/app/(main)/organization/_components/"
    click ProjectComponents "https://github.com/rehanalik/zcrum/tree/master/app/(main)/project/_components/"
    click IssuesAction "https://github.com/rehanalik/zcrum/blob/master/actions/issues.js"
    click ProjectsAction "https://github.com/rehanalik/zcrum/blob/master/actions/projects.js"
    click SprintsAction "https://github.com/rehanalik/zcrum/blob/master/actions/sprints.js"
    click OrgsAction "https://github.com/rehanalik/zcrum/blob/master/actions/organizations.js"
    click Middleware "https://github.com/rehanalik/zcrum/blob/master/middleware.ts"
    click PrismaClient "https://github.com/rehanalik/zcrum/blob/master/lib/prisma.js"
    click Utils "https://github.com/rehanalik/zcrum/blob/master/lib/utils.js"
    click CheckUser "https://github.com/rehanalik/zcrum/blob/master/lib/checkUser.js"
    click Validators "https://github.com/rehanalik/zcrum/blob/master/app/lib/validators.js"
    click PrismaSchema "https://github.com/rehanalik/zcrum/blob/master/prisma/schema.prisma"
    click Migrations "https://github.com/rehanalik/zcrum/blob/master/prisma/migrations/20250701153708_create_tables/migration.sql"
    click Data "https://github.com/rehanalik/zcrum/blob/master/data/companies.json"
    click Data "https://github.com/rehanalik/zcrum/blob/master/data/status.json"
    click Config "https://github.com/rehanalik/zcrum/blob/master/next.config.mjs"

    %% Styles
    classDef frontend fill:#add8e6,stroke:#1f77b4,color:#000
    classDef backend fill:#98fb98,stroke:#2ca02c,color:#000
    classDef persistence fill:#ffcc99,stroke:#ff7f0e,color:#000
    classDef external fill:#d3d3d3,stroke:#7f7f7f,color:#000
    classDef config fill:#e0bbff,stroke:#9467bd,color:#000
```
