# mayankaneja837/flownote architecture

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

- Interactive diagram: https://gitdiagram.com/mayankaneja837/flownote
- Repository: https://github.com/mayankaneja837/flownote

## Overview

##### Project type and purpose
- FlowNote is a full-stack note-taking and blogging application.
- The frontend is built with React, TypeScript, Vite, Tailwind CSS, and React Router.
- The backend is a TypeScript Hono (lightweight web framework) service, deployed via Wrangler to Cloudflare Workers, using Prisma ORM and JWT for auth.
- A shared “common” package holds Zod schemas and TypeScript types for cross-cutting concerns (validation, DTOs).

##### File structure
- Top-level directories:
- Backend/ – server code, API routes (`src/routes`), Prisma schema and migrations (`prisma/`), Hono setup, tsconfig.
- Frontend/ – React app (pages, components, hooks), Vite config, Tailwind and PostCSS, ESLint.
- common/ – shared utilities (`src/index.ts`), build output (`dist/`), package metadata.
- Architectural hints:
- Backend follows a router-based REST API (blogRouter, userRouter).
- JWT middleware likely injected at the Hono application level.
- “common” is a standalone npm package consumed by both front- and back-end for types/validation.
- Deployment artifacts:
- `wrangler.toml` – Cloudflare Worker config for the backend.
- Vite’s build config (`vite.config.ts`) for the frontend static assets.

##### README for additional insights
- Confirms RESTful user/blog endpoints, JWT auth, Prisma migrations.
- Frontend uses Axios to call API, React Router for navigation, Tailwind for styling.
- Common provides Zod schemas and TS types.

##### Final recommendations
- Essential elements: UI, API gateway, middleware, routers, database, shared code.
- Avoid over-splitting: group related route handlers (userRouter & blogRouter) under a single “REST API” component, unless you want to detail each endpoint.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        Browser["User Browser"]:::frontend
        CDN["CDN / Static File Host"]:::frontend
        ReactApp["React App"]:::frontend
        ViteConfig["Vite Config (Vite)"]:::frontend
        TailwindCSS["Tailwind CSS Config"]:::frontend
        PostCSS["PostCSS Config"]:::frontend
    end

    %% Edge/API Layer
    subgraph "Edge/API Layer"
        direction TB
        Worker["Cloudflare Worker (Hono)"]:::api
        JWT["JWT Middleware"]:::api
        subgraph "REST API Routers"
            direction TB
            UserRouter["User Router"]:::api
            BlogRouter["Blog Router"]:::api
        end
        PrismaClient["Prisma Client"]:::api
    end

    %% Database Layer
    DB["Database (PostgreSQL/MySQL)"]:::db

    %% Shared Common Package
    subgraph "Shared Common Package"
        direction TB
        CommonSrc["common/src/index.ts"]:::common
        CommonDist["common/dist/index.js"]:::common
    end

    %% Connections
    Browser -->|GET static assets| CDN
    CDN -->|serves built React App| Browser
    Browser -->|renders UI| ReactApp
    ReactApp -->|import types/schemas| CommonSrc
    ReactApp -->|HTTPS/Axios| Worker
    Worker -->|import types/schemas| CommonSrc
    Worker -->|passes through| JWT
    Worker -->|routes to| UserRouter
    Worker -->|routes to| BlogRouter
    UserRouter -->|queries| PrismaClient
    BlogRouter -->|queries| PrismaClient
    PrismaClient -->|TCP/Prisma| DB

    %% Click Events
    click ReactApp "https://github.com/mayankaneja837/flownote/tree/main/Frontend/src/"
    click ViteConfig "https://github.com/mayankaneja837/flownote/blob/main/Frontend/vite.config.ts"
    click TailwindCSS "https://github.com/mayankaneja837/flownote/blob/main/Frontend/tailwind.config.js"
    click PostCSS "https://github.com/mayankaneja837/flownote/blob/main/Frontend/postcss.config.js"
    click Worker "https://github.com/mayankaneja837/flownote/blob/main/Backend/src/index.ts"
    click UserRouter "https://github.com/mayankaneja837/flownote/blob/main/Backend/src/routes/userRouter.ts"
    click BlogRouter "https://github.com/mayankaneja837/flownote/blob/main/Backend/src/routes/blogRouter.ts"
    click PrismaClient "https://github.com/mayankaneja837/flownote/blob/main/Backend/prisma/schema.prisma"
    click DB "https://github.com/mayankaneja837/flownote/tree/main/Backend/prisma/migrations/"
    click CommonSrc "https://github.com/mayankaneja837/flownote/blob/main/common/src/index.ts"
    click CommonDist "https://github.com/mayankaneja837/flownote/blob/main/common/dist/index.js"

    %% Styles
    classDef frontend fill:#E3F2FD,stroke:#2196F3,stroke-width:2px
    classDef api fill:#E8F5E9,stroke:#4CAF50,stroke-width:2px
    classDef db fill:#FFF3E0,stroke:#FB8C00,stroke-width:2px
    classDef common fill:#ECEFF1,stroke:#607D8B,stroke-width:2px
```
