# dexter-ifti/streaker architecture

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

- Interactive diagram: https://gitdiagram.com/dexter-ifti/streaker
- Repository: https://github.com/dexter-ifti/streaker

## Overview

##### Main Components
- Frontend: Found in the "frontend" directory, this React.js application is responsible for the user interface. It includes components, pages, hooks, utility functions, styling (Tailwind CSS), and configuration files (Vite, Tailwind, etc.).
- Backend: The "streaker-backend" directory holds a Node.js application built using Hono.js. It is responsible for server-side logic including user authentication, activities, feedback, and other business logic. It follows an MVC-like or layered architecture with clearly separated controllers, services, models, and routes.
- Shared/Common Code: The "common" directory likely contains shared code or utilities that might be used across both the frontend and backend.
- Database: The project uses PostgreSQL accessed via Prisma ORM. The numerous migration files and the schema.prisma indicate a robust database setup.
- External Services: Elements like authentication (JWT), and possibly external deployments (Netlify for the frontend, Vercel/Netlify config files) should be illustrated as part of the overall ecosystem.

##### Relationships and Interactions
- Common/shared utilities could be placed as a centralized block that both frontend and backend might reference.
- Additionally, indicate external dependencies (such as authentication mechanisms using JWT), which might be integrated at the backend.

##### Architectural Patterns & Design Principles
- Separation of Concerns: Emphasize the strict separation between the client-side (React) and server-side (Hono.js/Node).
- Modular Structure: The backend directory is clearly modularized into controllers, routes, services, and middleware. Similarly, the frontend’s clear folder structure for components, pages, hooks, etc., can be highlighted.
- API-Driven Interaction: Show that the frontend communicates with backend endpoints for data operations like tracking activities, user authentication, and feedback submission.

- Frontend: React.js, Vite for bundling, Tailwind CSS for styling.
- Backend: Node.js with Hono.js, JWT-based authentication, and middleware for request handling.
- Database: PostgreSQL coupled with Prisma ORM.
- DevOps/Environment: Deployment configurations are indicated (netlify.toml for frontend, wrangler for backend, environment variable support).

##### Elements
- Clear labels: Each component (Frontend, Backend, Database, Common/Shared Code) should be clearly labeled.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        FE_App["React App (App.tsx)"]:::frontend
        FE_Components["Components"]:::frontend
        FE_Pages["Pages"]:::frontend
        FE_Vite["Vite Config"]:::frontend
        FE_Tailwind["Tailwind Config"]:::frontend
        FE_Netlify["Netlify Config"]:::frontend
        FE_Vercel["Vercel Config"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BE_Index["API Entry (index.ts)"]:::backend
        BE_Controllers["Controllers"]:::backend
        BE_Routes["Routes"]:::backend
        BE_Services["Services"]:::backend
        BE_Middleware["Middleware"]:::backend
        BE_Env["Env Config"]:::backend
        BE_Wrangler["Wrangler Config"]:::backend
    end

    %% Shared Code
    subgraph "Shared Code"
        COM_Index["Common Index"]:::common
        COM_Pkg["Package JSON"]:::common
        COM_TS["TSConfig"]:::common
    end

    %% Database Layer
    subgraph "Database Layer"
        DB_Schema["Schema.prisma"]:::database
        DB_Migrations["Migrations"]:::database
    end

    %% External Services
    subgraph "External Services"
        EXT_JWT["JWT Authentication"]:::external
        EXT_Deploy["Deployment Service"]:::external
    end

    %% Relationships and Data Flow
    FE_App -->|"API_Requests"| BE_Index
    BE_Index -->|"Prisma_Ops"| DB_Schema
    FE_App -->|"Uses_Common"| COM_Index
    BE_Index -->|"Uses_Common"| COM_Index
    BE_Controllers -->|"Integrates_JWT"| EXT_JWT
    FE_Netlify -->|"Deploys_To"| EXT_Deploy
    FE_Vercel -->|"Deploys_To"| EXT_Deploy
    BE_Wrangler -->|"Deploys_To"| EXT_Deploy

    %% Styling Classes
    classDef frontend fill:#ffdead,stroke:#8b4513,stroke-width:2px;
    classDef backend fill:#add8e6,stroke:#00008b,stroke-width:2px;
    classDef common fill:#98fb98,stroke:#2e8b57,stroke-width:2px;
    classDef database fill:#f08080,stroke:#b22222,stroke-width:2px;
    classDef external fill:#ffd700,stroke:#daa520,stroke-width:2px;

    %% Click Events for Frontend
    click FE_App "https://github.com/dexter-ifti/streaker/blob/master/frontend/src/App.tsx"
    click FE_Components "https://github.com/dexter-ifti/streaker/tree/master/frontend/src/components/"
    click FE_Pages "https://github.com/dexter-ifti/streaker/tree/master/frontend/src/pages/"
    click FE_Vite "https://github.com/dexter-ifti/streaker/blob/master/frontend/vite.config.ts"
    click FE_Tailwind "https://github.com/dexter-ifti/streaker/blob/master/frontend/tailwind.config.js"
    click FE_Netlify "https://github.com/dexter-ifti/streaker/blob/master/frontend/netlify.toml"
    click FE_Vercel "https://github.com/dexter-ifti/streaker/blob/master/frontend/vercel.json"

    %% Click Events for Backend
    click BE_Index "https://github.com/dexter-ifti/streaker/blob/master/streaker-backend/src/index.ts"
    click BE_Controllers "https://github.com/dexter-ifti/streaker/tree/master/streaker-backend/src/controllers/"
    click BE_Routes "https://github.com/dexter-ifti/streaker/tree/master/streaker-backend/src/routes/"
    click BE_Services "https://github.com/dexter-ifti/streaker/tree/master/streaker-backend/src/services/"
    click BE_Middleware "https://github.com/dexter-ifti/streaker/tree/master/streaker-backend/src/middleware/"
    click BE_Env "https://github.com/dexter-ifti/streaker/blob/master/streaker-backend/.env.example"
    click BE_Wrangler "https://github.com/dexter-ifti/streaker/blob/master/streaker-backend/wrangler.example.json"

    %% Click Events for Shared Code
    click COM_Index "https://github.com/dexter-ifti/streaker/blob/master/common/src/index.ts"
    click COM_Pkg "https://github.com/dexter-ifti/streaker/blob/master/common/package.json"
    click COM_TS "https://github.com/dexter-ifti/streaker/blob/master/common/tsconfig.json"

    %% Click Events for Database
    click DB_Schema "https://github.com/dexter-ifti/streaker/blob/master/streaker-backend/prisma/schema.prisma"
    click DB_Migrations "https://github.com/dexter-ifti/streaker/tree/master/streaker-backend/prisma/migrations/"
```
