# rahulkamilya/no-pass architecture

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

- Interactive diagram: https://gitdiagram.com/rahulkamilya/no-pass
- Repository: https://github.com/rahulkamilya/no-pass

## Overview

##### Project type and purpose
- This is a client-heavy, single-page full-stack web application (a password manager) built with React/TypeScript, Vite, Tailwind CSS, and shadcn-ui.
- It delegates all server-side concerns (authentication, data storage) to Firebase (Auth & Firestore).

##### File structure
- Top-level files: Vite configs (vite.config.ts), Tailwind config (tailwind.config.ts), tsconfig files, package managers’ lockfiles.
- `public/`: static assets (manifest.json, robots.txt).
- `src/`: core source tree
· `pages/`: Next-style route components (Dashboard, Home, NotFound).
· `components/`: UI building blocks and feature widgets (AddPasswordForm, PasswordList, SearchBar).
· `components/ui/`: shadcn-ui primitives.
· `contexts/AuthContext.tsx`: global auth state provider.
· `hooks/`: custom React hooks (`useFirestore`, `useToast`, `useMobile`).
· `lib/firebase.ts`: Firebase initialization.
· `services/dataService.ts`: wrapper over Firestore CRUD.
- No server code: all “backend” calls go to Firebase.

##### README for additional insights
- Confirms tech stack (Vite, React, TypeScript, Tailwind, shadcn-ui).
- Deployment is a static site (hosted via Lovable), with optional custom domains.

##### Main components
a. Frontend SPA (React app)
- UI layer: shadcn-ui + Tailwind CSS
- Routing layer: `src/pages` + React Router (or similar)
- State & Context: `AuthContext`, React state/hooks
- Feature modules: PasswordList, AddPasswordForm, SearchBar, UserProfileForm
b. Backend-as-a-Service (Firebase)
- Firebase Authentication
- Firestore database
c. Development & Build toolchain
- Node.js environment + Vite (dev server, HMR, build)
d. Hosting / CDN
- Static file host (Lovable CDN or any static-site host)
e. External integrations
- Browser local storage or Cookies (for storing auth tokens)
- Optional external domain via DNS

##### Relationships & interactions
- Client ↔ Firebase Auth: signup, login, token lifecycle
- Client ↔ Firestore: CRUD operations on password records via `dataService` & `useFirestore` hook
- Client UI ↔ Contexts/Hooks: share auth state, show toast notifications, responsive behavior
- Developer’s machine ↔ Vite Dev Server: code edit → hot reload
- CI/CD/Hosting: build artifacts pushed to CDN

##### Architectural patterns & design principles
- Component-based architecture (atomic UI + feature components)
- Unidirectional data flow (React state → props → events → service calls → state updates)
- Context API for cross-cutting concerns (authentication, theming, toasts)
- Service layer for remote data (dataService abstraction over Firestore)
- Separation of concerns: UI, hooks, contexts, services, lib

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer Environment & Build Tooling
    subgraph "Developer Environment & Build Tooling"
        direction TB
        NodeJS["Node.js"]:::build
        ViteDev["Vite Dev Server (HMR)"]:::build
        NodeJS -->|"runs"| ViteDev
        ViteDev -->|"serves"| Main
    end

    %% Client Browser Layer
    subgraph "Client Browser (React SPA)"  
        direction TB
        Main["src/main.tsx"]:::client
        App["src/App.tsx"]:::client
        subgraph "UI Layer (shadcn-ui & Tailwind)"  
            direction TB
            UIPrimitives["UI Primitives"]:::client
        end
        subgraph "Routing Layer (Pages)"  
            direction TB
            HomePage["Home.tsx"]:::client
            DashboardPage["Dashboard.tsx"]:::client
            NotFoundPage["NotFound.tsx"]:::client
            TempPage["temp.tsx"]:::client
        end
        AuthCtx["AuthContext"]:::client
        subgraph "Feature Components"
            direction TB
            AddForm["AddPasswordForm"]:::client
            PassList["PasswordList"]:::client
            SearchBar["SearchBar"]:::client
            UserProfile["UserProfileForm"]:::client
            PassItem["PasswordItem"]:::client
            CardItem["CardItem"]:::client
            EmptyState["EmptyState"]:::client
            AddButton["AddButton"]:::client
        end
        subgraph "Custom Hooks"
            direction TB
            UseFS["useFirestore"]:::client
            UseToast["use-toast"]:::client
            UseMobile["use-mobile"]:::client
        end
        ServiceLayer["dataService"]:::client
        FirebaseInit["firebase.ts"]:::client
        Utils["utils.ts"]:::client

        Main -->|"renders"| App
        App -->|"uses"| UIPrimitives
        App -->|"routes to"| HomePage
        App -->|"routes to"| DashboardPage
        App -->|"routes to"| NotFoundPage
        App -->|"routes to"| TempPage
        App -->|"wraps with"| AuthCtx
        AuthCtx -->|"provides auth state"| App
        AddForm -->|"calls"| ServiceLayer
        PassList -->|"calls"| ServiceLayer
        SearchBar -->|"filters"| PassList
        UserProfile -->|"calls"| ServiceLayer
        ServiceLayer -->|"initializes via"| FirebaseInit
        ServiceLayer -->|"uses"| UseFS
        UseFS -->|"calls Firestore API"| Firestore
        App -->|"uses hook"| UseToast
        App -->|"uses hook"| UseMobile
        App -->|"imports"| Utils
    end

    %% BaaS Layer
    subgraph "Backend-as-a-Service (Firebase)"  
        direction TB
        FirebaseAuth["Firebase Auth"]:::backend
        Firestore["Firestore"]:::backend
        FirebaseAuth -->|"issues tokens"| App
        Firestore -->|"stores password records"| ServiceLayer
    end

    %% Hosting/CDN
    subgraph "Hosting & CDN"  
        direction TB
        CDN["Lovable CDN"]:::external
        Public["public/"]:::external
        IndexHTML["index.html"]:::external
        ViteDev -->|"build -> dist"| CDN
        Public -->|"assets served"| CDN
        CDN -->|"delivers"| App
    end

    %% Click Events
    click Main "https://github.com/rahulkamilya/no-pass/blob/master/src/main.tsx"
    click App "https://github.com/rahulkamilya/no-pass/blob/master/src/App.tsx"
    click UIPrimitives "https://github.com/rahulkamilya/no-pass/tree/master/src/components/ui"
    click HomePage "https://github.com/rahulkamilya/no-pass/blob/master/src/pages/Home.tsx"
    click DashboardPage "https://github.com/rahulkamilya/no-pass/blob/master/src/pages/Dashboard.tsx"
    click NotFoundPage "https://github.com/rahulkamilya/no-pass/blob/master/src/pages/NotFound.tsx"
    click TempPage "https://github.com/rahulkamilya/no-pass/blob/master/src/pages/temp.tsx"
    click AuthCtx "https://github.com/rahulkamilya/no-pass/blob/master/src/contexts/AuthContext.tsx"
    click AddForm "https://github.com/rahulkamilya/no-pass/blob/master/src/components/AddPasswordForm.tsx"
    click PassList "https://github.com/rahulkamilya/no-pass/blob/master/src/components/PasswordList.tsx"
    click SearchBar "https://github.com/rahulkamilya/no-pass/blob/master/src/components/SearchBar.tsx"
    click UserProfile "https://github.com/rahulkamilya/no-pass/blob/master/src/components/UserProfileForm.tsx"
    click PassItem "https://github.com/rahulkamilya/no-pass/blob/master/src/components/PasswordItem.tsx"
    click CardItem "https://github.com/rahulkamilya/no-pass/blob/master/src/components/CardItem.tsx"
    click EmptyState "https://github.com/rahulkamilya/no-pass/blob/master/src/components/EmptyState.tsx"
    click AddButton "https://github.com/rahulkamilya/no-pass/blob/master/src/components/AddButton.tsx"
    click UseFS "https://github.com/rahulkamilya/no-pass/blob/master/src/hooks/useFirestore.ts"
    click UseToast "https://github.com/rahulkamilya/no-pass/blob/master/src/hooks/use-toast.ts"
    click UseMobile "https://github.com/rahulkamilya/no-pass/blob/master/src/hooks/use-mobile.tsx"
    click ServiceLayer "https://github.com/rahulkamilya/no-pass/blob/master/src/services/dataService.ts"
    click FirebaseInit "https://github.com/rahulkamilya/no-pass/blob/master/src/lib/firebase.ts"
    click Utils "https://github.com/rahulkamilya/no-pass/blob/master/src/lib/utils.ts"
    click Public "https://github.com/rahulkamilya/no-pass/tree/master/public/"
    click IndexHTML "https://github.com/rahulkamilya/no-pass/blob/master/index.html"

    %% Styles
    classDef client fill:#AEDFF7,stroke:#0366d6,color:#000
    classDef backend fill:#C6F6D5,stroke:#2F855A,color:#000
    classDef build fill:#FEEBC8,stroke:#DD6B20,color:#000
    classDef external fill:#E2E8F0,stroke:#4A5568,color:#000
```
