# not-just-pratul/monolith---stone-focus-app architecture

> Architecture diagram of the GitHub repository not-just-pratul/monolith---stone-focus-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/not-just-pratul/monolith---stone-focus-app
- Repository: https://github.com/not-just-pratul/monolith---stone-focus-app

## Overview

##### Project Type and Purpose
- Monolith Focus App is a web-based, full-stack (front-end-heavy) productivity application built with Next.js 13 (App Router) and React.
- Purpose: Help users commit to and complete one “Monolith” task per session, track distractions, breaks, reflections, and store all data locally.

##### File Structure
- Top-Level Directories
– `.next/` → Next.js build & SSR/SSG artifacts
– `public/` → Static assets (redirects, manifest, robots.txt)
– `src/app/` → Next.js App Router pages and nested layouts
– `src/components/` → Reusable React components (core & shadcn/ui primitives)
– `src/hooks/` → Custom React hooks (keyboard shortcuts, sounds, toasts)
– `src/lib/utils.ts` → Utility functions, localStorage wrappers
- Configuration & Build Files
– `next.config.mjs`, `tsconfig*.json`, `tailwind.config.ts`
– `package.json`, lockfiles, ESLint, PostCSS configs

##### README for Additional Insights
- Tech Stack: Next.js, React, TypeScript, Tailwind CSS, shadcn/ui, Framer Motion, Lucide React, next-themes
- Data Persistence: Local Storage only, JSON export, clear/reset history
- No external API or database—pure client-side data layer

##### Main Components & Their Relationships
a. Client Browser
– Next.js Router (SSR/SSG entry) → hydrates into a SPA
– UI Layer: `src/app` pages → composed of core & UI primitives (`src/components` + `src/components/ui`)
– Cross-cutting via Hooks: `useKeyboardShortcuts`, `useSoundEffects`, `useToast`, `useMobile`
– Theme Context (`next-themes`), Animation Context (Framer Motion)
– Styles: Tailwind (global in `globals.css`, component CSS)
b. Next.js Node.js Server
– SSR/SSG engine serves pre-rendered HTML + JSON data
– Builds routes based on `src/app` folder structure
– Static file server for `public/` and `.next/static` assets
c. Data Layer (Browser Local Storage)
– Utility functions in `src/lib/utils.ts` manage get/set/clear of session data, history, settings
– Export module generates JSON download
d. Static Assets & Build Artifacts
– `.next/static` for JS/CSS chunks, HMR updates
– `public/` for manifest, robots, redirects
e. Dev & CI/CD Tools (side note)
– Nix (`.idx/dev.nix`), Bun lockfile (optional), Vercel config

##### Architectural Patterns & Design Principles
- Component-Based Architecture: Atomic UI primitives + higher-level monolith features
- Nested Layouts via Next.js App Router for shared headers, footers, metadata
- Separation of Concerns:
– Presentation (React components)
– State & Side Effects (Hooks)
– Persistence (lib/utils)
- HYDRATED SPA: SSR/SSG for first load, then client hydrates into a rich SPA
- Client-only Data Persistence ensures privacy and simplicity

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% Browser Client Layer
  subgraph "Browser Client"
    direction TB
    AR["Next.js App Router"]:::browser
    CC["Core Components"]:::browser
    UP["UI Primitives"]:::browser
    HK["Custom Hooks"]:::browser
    CT["Theme & Animation Context"]:::browser
    ST["Global Styles"]:::browser
    Export["JSON Export"]:::browser
  end

  %% Next.js Server Layer
  subgraph "Next.js Server"
    direction TB
    SSR["SSR/SSG Engine"]:::server
    SFS["Static File Server"]:::server
  end

  %% Storage and Assets
  LocalStorage[("Local Storage")]:::storage
  PublicAssets[("Static Assets (public/)")]:::assets

  %% Build & Config
  subgraph "Build & Config"
    direction TB
    NextDot[".next/"]:::artifact
    Config["next.config.mjs\n tsconfig*.json\n tailwind.config.ts"]:::artifact
  end

  %% Deployment & Environment
  subgraph "Deployment & Env"
    direction TB
    Nix[".idx/dev.nix"]:::env
    Vercel["vercel.json"]:::env
  end

  %% Relationships
  AR -->|"HTTP GET"| SSR
  SSR -->|"HTML + JS Bundle"| AR
  AR -->|"hydrate SPA"| AR
  AR -->|"read/write"| LocalStorage
  AR -->|"fetch"| PublicAssets
  AR -->|"trigger"| Export
  NextDot --> SSR
  PublicAssets --> AR

  %% Click Events
  click AR "https://github.com/not-just-pratul/monolith---stone-focus-app/tree/main/src/app/"
  click CC "https://github.com/not-just-pratul/monolith---stone-focus-app/tree/main/src/components/"
  click UP "https://github.com/not-just-pratul/monolith---stone-focus-app/tree/main/src/components/ui/"
  click HK "https://github.com/not-just-pratul/monolith---stone-focus-app/tree/main/src/hooks/"
  click ST "https://github.com/not-just-pratul/monolith---stone-focus-app/blob/main/src/app/globals.css"
  click LocalStorage "https://github.com/not-just-pratul/monolith---stone-focus-app/blob/main/src/lib/utils.ts"
  click PublicAssets "https://github.com/not-just-pratul/monolith---stone-focus-app/tree/main/public/"
  click NextDot "https://github.com/not-just-pratul/monolith---stone-focus-app/tree/main/.next/"
  click Config "https://github.com/not-just-pratul/monolith---stone-focus-app/blob/main/next.config.mjs"
  click Nix "https://github.com/not-just-pratul/monolith---stone-focus-app/blob/main/.idx/dev.nix"
  click Vercel "https://github.com/not-just-pratul/monolith---stone-focus-app/blob/main/vercel.json"

  %% Styles
  classDef browser fill:#ebf8ff,stroke:#3182ce,color:#1a365d;
  classDef server fill:#f0fff4,stroke:#38a169,color:#22543d;
  classDef storage fill:#fffaf0,stroke:#dd6b20,color:#78350f;
  classDef assets fill:#f7fafc,stroke:#718096,color:#2d3748;
  classDef artifact fill:#edf2f7,stroke:#a0aec0,color:#4a5568;
  classDef env fill:#faf5ff,stroke:#805ad5,color:#44337a;
```
