# devmike117/devmiketools architecture

> Architecture diagram of the GitHub repository devmike117/devmiketools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/devmike117/devmiketools
- Repository: https://github.com/devmike117/devmiketools

## Overview

1. **Top-level shape**
   - This is a **Vite + React 18 + TypeScript single-page app** with a small **serverless API layer** under `api/`.
   - The core product is a toolbox site: each page is a standalone tool, but most of the heavy work happens **in the browser**, not on a central backend.

2. **Frontend shell and navigation**
   - `src/main.tsx` boots the app, `src/App.tsx` defines the top-level routes/layout, and `src/pages/*` contains the individual tool and content pages.
   - The app includes marketing/content routes like `Home`, `FAQ`, `Privacy`, `Terms`, `Contact`, alongside tool routes like `Compress`, `Convert`, `Editor`, `OcrTool`, `RemoveBg`, `Resize`, `UrlShortener`, etc.

3. **Tool architecture**
   - The main feature boundary is `src/modules/*`: each file encapsulates one domain capability such as image compression, conversion, OCR, background removal, password generation, email/phone validation, PDF conversion, directory tree generation, and IP geolocation.
   - Pages in `src/pages/*` act mostly as orchestration layers that connect UI controls to these modules, then render results and download actions.

4. **Shared UI layer**
   - `src/components/*` holds reusable building blocks used across tools: uploaders, previews, downloads, modals, navigation, sidebars, banners, history panels, and tool headers.
   - This shared layer is important to the diagram because it separates **tool-specific logic** from **reusable presentation and interaction patterns**.

5. **Client-side processing pipeline**
   - The default data flow is: **user uploads or enters input → page component → module logic → processed output → preview/download UI**.
   - Supporting utilities in `src/utils/*` handle browser-side concerns like file-to-base64 conversion, zip downloads, canvas helpers, image validation, and Mermaid rendering.

6. **Local-first privacy model**
   - The README explicitly states that most tools are **processed locally in the browser**, with no file uploads to a central app server.
   - This means the architecture is largely **client-only for document/image/media processing**, with downloads generated locally through browser APIs.

7. **State, auth, and user experience**
   - `src/context/UserContext.tsx` and `src/utils/auth.ts` provide app-wide user/session state.
   - `src/config/firebase.ts` wires in **Firebase Auth** for optional Google sign-in, while hooks like `usePremium`, `useGuestLimits`, `useHistory`, and `useCountVisit` manage user status, guest restrictions, local history, and usage tracking.

8. **Guest/premium and history boundaries**
   - The app has a soft monetization/limitation layer: guest users are constrained through `GuestLimitBanner`, `GuestLimitDebug`, and the `useGuestLimits` hook.
   - `HistoryPanel` plus `useHistory` provide local activity history so users can return to recent tools/actions without server-side storage.

9. **Serverless API layer**
   - The `api/` directory suggests deployment as **Vercel serverless functions** rather than a traditional backend.
   - Key endpoints include `proxy.ts` and `unshorten.js`, plus `counter.js` for visit counting; middleware under `api/middleware/*` adds validation, rate limiting, and centralized error handling, and `api/security/check-ip.js` indicates request/IP checks.

10. **When the app leaves the browser**
   - Network/server interaction seems limited to a few specific concerns: authentication, visit counting, URL expansion/proxying, and possibly security checks.
   - The diagram should show the frontend as the primary system, with serverless APIs as a narrow supporting edge for tasks that cannot or should not be done purely client-side.

11. **Assets, styling, and composition**
   - Static images live under `public/img/*`, including tool icons and UI art, while global styling is split across `src/index.css`, `src/App.css`, and tool/editor-specific CSS files.
   - Tailwind is configured in the repo, but the architecture remains component-driven with page-level composition.

12. **External integrations and constraints**
   - The only clearly material external service is **Firebase** for auth.
   - Everything else is oriented around browser-native capabilities such as Canvas, file handling, downloads, and likely WebAssembly-backed processing for performance-sensitive tools.

13. **How to diagram it**
   - A good architecture diagram would show:
     - **Browser SPA** at the center
     - **Page components** orchestrating UI
     - **Shared components** and **tool modules** beneath them
     - **Local browser APIs** for file/canvas/download processing
     - **Firebase Auth** as an external identity provider
     - **Vercel serverless functions** as a small support layer for proxying, URL unshortening, counting, and request protection

Main entry points: [`src/pages`](https://github.com/devmike117/devmiketools/tree/main/src/pages) (Tool pages), [`src/components`](https://github.com/devmike117/devmiketools/tree/main/src/components) (Shared UI), [`src/hooks`](https://github.com/devmike117/devmiketools/tree/main/src/hooks) (App hooks), [`api`](https://github.com/devmike117/devmiketools/tree/main/api) (Serverless API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser SPA"]
  node_main(("App boot<br/>entrypoint<br/>[main.tsx]"))
  node_app["Router shell<br/>spa shell<br/>[App.tsx]"]
  node_pages["Tool pages<br/>page orchestration"]
  node_home_content["Content pages<br/>marketing/content<br/>[Home.tsx]"]
end

subgraph group_ui["UI Layer"]
  node_components["Shared UI<br/>component library"]
  node_tool_shell["Tool chrome<br/>ui scaffold<br/>[ToolHeader.tsx]"]
  node_guest_ui["Guest gates<br/>limiting UI"]
  node_history_ui["History panel<br/>activity UI<br/>[HistoryPanel.tsx]"]
end

subgraph group_logic["Tool Logic"]
  node_modules["Tool modules<br/>domain logic"]
  node_image_tools["Image tools<br/>processing suite<br/>[imageProcessing.ts]"]
  node_doc_media_tools["Doc/media tools<br/>processing suite<br/>[convert.ts]"]
  node_text_tools["Text/lookup tools<br/>utility suite"]
  node_utils["Browser helpers<br/>utility layer"]
end

subgraph group_state["State & Auth"]
  node_hooks["App hooks<br/>react hooks"]
  node_user_ctx["User context<br/>session state<br/>[UserContext.tsx]"]
  node_auth_utils["Auth utils<br/>auth helpers<br/>[auth.ts]"]
end

subgraph group_server["Serverless API"]
  node_api_layer["Serverless API<br/>edge backend"]
  node_proxy_api["Proxy/expand<br/>function<br/>[proxy.ts]"]
  node_counter_api["Visit counter<br/>function<br/>[counter.js]"]
  node_security_api["Security checks<br/>middleware<br/>[check-ip.js]"]
end

subgraph group_external["External Services"]
  node_firebase["Firebase auth<br/>identity service<br/>[firebase.ts]"]
  node_browser_runtime(("Browser APIs<br/>runtime boundary"))
end

node_main -->|"mounts"| node_app
node_app -->|"routes to"| node_pages
node_app -->|"composes"| node_components
node_pages -->|"uses"| node_tool_shell
node_pages -->|"orchestrates"| node_modules
node_modules -->|"depends on"| node_utils
node_modules -->|"runs in"| node_browser_runtime
node_components -->|"includes"| node_guest_ui
node_components -->|"includes"| node_history_ui
node_hooks -->|"reads"| node_user_ctx
node_hooks -->|"uses"| node_auth_utils
node_auth_utils -->|"connects"| node_firebase
node_hooks -->|"drives"| node_components
node_api_layer -->|"exposes"| node_proxy_api
node_api_layer -->|"exposes"| node_counter_api
node_api_layer -->|"protects"| node_security_api
node_pages -->|"consults"| node_hooks
node_pages -->|"consumes"| node_user_ctx
node_pages -.->|"calls"| node_api_layer
node_components -->|"renders through"| node_browser_runtime

click node_main "https://github.com/devmike117/devmiketools/blob/main/src/main.tsx"
click node_app "https://github.com/devmike117/devmiketools/blob/main/src/App.tsx"
click node_pages "https://github.com/devmike117/devmiketools/tree/main/src/pages"
click node_components "https://github.com/devmike117/devmiketools/tree/main/src/components"
click node_home_content "https://github.com/devmike117/devmiketools/blob/main/src/pages/Home.tsx"
click node_tool_shell "https://github.com/devmike117/devmiketools/blob/main/src/components/ToolHeader.tsx"
click node_guest_ui "https://github.com/devmike117/devmiketools/blob/main/src/components/GuestLimitBanner.tsx"
click node_history_ui "https://github.com/devmike117/devmiketools/blob/main/src/components/HistoryPanel.tsx"
click node_modules "https://github.com/devmike117/devmiketools/tree/main/src/modules"
click node_image_tools "https://github.com/devmike117/devmiketools/blob/main/src/modules/imageProcessing.ts"
click node_doc_media_tools "https://github.com/devmike117/devmiketools/blob/main/src/modules/convert.ts"
click node_text_tools "https://github.com/devmike117/devmiketools/blob/main/src/modules/passwordGenerator.ts"
click node_utils "https://github.com/devmike117/devmiketools/tree/main/src/utils"
click node_hooks "https://github.com/devmike117/devmiketools/tree/main/src/hooks"
click node_user_ctx "https://github.com/devmike117/devmiketools/blob/main/src/context/UserContext.tsx"
click node_auth_utils "https://github.com/devmike117/devmiketools/blob/main/src/utils/auth.ts"
click node_firebase "https://github.com/devmike117/devmiketools/blob/main/src/config/firebase.ts"
click node_api_layer "https://github.com/devmike117/devmiketools/tree/main/api"
click node_proxy_api "https://github.com/devmike117/devmiketools/blob/main/api/proxy.ts"
click node_counter_api "https://github.com/devmike117/devmiketools/blob/main/api/counter.js"
click node_security_api "https://github.com/devmike117/devmiketools/blob/main/api/security/check-ip.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_app,node_pages,node_home_content toneBlue
class node_components,node_tool_shell,node_guest_ui,node_history_ui toneAmber
class node_modules,node_image_tools,node_doc_media_tools,node_text_tools,node_utils toneMint
class node_hooks,node_user_ctx,node_auth_utils toneRose
class node_api_layer,node_proxy_api,node_counter_api,node_security_api toneIndigo
class node_firebase,node_browser_runtime toneTeal
```

## Components

### Browser SPA

Vite + React app that runs the tool experiences in the browser.

- [App boot](https://github.com/devmike117/devmiketools/blob/main/src/main.tsx): entrypoint · Starts the React application. · `src/main.tsx`
- [Router shell](https://github.com/devmike117/devmiketools/blob/main/src/App.tsx): spa shell · Top-level layout and routing for pages and tool routes. · `src/App.tsx`
- [Tool pages](https://github.com/devmike117/devmiketools/tree/main/src/pages): page orchestration · Standalone pages that connect UI controls to tool modules and results. · `src/pages`
- [Content pages](https://github.com/devmike117/devmiketools/blob/main/src/pages/Home.tsx): marketing/content · Home and informational pages like FAQ, privacy, terms, contact, and installation guidance. · `src/pages/Home.tsx`

### UI Layer

Shared components and app shell used across pages.

- [Shared UI](https://github.com/devmike117/devmiketools/tree/main/src/components): component library · Reusable presentation and interaction components across tools. · `src/components`
- [Tool chrome](https://github.com/devmike117/devmiketools/blob/main/src/components/ToolHeader.tsx): ui scaffold · Headers, navigation, sidebars, upload, preview, download, and modal patterns. · `src/components/ToolHeader.tsx`
- [Guest gates](https://github.com/devmike117/devmiketools/blob/main/src/components/GuestLimitBanner.tsx): limiting UI · Banners and debug surfaces that communicate guest restrictions. · `src/components/GuestLimitBanner.tsx`
- [History panel](https://github.com/devmike117/devmiketools/blob/main/src/components/HistoryPanel.tsx): activity UI · Shows local recent actions and tool history. · `src/components/HistoryPanel.tsx`

### Tool Logic

Domain modules and helper utilities that perform local processing.

- [Tool modules](https://github.com/devmike117/devmiketools/tree/main/src/modules): domain logic · Browser-side processing modules for each major tool capability. · `src/modules`
- [Image tools](https://github.com/devmike117/devmiketools/blob/main/src/modules/imageProcessing.ts): processing suite · Compression, resize, background removal, OCR, thumbnails, HEIC and related image flows. · `src/modules/imageProcessing.ts`
- [Doc/media tools](https://github.com/devmike117/devmiketools/blob/main/src/modules/convert.ts): processing suite · Conversion, PDF, media, and document transformations that run locally. · `src/modules/convert.ts`
- [Text/lookup tools](https://github.com/devmike117/devmiketools/blob/main/src/modules/passwordGenerator.ts): utility suite · Password generation, validation, directory trees, IP lookup, and scraping helpers. · `src/modules/passwordGenerator.ts`
- [Browser helpers](https://github.com/devmike117/devmiketools/tree/main/src/utils): utility layer · Canvas, downloads, file encoding, zip creation, image validation, and Mermaid rendering. · `src/utils`

### State & Auth

User session, premium gating, history, and usage tracking.

- [App hooks](https://github.com/devmike117/devmiketools/tree/main/src/hooks): react hooks · Shared hooks for premium state, guest limits, history, images, and visit counts. · `src/hooks`
- [User context](https://github.com/devmike117/devmiketools/blob/main/src/context/UserContext.tsx): session state · App-wide user and session state provider. · `src/context/UserContext.tsx`
- [Auth utils](https://github.com/devmike117/devmiketools/blob/main/src/utils/auth.ts): auth helpers · Utilities for auth/session handling. · `src/utils/auth.ts`

### Serverless API

Narrow backend surface for proxying, counting, and request protection.

- [Serverless API](https://github.com/devmike117/devmiketools/tree/main/api): edge backend · Small Vercel-style function layer for non-browser tasks. · `api`
- [Proxy/expand](https://github.com/devmike117/devmiketools/blob/main/api/proxy.ts): function · Proxies requests and unshortens URLs when browser-only handling is not enough. · `api/proxy.ts`
- [Visit counter](https://github.com/devmike117/devmiketools/blob/main/api/counter.js): function · Tracks visits or usage counts. · `api/counter.js`
- [Security checks](https://github.com/devmike117/devmiketools/blob/main/api/security/check-ip.js): middleware · Validation, rate limiting, error handling, and IP checks for API requests. · `api/security/check-ip.js`

### External Services

Third-party services used by the app.

- [Firebase auth](https://github.com/devmike117/devmiketools/blob/main/src/config/firebase.ts): identity service · Optional Google sign-in and authentication wiring. · `src/config/firebase.ts`
- **Browser APIs**: runtime boundary · Canvas, file handling, downloads, and other local-first browser capabilities.

## Connections

- App boot → Router shell: mounts · Bootstraps the top-level app shell.
- Router shell → Tool pages: routes to · Routes users to standalone tool and content pages.
- Router shell → Shared UI: composes · Uses shared navigation and layout components.
- Tool pages → Tool chrome: uses · Pages wrap tool UIs with shared controls and chrome.
- Tool pages → Tool modules: orchestrates · Pages pass input into processing modules and render output.
- Tool modules → Browser helpers: depends on · Modules rely on browser helpers for files, canvases, downloads, and rendering.
- Tool modules → Browser APIs: runs in · Primary processing happens locally in the browser.
- Shared UI → Guest gates: includes · Shared UI includes guest restriction surfaces.
- Shared UI → History panel: includes · Shared UI includes local history views.
- App hooks → User context: reads · Hooks consume app-wide user state.
- App hooks → Auth utils: uses · Hooks and state logic use auth helpers.
- Auth utils → Firebase auth: connects · Auth utilities connect to Firebase authentication.
- App hooks → Shared UI: drives · Hooks feed guest banners, premium state, and visit/history UI.
- Serverless API → Proxy/expand: exposes · Serverless layer includes request proxying and URL expansion.
- Serverless API → Visit counter: exposes · Serverless layer includes visit counting.
- Serverless API → Security checks: protects · Middleware and security checks guard API requests.
- Tool pages → App hooks: consults · Pages consult hooks for history, guest limits, and usage state.
- Tool pages → User context: consumes · Pages use user/session context for gated experiences.
- Tool pages → Serverless API: calls · A few tool flows reach the serverless boundary for network-only tasks.
- Shared UI → Browser APIs: renders through · Upload, preview, download, and canvas-driven components depend on browser APIs.
