# ankushkarn/rs-rooms-admin architecture

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

- Interactive diagram: https://gitdiagram.com/ankushkarn/rs-rooms-admin
- Repository: https://github.com/ankushkarn/rs-rooms-admin

## Overview

1. This is a Next.js App Router application written in TypeScript. The architecture is primarily a client-facing admin/operations portal, with most functionality implemented as route pages under `src/app` and shared UI/state helpers in `src/components`, `src/hooks`, and `src/app/utils`.

2. The app has three major route areas:
   - a public entry flow at `src/app/page.tsx` and `src/app/splash/page.tsx`,
   - an `/admin` area for admin login and entity management,
   - a `/dashboard` area for the main authenticated workspace.

3. The `/dashboard` subtree is the core subsystem. It contains dedicated pages for operational domains such as bookings, complaints, electricity bills, expenses, notifications, owners, payments, PG listings, statistics, students, vendors, and building details. This suggests a domain-heavy management console rather than a generic marketing site.

4. The `/admin` subtree is a secondary management surface. It includes admin login, booking creation, PG creation/editing, and user detail pages. The presence of dynamic routes like `pg/[pgId]` and `user/[id]` indicates entity-centric drill-down/edit flows.

5. Authentication and route protection are handled on the client side by `src/hooks/useAdminAuth.ts` and `src/components/ProtectedRoute.tsx`. These are likely used to gate access to the privileged areas, rather than relying on visible server-side route handlers in this repo.

6. Shared layout is centralized. `src/app/dashboard/layout.tsx` wraps dashboard pages, while `src/components/layout/Sidebar.tsx` and `Topbar.tsx` provide persistent navigation chrome. This implies the dashboard is a shell layout with many content pages mounted inside it.

7. UI composition is built from reusable primitives in `src/components/ui` such as cards, tables, modals, buttons, inputs, labels, avatars, and dropdown menus. Feature-specific overlay components like `AddExpenseModal` and `SendNotificationModal` sit on top of those primitives.

8. Data visualization is handled separately through `src/components/charts/RevenueChart.tsx`, which likely feeds the statistics/dashboard pages. That makes charts a distinct presentation layer for aggregated operational data, not embedded directly into page code.

9. The app’s data access boundary appears to be `src/app/utils/api.ts`. That file likely concentrates outbound requests to backend services, so pages and modals can consume a shared API layer instead of calling remote endpoints ad hoc.

10. The repository does not show Next.js API routes or a database layer, so the frontend likely depends on an external backend or mock/static data source. One notable asset is `public/admin-login.json`, which may serve as a local credential/config seed for admin authentication during development or demo use.

11. Styling and global shell concerns are handled through `src/app/globals.css`, `src/app/layout.tsx`, and supporting config files. The project also includes `next.config.ts`, ESLint, PostCSS, and component configuration, indicating a standard Next.js frontend toolchain.

12. Deployment is wired through GitHub Actions in `.github/workflows/deploy.yml`, so the repo has CI/CD concerns separated from the app code. An architecture diagram should show the frontend app as the main runtime, with deployment as an external pipeline rather than part of request handling.

13. In diagram terms, the main flow is: user enters public/login pages → authentication guard establishes access → dashboard/admin layouts render navigation shell → feature pages load data via the shared API layer → reusable tables/modals/charts present and mutate domain entities.

14. The most important boundaries to capture are: public vs authenticated areas, dashboard shell vs feature pages, shared UI vs domain pages, and frontend-only logic vs external backend/API dependencies.

Main entry points: [`src/app/dashboard/layout.tsx`](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/dashboard/layout.tsx) (Dashboard shell), [`src/app/utils/api.ts`](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/utils/api.ts) (API layer), [`src/components/ui/Card.tsx`](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/components/ui/Card.tsx) (UI primitives), [`src/app/dashboard/page.tsx`](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/dashboard/page.tsx) (Dashboard home)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_public["Public entry"]
  node_node_home["Home<br/>route page<br/>[page.tsx]"]
  node_node_splash["Splash<br/>route page<br/>[page.tsx]"]
end

subgraph group_grp_admin["Admin area"]
  node_node_admin_login["Admin login<br/>route page<br/>[page.tsx]"]
  node_node_admin_booking["Create booking<br/>route page<br/>[page.tsx]"]
  node_node_admin_pg["PG admin<br/>route pages<br/>[page.tsx]"]
  node_node_admin_user["User detail<br/>route page<br/>[page.tsx]"]
end

subgraph group_grp_dashboard["Dashboard workspace"]
  node_node_dashboard_shell["Dashboard shell<br/>layout<br/>[layout.tsx]"]
  node_node_dashboard_home["Dashboard home<br/>route page<br/>[page.tsx]"]
  node_node_dashboard_ops["Operations pages<br/>route cluster<br/>[page.tsx]"]
  node_node_dashboard_stats["Statistics<br/>route page<br/>[page.tsx]"]
end

subgraph group_grp_shared["Shared app layer"]
  node_node_auth(("Auth guard<br/>hook/guard<br/>[useAdminAuth.ts]"))
  node_node_protected(("Protected route<br/>route guard<br/>[ProtectedRoute.tsx]"))
  node_node_sidebar["Sidebar<br/>layout nav<br/>[Sidebar.tsx]"]
  node_node_topbar["Topbar<br/>layout chrome<br/>[Topbar.tsx]"]
  node_node_api["API layer<br/>client api<br/>[api.ts]"]
  node_node_ui{{"UI primitives<br/>component kit<br/>[Card.tsx]"}}
  node_node_modals["Feature modals<br/>overlay components"]
  node_node_chart(("Revenue chart<br/>chart component<br/>[RevenueChart.tsx]"))
end

subgraph group_grp_infra["Delivery and tooling"]
  node_node_deploy["Deploy workflow<br/>ci/cd<br/>[deploy.yml]"]
  node_node_config["Frontend config<br/>tooling<br/>[next.config.ts]"]
end

node_node_home -->|"entry path"| node_node_splash
node_node_home -->|"route to auth"| node_node_auth
node_node_splash -->|"login surface"| node_node_admin_login
node_node_admin_login -->|"authenticate"| node_node_auth
node_node_auth -->|"gate access"| node_node_protected
node_node_protected -->|"allow workspace"| node_node_dashboard_shell
node_node_dashboard_shell -->|"render nav"| node_node_sidebar
node_node_dashboard_shell -->|"render chrome"| node_node_topbar
node_node_dashboard_shell -->|"mount home"| node_node_dashboard_home
node_node_dashboard_shell -->|"mount domains"| node_node_dashboard_ops
node_node_dashboard_shell -->|"mount analytics"| node_node_dashboard_stats
node_node_dashboard_home -->|"load data"| node_node_api
node_node_dashboard_ops -->|"fetch/mutate"| node_node_api
node_node_dashboard_stats -->|"visualize"| node_node_chart
node_node_dashboard_ops -->|"open overlays"| node_node_modals
node_node_modals -->|"compose"| node_node_ui
node_node_sidebar -->|"compose"| node_node_ui
node_node_topbar -->|"compose"| node_node_ui
node_node_dashboard_home -->|"render"| node_node_ui
node_node_admin_booking -->|"create"| node_node_api
node_node_admin_pg -->|"manage"| node_node_api
node_node_admin_user -->|"load detail"| node_node_api
node_node_dashboard_shell -->|"embed"| node_node_chart
node_node_deploy -.->|"uses"| node_node_config

click node_node_home "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/page.tsx"
click node_node_splash "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/splash/page.tsx"
click node_node_admin_login "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/admin/login/page.tsx"
click node_node_admin_booking "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/admin/createBooking/page.tsx"
click node_node_admin_pg "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/admin/pg/[pgId]/page.tsx"
click node_node_admin_user "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/admin/user/[id]/page.tsx"
click node_node_dashboard_shell "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/dashboard/layout.tsx"
click node_node_dashboard_home "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/dashboard/page.tsx"
click node_node_dashboard_ops "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/dashboard/bookings/page.tsx"
click node_node_dashboard_stats "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/dashboard/statistics/page.tsx"
click node_node_auth "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/hooks/useAdminAuth.ts"
click node_node_protected "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/components/ProtectedRoute.tsx"
click node_node_sidebar "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/components/layout/Sidebar.tsx"
click node_node_topbar "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/components/layout/Topbar.tsx"
click node_node_api "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/utils/api.ts"
click node_node_ui "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/components/ui/Card.tsx"
click node_node_modals "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/components/modals/AddExpenseModal.tsx"
click node_node_chart "https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/components/charts/RevenueChart.tsx"
click node_node_deploy "https://github.com/ankushkarn/rs-rooms-admin/blob/main/.github/workflows/deploy.yml"
click node_node_config "https://github.com/ankushkarn/rs-rooms-admin/blob/main/next.config.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_node_home,node_node_splash toneBlue
class node_node_admin_login,node_node_admin_booking,node_node_admin_pg,node_node_admin_user toneAmber
class node_node_dashboard_shell,node_node_dashboard_home,node_node_dashboard_ops,node_node_dashboard_stats toneMint
class node_node_auth,node_node_protected,node_node_sidebar,node_node_topbar,node_node_api,node_node_ui,node_node_modals,node_node_chart toneRose
class node_node_deploy,node_node_config toneIndigo
```

## Components

### Public entry

Unauthenticated landing and splash entry points.

- [Home](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/page.tsx): route page · Public entry page. · `src/app/page.tsx`
- [Splash](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/splash/page.tsx): route page · Public splash/intro page. · `src/app/splash/page.tsx`

### Admin area

Admin login and entity management routes.

- [Admin login](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/admin/login/page.tsx): route page · Admin authentication entry. · `src/app/admin/login/page.tsx`
- [Create booking](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/admin/createBooking/page.tsx): route page · Admin booking creation flow. · `src/app/admin/createBooking/page.tsx`
- [PG admin](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/admin/pg/[pgId]/page.tsx): route pages · Admin PG detail and add/edit flows. · `src/app/admin/pg/[pgId]/page.tsx`
- [User detail](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/admin/user/[id]/page.tsx): route page · Admin user drill-down page. · `src/app/admin/user/[id]/page.tsx`

### Dashboard workspace

Authenticated operational console and its domain pages.

- [Dashboard shell](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/dashboard/layout.tsx): layout · Authenticated workspace layout wrapper. · `src/app/dashboard/layout.tsx`
- [Dashboard home](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/dashboard/page.tsx): route page · Main workspace landing page. · `src/app/dashboard/page.tsx`
- [Operations pages](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/dashboard/bookings/page.tsx): route cluster · Bookings, complaints, bills, expenses, notifications, owners, payments, PG listings, students, vendors, and building details. · `src/app/dashboard/bookings/page.tsx`
- [Statistics](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/dashboard/statistics/page.tsx): route page · Aggregated operational metrics and reporting. · `src/app/dashboard/statistics/page.tsx`

### Shared app layer

Reusable layout, guards, UI primitives, and client-side helpers.

- [Auth guard](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/hooks/useAdminAuth.ts): hook/guard · Client-side admin access control. · `src/hooks/useAdminAuth.ts`
- [Protected route](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/components/ProtectedRoute.tsx): route guard · Route-level access protection wrapper. · `src/components/ProtectedRoute.tsx`
- [Sidebar](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/components/layout/Sidebar.tsx): layout nav · Persistent workspace navigation. · `src/components/layout/Sidebar.tsx`
- [Topbar](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/components/layout/Topbar.tsx): layout chrome · Top navigation and page chrome. · `src/components/layout/Topbar.tsx`
- [API layer](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/app/utils/api.ts): client api · Shared outbound request boundary. · `src/app/utils/api.ts`
- [UI primitives](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/components/ui/Card.tsx): component kit · Reusable cards, tables, modals, buttons, inputs, labels, avatars, and dropdowns. · `src/components/ui/Card.tsx`
- [Feature modals](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/components/modals/AddExpenseModal.tsx): overlay components · Expense and notification modal workflows. · `src/components/modals/AddExpenseModal.tsx`
- [Revenue chart](https://github.com/ankushkarn/rs-rooms-admin/blob/main/src/components/charts/RevenueChart.tsx): chart component · Aggregated data visualization for statistics and dashboard views. · `src/components/charts/RevenueChart.tsx`

### Delivery and tooling

Deployment pipeline and project-level frontend configuration.

- [Deploy workflow](https://github.com/ankushkarn/rs-rooms-admin/blob/main/.github/workflows/deploy.yml): ci/cd · GitHub Actions deployment pipeline. · `.github/workflows/deploy.yml`
- [Frontend config](https://github.com/ankushkarn/rs-rooms-admin/blob/main/next.config.ts): tooling · Next.js, linting, styling, and component toolchain configuration. · `next.config.ts`

## Connections

- Home → Splash: entry path · Public users enter through the landing flow.
- Home → Auth guard: route to auth · Public entry can lead into authenticated access.
- Splash → Admin login: login surface · Splash or entry flow can route to admin sign-in.
- Admin login → Auth guard: authenticate · Login relies on the client-side auth hook.
- Auth guard → Protected route: gate access · Authentication state feeds route protection.
- Protected route → Dashboard shell: allow workspace · Protected sessions unlock the dashboard shell.
- Dashboard shell → Sidebar: render nav · The dashboard layout composes persistent navigation.
- Dashboard shell → Topbar: render chrome · The dashboard layout composes top-level chrome.
- Dashboard shell → Dashboard home: mount home · The shell hosts the workspace landing page.
- Dashboard shell → Operations pages: mount domains · The shell hosts operational domain pages.
- Dashboard shell → Statistics: mount analytics · The shell hosts reporting views.
- Dashboard home → API layer: load data · Dashboard landing pulls shared data through the API layer.
- Operations pages → API layer: fetch/mutate · Operational pages use the shared API boundary.
- Statistics → Revenue chart: visualize · Statistics views consume charting for aggregated metrics.
- Operations pages → Feature modals: open overlays · Domain pages use feature-specific modals for actions.
- Feature modals → UI primitives: compose · Modals are built from shared UI primitives.
- Sidebar → UI primitives: compose · Navigation uses shared UI primitives.
- Topbar → UI primitives: compose · Topbar uses shared UI primitives.
- Dashboard home → UI primitives: render · Pages use cards, tables, and inputs for presentation.
- Create booking → API layer: create · Admin booking creation uses the shared API layer.
- PG admin → API layer: manage · PG detail and add/edit flows use the shared API layer.
- User detail → API layer: load detail · User detail pages fetch entity data through the API layer.
- Dashboard shell → Revenue chart: embed · Charts can also appear in the dashboard workspace.
- Deploy workflow → Frontend config: uses · Deployment is separate from app runtime but follows project tooling.
