# nawapons/project-manager architecture

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

- Interactive diagram: https://gitdiagram.com/nawapons/project-manager
- Repository: https://github.com/nawapons/project-manager

## Overview

##### Project Type & Purpose
- Type: Full-stack project management tool.
- Purpose: To enable teams to manage workspaces, projects, tasks, and user accounts, with an architecture similar to Jira.
- Technology Stack: Next.js (for both the frontend and the backend API routes), React components (in “src/components” and “src/features”), Tailwind CSS (suggested by tailwind.config.js), and integration with Supabase (as seen in the “src/utils/supabase” folder).

##### Analyzing the File Structure
- Major Directories:
– src/app: Contains the Next.js application’s routing, both pages and layouts. It is further separated into groups like (dashboard) and (standalone) to differentiate between authenticated views (dashboard) and public or unauthenticated views (standalone).
– src/api: Represents API endpoints for account, auth, member, project, task, and workspace functionalities. Each of these APIs is implemented in a route-based manner using Next.js API routes.
– src/features: Contains feature-specific code (account, analytics, auth, dashboard, member, projects, tasks, workspaces). This folder also includes hooks, API utilities, and UI components specific to different features.
– src/components: Houses generic UI components and a few specific ones (like the next-logo).
– Other directories: “src/lib”, “src/utils”, “src/schema” – which hold utilities, library functions, and schema definitions respectively.
- Architectural Patterns:
– Next.js routing and file-based API endpoints – suggest a modular MVC/MVVM-like structure.
– Separation of component (UI) concerns from feature business logic.
– Clear separation between dashboard (authenticated workspace) views and standalone public pages for auth, account recovery, or workspace joining.
– Use of reusable components and hooks (situated in the “src/hooks” and “src/features” directories) to abstract business logic.

##### Additional Insights from the README
- Despite its brevity, the README’s mention “Project - manager inspire by Jira, Demo (version)” directly tells us this is a demo version of a project management tool built with Jira-like functionalities.

a. Main Components:
- Frontend Application:
- Pages: Organized within the “src/app” directory under (dashboard) and (standalone) with layouts and routing.
- UI Components: From “src/components” and “src/features/*/components”.
- Client-Side State and Logic: Custom hooks, query providers, and contextual providers (ex. src/features/query-provider.jsx).
- Backend/API Endpoints:
- Account, Auth, Project, Task, and Workspace related endpoints (located in “src/app/api”).
- These endpoints handle CRUD operations along with specific actions like analytics, bulk updates, join invites, etc.
- Database & Schema:
- Schema definitions for project, task, user, and workspace in “src/schema”.
- The utility files for Supabase (client, server, middleware) in “src/utils/supabase” indicate a backend connection to a database via Supabase.
- External Services:
- Supabase integration for authentication and database actions.
- Possibly third-party services for additional authentication (Google, as indicated by “use-google.login.js”).
b. Relationships & Interactions:
- User Interface interacts with API endpoints through HTTP requests from client-side code.
- The front-end routing differentiates between logged-in (dashboard) and public (standalone) areas.
- API endpoints connect to the database, using schema validations, to perform data operations.
- API routes for tasks, projects, workspaces interconnect as a user navigates or performs complex actions (e.g., project member addition, bulk task updates).
- The Supabase layer is used to manage authentication and data persistence.
c. Architectural Patterns & Design Principles:
- Modular design: Each feature (account, auth, tasks, etc.) is very self-contained.
- Separation of concerns: Clear boundary between UI components, business logic (hooks), and API endpoints.
- File-based routing: Next.js conventions utilized intensively.
- API-first approach: With robust endpoints split by functionality.
d. Relevant Technologies/Frameworks/Libraries:
- Next.js
- React
- Tailwind CSS (for styling)
- Supabase (for backend data management and authentication)
- ESLint (project linting configuration)
- Possibly PostCSS (for CSS processing)

##### Final Advice
- Integration points with third-party services (like Supabase) along with any client-side libraries (e.g., hooks and UI component libraries).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Nodes
    User["User"]

    subgraph "Frontend Components"
      FS1["Dashboard Routing & Layouts"]
      FS2["Standalone Routing & Layouts"]
      FS3["Dashboard Pages (Workspaces/Projects/Tasks)"]
      FS4["Account Pages"]
      FS5["Reset Password Page"]
      FS6["UI Components & Shared Elements"]
      FS7["Feature Business Logic & Hooks"]
    end

    subgraph "Backend API Endpoints"
      BE1["API - Account"]
      BE2["API - Auth"]
      BE3["API - Projects"]
      BE4["API - Tasks"]
      BE5["API - Workspaces"]
    end

    DB["Database Schema"]
    EX["Supabase Integration"]

    subgraph "Legend"
      L1["Frontend Components: Light Blue"]
      L2["Backend API Endpoints: Light Green"]
      L3["Database Schema: Light Pink"]
      L4["External Services: Light Yellow"]
    end

    %% User to Frontend
    User --> FS1
    User --> FS2

    %% Frontend internal interactions
    FS1 --> FS3
    FS2 --> FS4
    FS2 --> FS5
    FS3 --> FS6
    FS4 --> FS6
    FS5 --> FS6
    FS6 --> FS7

    %% Frontend to Backend interactions (from UI and Business Logic)
    FS6 -->|"HTTP calls"| BE1
    FS6 -->|"HTTP calls"| BE2
    FS6 -->|"HTTP calls"| BE3
    FS6 -->|"HTTP calls"| BE4
    FS6 -->|"HTTP calls"| BE5
    FS7 -->|"Logic triggers"| BE1
    FS7 -->|"Logic triggers"| BE2
    FS7 -->|"Logic triggers"| BE3
    FS7 -->|"Logic triggers"| BE4
    FS7 -->|"Logic triggers"| BE5

    %% Backend to Database and External Service interactions
    BE1 -->|"CRUD operations"| DB
    BE2 -->|"CRUD operations"| DB
    BE3 -->|"CRUD operations"| DB
    BE4 -->|"CRUD operations"| DB
    BE5 -->|"CRUD operations"| DB

    BE1 -->|"Auth & Data"| EX
    BE2 -->|"Auth & Data"| EX
    BE3 -->|"Auth & Data"| EX
    BE4 -->|"Auth & Data"| EX
    BE5 -->|"Auth & Data"| EX

    %% Click events for component mapping
    click FS1 "https://github.com/nawapons/project-manager/tree/main/src/app/(dashboard)"
    click FS2 "https://github.com/nawapons/project-manager/tree/main/src/app/(standalone)"
    click FS3 "https://github.com/nawapons/project-manager/tree/main/src/app/(dashboard)/workspaces"
    click FS4 "https://github.com/nawapons/project-manager/tree/main/src/app/(standalone)/account"
    click FS5 "https://github.com/nawapons/project-manager/tree/main/src/app/(standalone)/reset-password"
    click FS6 "https://github.com/nawapons/project-manager/tree/main/src/components"
    click FS7 "https://github.com/nawapons/project-manager/tree/main/src/features"
    click BE1 "https://github.com/nawapons/project-manager/tree/main/src/app/api/account"
    click BE2 "https://github.com/nawapons/project-manager/tree/main/src/app/api/auth"
    click BE3 "https://github.com/nawapons/project-manager/tree/main/src/app/api/project"
    click BE4 "https://github.com/nawapons/project-manager/tree/main/src/app/api/task"
    click BE5 "https://github.com/nawapons/project-manager/tree/main/src/app/api/workspace"
    click DB "https://github.com/nawapons/project-manager/tree/main/src/schema"
    click EX "https://github.com/nawapons/project-manager/tree/main/src/utils/supabase"

    %% Styles
    class FS1,FS2,FS3,FS4,FS5,FS6,FS7 frontend
    class BE1,BE2,BE3,BE4,BE5 backend
    class DB database
    class EX external

    classDef frontend fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef backend fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef database fill:#ffb6c1,stroke:#333,stroke-width:2px;
    classDef external fill:#ffff99,stroke:#333,stroke-width:2px;
```
