# navwireless/studio architecture

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

- Interactive diagram: https://gitdiagram.com/navwireless/studio
- Repository: https://github.com/navwireless/studio

## Overview

##### Project type and purpose
- This is a full-stack, React-based web application built with Next.js (App Router v13).
- It focuses on Free-Space Optical (FSO) link planning (line-of-sight, Fresnel-zone calculations) and has some AI/dev tooling under src/ai.
- It’s deployed via Firebase Studio (Firebase Hosting + Cloud Functions/SSR).

##### File structure
- Top-level directories:
– .next: build output (static assets, server bundles)
– src/app: Next.js App-Router routes (layout.tsx, page.tsx, actions.ts)
– src/components: UI components subdivided into domain-specific (fso) and generic (ui, layout)
– src/lib: pure business logic (los-calculator, form schema, utilities)
– src/ai: developer-tooling or AI integration scripts (genkit, dev)
- No standalone “backend” folder: backend logic lives in server actions (src/app/actions.ts) and Next.js server components.
- Build/deploy scripts: next.config.ts, postcss.config.mjs, tailwind.config.ts, and GitHub workflows for CI.

##### Architectural patterns & technologies
- App-Router (Next.js 13): separation of server vs client components
- Server Actions: using src/app/actions.ts for secure server-side logic
- SSR/SSG with Firebase Functions & Hosting
- Tailwind + PostCSS for styling
- TypeScript throughout
- Utility modules (los-calculator) encapsulate domain logic

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients and Hosting
    Browser["Browser"]:::client
    Hosting["Firebase Hosting + CDN"]:::hosting
    SSR["Next.js SSR / Server Actions"]:::server
    Build[".next build artifacts & Cache"]:::cache

    %% Application Inside SSR
    subgraph "Application Inside SSR"
        subgraph "src/app"
            LayoutTs["layout.tsx"]:::app
            PageTs["page.tsx"]:::app
            Globals["globals.css"]:::app
        end
        ServerActions["actions.ts"]:::server
        subgraph "src/components"
            subgraph "fso components"
                InputForm["input-form.tsx"]:::fso
                InteractiveMap["interactive-map.tsx"]:::fso
                BottomPanel["bottom-panel.tsx"]:::fso
            end
            subgraph "layout components"
                AppHeader["app-header.tsx"]:::layout
                AppSidebar["app-sidebar.tsx"]:::layout
                Footer["footer.tsx"]:::layout
                HistoryPanel["history-panel.tsx"]:::layout
            end
            subgraph "ui primitives"
                Button["button.tsx"]:::ui
                Card["card.tsx"]:::ui
                Dialog["dialog.tsx"]:::ui
            end
        end
        BizLib["src/lib (los-calculator, utils)"]:::lib
        Hooks["src/hooks"]:::hooks
        Types["src/types/index.ts"]:::types
        AI["src/ai"]:::ai
    end

    %% Config & CI/CD
    subgraph "Config & CI/CD"
        NextConfig["next.config.ts"]:::config
        Tailwind["tailwind.config.ts"]:::config
        PostCSS["postcss.config.mjs"]:::config
        Workflow1[".github/workflows/node.js.yml"]:::config
        Workflow2[".github/workflows/npm-grunt.yml"]:::config
    end

    %% Data Flows
    Browser -->|"GET static assets"| Hosting
    Hosting -->|"serves static assets"| Browser
    Hosting -->|"invoke SSR (Firebase Function)"| SSR
    SSR -->|"returns rendered HTML"| Hosting

    SSR --> LayoutTs
    SSR --> PageTs
    SSR --> ServerActions
    SSR -.build.-> Build
    Hosting -->|"cache static chunks"| Build

    PageTs -.->|"imports UI components"| InputForm
    PageTs -->|"invokes Server Actions"| ServerActions
    ServerActions -->|"calls business logic"| BizLib
    ServerActions -->|"returns data"| PageTs

    InputForm -.->|"uses utilities"| BizLib
    InteractiveMap -.->|"uses utilities"| BizLib
    BottomPanel -.->|"uses utilities"| BizLib

    InputForm -.->|"AI integration"| AI
    InteractiveMap -.->|"AI integration"| AI

    LayoutTs -.->|"imports header/sidebar/footer"| AppHeader
    LayoutTs -.->|"imports header/sidebar/footer"| AppSidebar
    LayoutTs -.->|"imports header/sidebar/footer"| Footer
    LayoutTs -.->|"imports header/sidebar/footer"| HistoryPanel

    BizLib -->|"shared types"| Types
    ServerActions -.->|"uses hooks"| Hooks

    %% Config dependencies
    NextConfig -.-> SSR
    Tailwind -.-> SSR
    PostCSS -.-> SSR
    Workflow1 -.-> Build
    Workflow2 -.-> Build

    %% Click Events
    click LayoutTs "https://github.com/navwireless/studio/blob/master/src/app/layout.tsx"
    click PageTs "https://github.com/navwireless/studio/blob/master/src/app/page.tsx"
    click Globals "https://github.com/navwireless/studio/blob/master/src/app/globals.css"
    click ServerActions "https://github.com/navwireless/studio/blob/master/src/app/actions.ts"
    click InputForm "https://github.com/navwireless/studio/blob/master/src/components/fso/input-form.tsx"
    click InteractiveMap "https://github.com/navwireless/studio/blob/master/src/components/fso/interactive-map.tsx"
    click BottomPanel "https://github.com/navwireless/studio/blob/master/src/components/fso/bottom-panel.tsx"
    click AppHeader "https://github.com/navwireless/studio/blob/master/src/components/layout/app-header.tsx"
    click AppSidebar "https://github.com/navwireless/studio/blob/master/src/components/layout/app-sidebar.tsx"
    click Footer "https://github.com/navwireless/studio/blob/master/src/components/layout/footer.tsx"
    click HistoryPanel "https://github.com/navwireless/studio/blob/master/src/components/layout/history-panel.tsx"
    click Button "https://github.com/navwireless/studio/blob/master/src/components/ui/button.tsx"
    click Card "https://github.com/navwireless/studio/blob/master/src/components/ui/card.tsx"
    click Dialog "https://github.com/navwireless/studio/blob/master/src/components/ui/dialog.tsx"
    click BizLib "https://github.com/navwireless/studio/tree/master/src/lib"
    click Hooks "https://github.com/navwireless/studio/blob/master/src/hooks/use-mobile.tsx"
    click Types "https://github.com/navwireless/studio/blob/master/src/types/index.ts"
    click AI "https://github.com/navwireless/studio/blob/master/src/ai/dev.ts"
    click AI "https://github.com/navwireless/studio/blob/master/src/ai/genkit.ts"
    click Build "https://github.com/navwireless/studio/blob/master/.next"
    click NextConfig "https://github.com/navwireless/studio/blob/master/next.config.ts"
    click Tailwind "https://github.com/navwireless/studio/blob/master/tailwind.config.ts"
    click PostCSS "https://github.com/navwireless/studio/blob/master/postcss.config.mjs"
    click Workflow1 "https://github.com/navwireless/studio/blob/master/.github/workflows/node.js.yml"
    click Workflow2 "https://github.com/navwireless/studio/blob/master/.github/workflows/npm-grunt.yml"

    %% Styles
    classDef client fill:#ADD8E6,color:#000
    classDef hosting fill:#CCE5FF,color:#000
    classDef server fill:#C6F6D5,color:#000
    classDef cache fill:#E2E8F0,color:#000
    classDef app fill:#FEEBC8,color:#000
    classDef fso fill:#FAF089,color:#000
    classDef layout fill:#FBD38D,color:#000
    classDef ui fill:#FEFCBF,color:#000
    classDef lib fill:#D6BCFA,color:#000
    classDef hooks fill:#D6BCFA,color:#000
    classDef types fill:#D6BCFA,color:#000
    classDef ai fill:#FEB2B2,color:#000
    classDef config fill:#E2E8F0,color:#000
```
