# prithvin-blip/sharehive-community-rental-network architecture

> Architecture diagram of the GitHub repository prithvin-blip/sharehive-community-rental-network, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prithvin-blip/sharehive-community-rental-network
- Repository: https://github.com/prithvin-blip/sharehive-community-rental-network

## Overview

1. **Top-level shape**
   - This is a **Vite + React + TypeScript single-page app** in `src/`, with Firebase as the main backend service.
   - The repo is structured like an AI Studio starter, but the runtime architecture is mostly a client app with cloud-backed auth/data.

2. **Bootstrap and runtime entry**
   - `index.html` is the Vite shell.
   - `src/main.tsx` mounts the app, loads global styling from `src/index.css`, and hands control to `src/App.tsx`.
   - `vite.config.ts`, `tsconfig.json`, and `package-lock.json` indicate a standard frontend build pipeline rather than a custom server-rendered setup.

3. **Application composition**
   - `src/App.tsx` is the central composition layer.
   - It likely decides whether to show the auth experience or the authenticated application shell based on `useAuth`.
   - `src/components/Layout.tsx` appears to be the persistent frame for signed-in users, hosting the main sections of the product.

4. **Authentication boundary**
   - `src/hooks/useAuth.ts` is the main client-side auth state boundary.
   - `src/components/AuthScreen.tsx` is the unauthenticated entry point for login/signup.
   - `src/lib/firebase.ts` initializes the Firebase client and exposes the auth/database handles used across the app.

5. **Domain/UI subsystems**
   - `Dashboard.tsx` is the main landing view after authentication.
   - `Marketplace.tsx` handles browsing and discovery of listings/items.
   - `SellFlow.tsx` is the creation/onboarding flow for adding a new item/listing.
   - `Profile.tsx` owns user-centric views and settings.
   - `LocationMap.tsx` is a specialized visualization layer for geospatial context around listings or users.

6. **Data flow through the UI**
   - User signs in through `AuthScreen`, which updates auth state through Firebase.
   - `useAuth` propagates the authenticated user into `App`/`Layout`.
   - The main screens then read and write product data, likely through Firebase-backed state, with `Dashboard` acting as the orchestrator of the user’s experience.
   - `SellFlow` feeds new content into the same backend data model that `Marketplace` and `Dashboard` consume.

7. **Shared model and utilities**
   - `src/types.ts` defines the core domain contracts shared by the feature components.
   - `src/lib/utils.ts` provides common helpers used across the UI layer.
   - This reduces coupling between the feature screens and keeps data shape consistent as it moves through auth, listing, profile, and map views.

8. **Backend services and persistence**
   - Firebase is the primary infrastructure boundary for the app.
   - `firestore.rules` defines the security boundary for database access.
   - `firebase-blueprint.json` suggests deployment/configuration metadata for the Firebase project environment.
   - The architecture therefore depends on Firebase not just for storage, but for enforcing who can read/write marketplace data.

9. **AI Studio / Gemini support**
   - The README requires `GEMINI_API_KEY`, so the project is scaffolded to use Gemini-backed functionality.
   - `server.ts` is the only obvious non-frontend source file and likely exists to keep secret-dependent or AI-related calls off the client side.
   - If that server is active in the final runtime, it becomes the boundary between the browser app and Gemini API access.

10. **Repository/runtime boundaries**
   - Browser-facing code lives in `src/`.
   - Cloud state and authorization live in Firebase.
   - Any AI/secret-handling logic is separated from the client by `server.ts` and environment configuration in `.env.example`.
   - `metadata.json` and `assets/.aistudio/` are supporting artifacts for AI Studio/project metadata rather than core product logic.

11. **What an architecture diagram should emphasize**
   - A central **client SPA** with a **Firebase auth/data layer** underneath.
   - A **signed-out vs signed-in split** at the app boundary.
   - A **feature shell** (`Layout`) containing several domain screens: dashboard, marketplace, selling, profile, and map.
   - Security enforced by **Firestore rules**, with possible **server-side AI/proxy logic** isolated in `server.ts`.

Main entry points: [`src/lib/firebase.ts`](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/lib/firebase.ts) (firebase.ts), [`src/components/Layout.tsx`](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/Layout.tsx) (Layout), [`src/App.tsx`](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/App.tsx) (App), [`src/types.ts`](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/types.ts) (types.ts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client SPA"]
  node_index_html["index.html<br/>vite shell<br/>[index.html]"]
  node_main_tsx["main.tsx<br/>bootstrap<br/>[main.tsx]"]
  node_app_tsx["App<br/>composition<br/>[App.tsx]"]
  node_auth_screen["Auth Screen<br/>auth UI<br/>[AuthScreen.tsx]"]
  node_layout["Layout<br/>app shell<br/>[Layout.tsx]"]
  node_use_auth["useAuth<br/>auth state<br/>[useAuth.ts]"]
  node_dashboard["Dashboard<br/>home view<br/>[Dashboard.tsx]"]
  node_marketplace["Marketplace<br/>browse view<br/>[Marketplace.tsx]"]
  node_sell_flow["Sell Flow<br/>create flow<br/>[SellFlow.tsx]"]
  node_profile["Profile<br/>user view<br/>[Profile.tsx]"]
  node_location_map["Location Map<br/>map view<br/>[LocationMap.tsx]"]
end

subgraph group_backend["Backend Boundary"]
  node_firebase_lib["firebase.ts<br/>firebase client<br/>[firebase.ts]"]
  node_firestore_rules["Firestore Rules<br/>security policy<br/>[firestore.rules]"]
  node_server_ts["server.ts<br/>server bridge<br/>[server.ts]"]
end

subgraph group_support["Shared Support"]
  node_types_ts["types.ts<br/>domain model<br/>[types.ts]"]
  node_utils_ts["utils.ts<br/>helpers<br/>[utils.ts]"]
  node_config_artifacts["Config Artifacts<br/>repo config"]
end

node_index_html -->|"loads"| node_main_tsx
node_main_tsx -->|"mounts"| node_app_tsx
node_app_tsx -->|"reads"| node_use_auth
node_app_tsx -->|"shows"| node_auth_screen
node_app_tsx -->|"shows"| node_layout
node_layout -->|"hosts"| node_dashboard
node_layout -->|"hosts"| node_marketplace
node_layout -->|"hosts"| node_sell_flow
node_layout -->|"hosts"| node_profile
node_layout -->|"hosts"| node_location_map
node_auth_screen -->|"authenticates"| node_firebase_lib
node_use_auth -->|"subscribes"| node_firebase_lib
node_dashboard -->|"shares models"| node_types_ts
node_marketplace -->|"shares models"| node_types_ts
node_sell_flow -->|"shares models"| node_types_ts
node_profile -->|"shares models"| node_types_ts
node_location_map -->|"shares models"| node_types_ts
node_dashboard -->|"reads/writes"| node_firebase_lib
node_marketplace -->|"reads"| node_firebase_lib
node_sell_flow -->|"writes"| node_firebase_lib
node_profile -->|"updates"| node_firebase_lib
node_firebase_lib -->|"constrained by"| node_firestore_rules
node_server_ts -.->|"integrates"| node_firebase_lib
node_server_ts -.->|"configured by"| node_config_artifacts
node_app_tsx -.->|"uses"| node_config_artifacts
node_main_tsx -.->|"uses"| node_utils_ts

click node_index_html "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/index.html"
click node_main_tsx "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/main.tsx"
click node_app_tsx "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/App.tsx"
click node_auth_screen "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/AuthScreen.tsx"
click node_layout "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/Layout.tsx"
click node_use_auth "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/hooks/useAuth.ts"
click node_dashboard "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/Dashboard.tsx"
click node_marketplace "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/Marketplace.tsx"
click node_sell_flow "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/SellFlow.tsx"
click node_profile "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/Profile.tsx"
click node_location_map "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/LocationMap.tsx"
click node_firebase_lib "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/lib/firebase.ts"
click node_firestore_rules "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/firestore.rules"
click node_server_ts "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/server.ts"
click node_types_ts "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/types.ts"
click node_utils_ts "https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/lib/utils.ts"

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_index_html,node_main_tsx,node_app_tsx,node_auth_screen,node_layout,node_use_auth,node_dashboard,node_marketplace,node_sell_flow,node_profile,node_location_map toneBlue
class node_firebase_lib,node_firestore_rules,node_server_ts toneAmber
class node_types_ts,node_utils_ts,node_config_artifacts toneMint
```

## Components

### Client SPA

Vite + React frontend that mounts the app and renders the user experience.

- [index.html](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/index.html): vite shell · HTML entry point for the frontend bundle. · `index.html`
- [main.tsx](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/main.tsx): bootstrap · Mounts the React app and loads global styles. · `src/main.tsx`
- [App](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/App.tsx): composition · Top-level app composition and auth-aware routing boundary. · `src/App.tsx`
- [Auth Screen](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/AuthScreen.tsx): auth UI · Signed-out login and signup experience. · `src/components/AuthScreen.tsx`
- [Layout](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/Layout.tsx): app shell · Persistent signed-in frame that hosts the main product sections. · `src/components/Layout.tsx`
- [useAuth](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/hooks/useAuth.ts): auth state · Client auth state boundary shared by the app shell. · `src/hooks/useAuth.ts`
- [Dashboard](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/Dashboard.tsx): home view · Primary landing view after authentication. · `src/components/Dashboard.tsx`
- [Marketplace](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/Marketplace.tsx): browse view · Discovery and browsing surface for listings or items. · `src/components/Marketplace.tsx`
- [Sell Flow](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/SellFlow.tsx): create flow · Flow for adding a new listing or item. · `src/components/SellFlow.tsx`
- [Profile](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/Profile.tsx): user view · User-centric profile and settings surface. · `src/components/Profile.tsx`
- [Location Map](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/components/LocationMap.tsx): map view · Geospatial visualization for listings or users. · `src/components/LocationMap.tsx`

### Backend Boundary

Firebase services, security rules, and optional server-side secret handling.

- [firebase.ts](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/lib/firebase.ts): firebase client · Initializes Firebase and exposes auth/database handles. · `src/lib/firebase.ts`
- [Firestore Rules](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/firestore.rules): security policy · Access control rules for database reads and writes. · `firestore.rules`
- [server.ts](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/server.ts): server bridge · Optional server-side boundary for secret or AI-related calls. · `server.ts`

### Shared Support

Shared types, utilities, and repository metadata used across the app.

- [types.ts](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/types.ts): domain model · Shared domain contracts used across feature screens. · `src/types.ts`
- [utils.ts](https://github.com/prithvin-blip/sharehive-community-rental-network/blob/main/src/lib/utils.ts): helpers · Common UI and data helpers. · `src/lib/utils.ts`
- **Config Artifacts**: repo config · Project metadata and build/config files supporting the runtime.

## Connections

- index.html → main.tsx: loads · Vite uses the HTML shell to start the client bundle.
- main.tsx → App: mounts · Bootstraps the React application at the top level.
- App → useAuth: reads · Determines signed-out vs signed-in rendering.
- App → Auth Screen: shows · Routes unauthenticated users to the login flow.
- App → Layout: shows · Hands authenticated users to the app shell.
- Layout → Dashboard: hosts · Primary navigation starts from the dashboard view.
- Layout → Marketplace: hosts · Exposes browsing and discovery.
- Layout → Sell Flow: hosts · Exposes item creation or onboarding.
- Layout → Profile: hosts · Exposes user profile and settings.
- Layout → Location Map: hosts · Provides geospatial context inside the signed-in shell.
- Auth Screen → firebase.ts: authenticates · Uses Firebase auth for sign-in and sign-up.
- useAuth → firebase.ts: subscribes · Listens to Firebase auth state and session changes.
- Dashboard → types.ts: shares models · Uses the shared domain contracts for consistent data shape.
- Marketplace → types.ts: shares models · Uses shared listing and profile shapes.
- Sell Flow → types.ts: shares models · Creates data that conforms to the common domain model.
- Profile → types.ts: shares models · Reads and updates user-shaped data.
- Location Map → types.ts: shares models · Consumes shared location and listing data.
- Dashboard → firebase.ts: reads/writes · Acts as a central consumer of backend data.
- Marketplace → firebase.ts: reads · Pulls marketplace data from Firebase.
- Sell Flow → firebase.ts: writes · Publishes new listings or items into Firebase.
- Profile → firebase.ts: updates · Persists user profile changes through Firebase.
- firebase.ts → Firestore Rules: constrained by · Database access is enforced by Firestore security rules.
- server.ts → firebase.ts: integrates · Can share the same backend project boundary.
- server.ts → Config Artifacts: configured by · Depends on repository environment and project metadata.
- App → Config Artifacts: uses · Build and project config support the SPA runtime.
- main.tsx → utils.ts: uses · Shared helpers support client-side rendering and glue code.
