# ashish-maurya531/apps architecture

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

- Interactive diagram: https://gitdiagram.com/ashish-maurya531/apps
- Repository: https://github.com/ashish-maurya531/apps

## Overview

##### Project type and purpose
- This is a JavaScript/TypeScript monorepo (pnpm workspace) housing two main end-user applications:
- A Next.js web application (“webapp” package) served on Vercel.
- A browser extension (“extension” package) targeting Chromium and Firefox.
- It also includes a “shared” component library (React UI, hooks, GraphQL clients), storybook for component development, plus linting and formatting configs.

##### File-structure analysis
- Top-level:
- pnpm-workspace.yaml, package.json, CI/CD configs, Dockerfiles for local development (Gitpod, Tilt, docker-compose).
- /packages directory with subfolders: eslint-config, prettier-config, shared, extension, storybook, webapp.
- Patterns: each package is isolated, builds independently, but “webapp” and “extension” both depend on “shared.”
- Build tools: Next.js for webapp, webpack for extension, storybook with Vite, pnpm for dependency management.

##### README insights
- Monorepo to ensure feature parity across extension and webapp.
- Shared components and hooks power both applications.
- CI via CircleCI / GitHub workflows; deployments: Vercel for webapp, browser stores for extension.

a. Main components
1. Monorepo root (pnpm workspace)
2. Shared library (packages/shared)
3. Web application (packages/webapp – Next.js SSR/SSG)
4. Browser extension (packages/extension – background script, content script, popup/companion UI, newtab page)
5. Storybook (packages/storybook – UI sandbox)
6. Dev configs (eslint-config, prettier-config)
7. CI/CD pipelines (CircleCI / GitHub Actions)
8. External services: daily.dev GraphQL API backend, Vercel hosting, Chrome Web Store / Firefox Add-ons.

b. Relationships and interactions
- Shared → consumed by webapp, extension, storybook.
- Developers → commit to monorepo → CI builds & tests each package → deploy.
- Webapp ↔ GraphQL API (queries, mutations, subscriptions).
- Extension background & content scripts ↔ GraphQL API (via fetch, webextension-polyfill).
- Storybook ↔ Shared library for UI component previews.

c. Architectural patterns
- Monorepo workspace: isolated packages, single source of truth.
- Component-driven development: shared React components + Storybook.
- Next.js MVC: pages, API routes (if any), SSR/CSR.
- Extension MV* separation: background, content, UI popups.
- CI/CD as code: workflows trigger builds, tests, deployments.

d. Key technologies/frameworks
- pnpm workspaces
- Next.js, React, TypeScript
- Webpack (extension), Vite (storybook)
- GitHub Actions & CircleCI
- Docker, Tilt, Gitpod
- GraphQL client/hooks

##### Final advice
- Be exhaustive: capture all package-level components rather than individual files.
- Environment boundaries: local development (Docker/Gitpod), CI, production.
- Use layering: top layer (monorepo & CI), middle layer (packages and dependencies), bottom layer (external services and deployment targets).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Layer: Local Development & CI/CD
    subgraph "Local Dev & CI/CD" 
        direction TB
        Dev[/"Developer"/]:::actor
        GitPush["git push"]:::dev
        CI[("CI/CD Pipelines")]:::dev
        Dockerfile["Dockerfile"]:::dev
        DockerCompose["docker-compose.yml"]:::dev
        Tiltfile["Tiltfile"]:::dev
        Gitpod[".gitpod.yml"]:::dev
        ESLintCfg["packages/eslint-config"]:::dev
        PrettierCfg["packages/prettier-config"]:::dev
        CircleCI[".circleci/config.yml"]:::dev
        GHActions[".github/workflows/*.yml"]:::dev
        Dev --> GitPush --> CI
    end

    %% Middle Layer: Monorepo & Packages
    subgraph "Monorepo Root" 
        direction TB
        Workspace["pnpm-workspace.yaml"]:::dev
        PkgJSON["package.json"]:::dev
    end

    subgraph "Packages" 
        direction TB
        Shared["packages/shared"]:::pkg
        Webapp["packages/webapp"]:::pkg
        Extension["packages/extension"]:::pkg
        Storybook["packages/storybook"]:::pkg
        %% Webapp internals
        subgraph "Webapp Details"
            direction TB
            NextConfig["next.config.js"]:::pkg
            Pages["packages/webapp/pages"]:::pkg
        end
        Webapp --> NextConfig
        Webapp --> Pages

        %% Extension internals
        subgraph "Extension Details"
            direction TB
            Manifest["manifest.json"]:::pkg
            Background["background/index.ts"]:::pkg
            Content["content/index.tsx"]:::pkg
            Companion["companion/App.tsx"]:::pkg
            NewTab["newtab/App.tsx"]:::pkg
        end
        Extension --> Manifest
        Extension --> Background
        Extension --> Content
        Extension --> Companion
        Extension --> NewTab
    end

    %% External Services & Deploy Targets
    subgraph "External Services & Deployment" 
        direction TB
        GraphQL["daily.dev GraphQL API"]:::ext
        Vercel["Vercel Hosting"]:::ext
        ChromeStore["Chrome Web Store"]:::ext
        FirefoxStore["Firefox Add-ons"]:::ext
    end

    %% Dependencies & Data Flows
    CI --> Workspace
    CI --> PkgJSON
    Workspace & PkgJSON --> Shared
    Workspace & PkgJSON --> Webapp
    Workspace & PkgJSON --> Extension
    Workspace & PkgJSON --> Storybook
    CI --> ESLintCfg
    CI --> PrettierCfg
    CI --> Dockerfile
    CI --> DockerCompose
    CI --> Tiltfile
    CI --> Gitpod
    CI --> CircleCI
    CI --> GHActions

    Shared --> Webapp
    Shared --> Extension
    Shared --> Storybook

    Webapp -->|"queries/mutations"| GraphQL
    Background -->|"fetch/API"| GraphQL
    Content -->|"fetch/API"| GraphQL

    GitPush --> CI
    CI -->|"build & test packages"| Shared
    CI --> Shared
    CI --> Webapp
    CI --> Extension
    CI --> Storybook

    CI -->|"deploy webapp"| Vercel
    CI -->|"publish extension"| ChromeStore
    CI -->|"publish extension"| FirefoxStore

    %% Click Events
    click Workspace "https://github.com/ashish-maurya531/apps/blob/main//pnpm-workspace.yaml"
    click PkgJSON "https://github.com/ashish-maurya531/apps/blob/main//package.json"
    click Shared "https://github.com/ashish-maurya531/apps/tree/main//packages/shared"
    click Webapp "https://github.com/ashish-maurya531/apps/tree/main//packages/webapp"
    click NextConfig "https://github.com/ashish-maurya531/apps/blob/main//packages/webapp/next.config.js"
    click Pages "https://github.com/ashish-maurya531/apps/tree/main//packages/webapp/pages"
    click Extension "https://github.com/ashish-maurya531/apps/tree/main//packages/extension"
    click Manifest "https://github.com/ashish-maurya531/apps/blob/main//packages/extension/src/manifest.json"
    click Background "https://github.com/ashish-maurya531/apps/blob/main//packages/extension/src/background/index.ts"
    click Content "https://github.com/ashish-maurya531/apps/blob/main//packages/extension/src/content/index.tsx"
    click Companion "https://github.com/ashish-maurya531/apps/blob/main//packages/extension/src/companion/App.tsx"
    click NewTab "https://github.com/ashish-maurya531/apps/blob/main//packages/extension/src/newtab/App.tsx"
    click Storybook "https://github.com/ashish-maurya531/apps/tree/main//packages/storybook"
    click ESLintCfg "https://github.com/ashish-maurya531/apps/tree/main//packages/eslint-config"
    click PrettierCfg "https://github.com/ashish-maurya531/apps/tree/main//packages/prettier-config"
    click CircleCI "https://github.com/ashish-maurya531/apps/blob/main//.circleci/config.yml"
    click GHActions "https://github.com/ashish-maurya531/apps/blob/main//.github/workflows/*.yml"
    click Dockerfile "https://github.com/ashish-maurya531/apps/tree/main//Dockerfile"
    click DockerCompose "https://github.com/ashish-maurya531/apps/blob/main//docker-compose.yml"
    click Tiltfile "https://github.com/ashish-maurya531/apps/tree/main//Tiltfile"
    click Gitpod "https://github.com/ashish-maurya531/apps/blob/main//.gitpod.yml"

    %% Styling
    classDef pkg fill:#bbdefb,stroke:#0d47a1,color:#0d47a1
    classDef dev fill:#eeeeee,stroke:#616161,color:#424242
    classDef ext fill:#c8e6c9,stroke:#2e7d32,color:#2e7d32
    classDef actor fill:#ffe082,stroke:#ffa000,color:#bf360c,shape:hexagon
```
