How ankushkarn/rs-rooms-admin works
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: layout.tsx Dashboard shell · api.ts API layer · Card.tsx UI primitives · page.tsx Dashboard home
Components 20
Public entry
Unauthenticated landing and splash entry points.
Admin area
Admin login and entity management routes.
- Admin login · Admin authentication entry.
src/app/admin/login/page.tsx - Create booking · Admin booking creation flow.
src/app/admin/createBooking/page.tsx - PG admin · Admin PG detail and add/edit flows.
src/app/admin/pg/[pgId]/page.tsx - User detail · Admin user drill-down page.
src/app/admin/user/[id]/page.tsx
Dashboard workspace
Authenticated operational console and its domain pages.
- Dashboard shell · Authenticated workspace layout wrapper.
src/app/dashboard/layout.tsx - Dashboard home · Main workspace landing page.
src/app/dashboard/page.tsx - Operations pages · Bookings, complaints, bills, expenses, notifications, owners, payments, PG listings, students, vendors, and building details.
src/app/dashboard/bookings/page.tsx - Statistics · 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 · Client-side admin access control.
src/hooks/useAdminAuth.ts - Protected route · Route-level access protection wrapper.
src/components/ProtectedRoute.tsx - Sidebar · Persistent workspace navigation.
src/components/layout/Sidebar.tsx - Topbar · Top navigation and page chrome.
src/components/layout/Topbar.tsx - API layer · Shared outbound request boundary.
src/app/utils/api.ts - UI primitives · Reusable cards, tables, modals, buttons, inputs, labels, avatars, and dropdowns.
src/components/ui/Card.tsx - Feature modals · Expense and notification modal workflows.
src/components/modals/AddExpenseModal.tsx - Revenue chart · 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 · GitHub Actions deployment pipeline.
.github/workflows/deploy.yml - Frontend config · Next.js, linting, styling, and component toolchain configuration.
next.config.ts
Connections 24
- 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.