# esuarezperaza/mimercadove architecture

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

- Interactive diagram: https://gitdiagram.com/esuarezperaza/mimercadove
- Repository: https://github.com/esuarezperaza/mimercadove

## Overview

##### Project type and purpose
- This is a “Firebase Studio” starter built with Next.js (v13 app-router).
- It’s primarily a full-stack web application scaffold focused on client-side UI, CSS (Tailwind), shared utilities, and optional AI integrations (see src/ai).

##### File structure
Top-level:
- apphosting.yaml – Google/Firebase App Engine or Hosting config
- next.config.ts, postcss.config.mjs, tailwind.config.ts, tsconfig.json – build & tooling
- .idx/dev.nix – Nix-based dev environment

src/:
- src/app – Next.js app-router: pages, nested layouts, dynamic routes (history/[id])
- src/components – UI library broken into “calculator” feature and generic “ui” atoms/molecules
- src/hooks – custom React hooks (use-mobile, use-toast)
- src/lib – shared formatters and utilities
- src/ai – dev-time code gen scripts (dev.ts, genkit.ts)

##### README for additional insights
- Confirms it’s a starter template for hosting on Firebase via Next.js.
- No explicit API routes in src/app, so likely static exports or Cloud Functions managed elsewhere.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer Environment
    DevEnv["Developer Environment (Nix dev shell)"]:::developer
    click DevEnv "https://github.com/esuarezperaza/mimercadove/blob/main/.idx/dev.nix"

    %% Build & Tooling
    subgraph "Build & Tooling Configuration"
        NextConfig["next.config.ts"]:::build
        PostCSS["postcss.config.mjs"]:::build
        Tailwind["tailwind.config.ts"]:::build
        TSConfig["tsconfig.json"]:::build
    end
    click NextConfig "https://github.com/esuarezperaza/mimercadove/blob/main/next.config.ts"
    click PostCSS "https://github.com/esuarezperaza/mimercadove/blob/main/postcss.config.mjs"
    click Tailwind "https://github.com/esuarezperaza/mimercadove/blob/main/tailwind.config.ts"
    click TSConfig "https://github.com/esuarezperaza/mimercadove/blob/main/tsconfig.json"

    %% Documentation
    Blueprint["High-Level Architecture Documentation"]:::documentation
    click Blueprint "https://github.com/esuarezperaza/mimercadove/blob/main/docs/blueprint.md"

    %% Codebase
    subgraph "Next.js App Router"
        Page["src/app/page.tsx"]:::code
        Layout["src/app/layout.tsx"]:::code
        HistoryList["src/app/history/page.tsx"]:::code
        HistoryDetail["src/app/history/[id]/page.tsx"]:::code
        GlobalsCSS["src/app/globals.css"]:::code
    end
    click Page "https://github.com/esuarezperaza/mimercadove/blob/main/src/app/page.tsx"
    click Layout "https://github.com/esuarezperaza/mimercadove/blob/main/src/app/layout.tsx"
    click HistoryList "https://github.com/esuarezperaza/mimercadove/blob/main/src/app/history/page.tsx"
    click HistoryDetail "https://github.com/esuarezperaza/mimercadove/blob/main/src/app/history/[id]/page.tsx"
    click GlobalsCSS "https://github.com/esuarezperaza/mimercadove/blob/main/src/app/globals.css"

    subgraph "UI Components"
        Calcs["Calculator Components"]:::code
        UIlib["Atomic UI Library"]:::code
    end
    click Calcs "https://github.com/esuarezperaza/mimercadove/tree/main/src/components/calculator/"
    click UIlib "https://github.com/esuarezperaza/mimercadove/tree/main/src/components/ui/"

    subgraph "Custom Hooks & Utilities"
        Hooks["Custom React Hooks"]:::code
        Libs["Shared Utilities & Formatters"]:::code
    end
    click Hooks "https://github.com/esuarezperaza/mimercadove/tree/main/src/hooks/"
    click Libs "https://github.com/esuarezperaza/mimercadove/tree/main/src/lib/"

    subgraph "AI Integration Scripts"
        AIScripts["src/ai"]:::code
    end
    click AIScripts "https://github.com/esuarezperaza/mimercadove/tree/main/src/ai/"

    %% Build & CI/CD
    BuildPipeline["Build & CI/CD Pipeline"]:::build
    NPMDev["npm run dev"]:::build
    NextBuild["next build & export"]:::build

    %% Hosting & Edge
    subgraph "Hosting & Edge Infrastructure"
        HostingCFG["Firebase Hosting / App Engine Config"]:::infrastructure
        CDN["Firebase CDN"]:::infrastructure
        EdgeFuncs["SSR Edge Functions"]:::infrastructure
    end
    click HostingCFG "https://github.com/esuarezperaza/mimercadove/blob/main/apphosting.yaml"

    %% External Services
    subgraph "External Services"
        FirebaseSDK["Firebase Auth & Firestore"]:::external
        AIProvider["External AI API"]:::external
    end

    %% Client
    Browser["Web Browser Client"]:::client

    %% Connections
    DevEnv -->|uses| NPMDev
    NPMDev -->|serves from| Page
    Page -->|imports| Layout
    Layout -->|loads| GlobalsCSS
    NPMDev -->|hot-reloads| Calcs
    NPMDev -->|hot-reloads| UIlib
    NPMDev -->|hot-reloads| Hooks
    NPMDev -->|hot-reloads| Libs
    NPMDev -->|runs| AIScripts

    NextConfig --> NextBuild
    PostCSS --> NextBuild
    Tailwind --> NextBuild
    TSConfig --> NextBuild

    NextBuild -->|outputs| HostingCFG
    BuildPipeline --> NextBuild
    BuildPipeline -->|deployment| HostingCFG

    HostingCFG -->|deploy| CDN
    HostingCFG -->|deploy| EdgeFuncs

    Browser -->|requests pages| CDN
    CDN -->|serves SSR| EdgeFuncs
    EdgeFuncs -->|renders| Browser
    CDN -->|serves static| Browser

    Browser -->|calls SDK| FirebaseSDK
    Browser -->|calls AI| AIProvider

    %% Styles
    classDef developer fill:#9EE493,stroke:#6BAF68,color:#000
    classDef build fill:#A0E7E5,stroke:#3ABFBF,color:#000
    classDef documentation fill:#FFD97D,stroke:#E5AB3A,color:#000
    classDef code fill:#B3BFFD,stroke:#6F6FE1,color:#000
    classDef infrastructure fill:#FFC09F,stroke:#E48A6A,color:#000
    classDef external fill:#D290E5,stroke:#A345C4,color:#000
    classDef client fill:#FFB3C1,stroke:#E16F80,color:#000
```
