# rahul1015s/rahulwebdev architecture

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

- Interactive diagram: https://gitdiagram.com/rahul1015s/rahulwebdev
- Repository: https://github.com/rahul1015s/rahulwebdev

## Overview

1. This is a Next.js App Router portfolio site for Rahul Verma, built as a hybrid of public marketing pages, a content site, and several authenticated admin/dashboard surfaces.

2. The top-level `app/` directory is the main boundary. It is split into route groups for:
   - public-facing pages (`app/(public)`, `app/blog`, `app/case-studies`, landing pages, resume)
   - authentication flows (`app/(auth)`)
   - authenticated admin tools (`app/admin`)
   - authenticated personal dashboard (`app/dashboard`)
   - API route handlers (`app/api/...`)

3. The public site is mostly static/SEO-driven, with reusable sections and landing components assembled from `components/sections`, `components/landing`, `components/layout`, and `components/cards`. The homepage and local-service landing pages appear to be marketing-oriented, while blog and case-study pages are content-driven.

4. Blog content is a major subsystem. There are public blog list/detail pages, blog-specific components, and API endpoints for blog data and Open Graph image generation. Blog rendering also tracks visitors, with dedicated visitor-count components and visitor-related models/API routes.

5. Case studies are a second content subsystem, parallel to blog. They have public listing/detail routes plus admin CRUD pages and API endpoints for create/read/update/delete. This suggests content is persisted in a backend datastore rather than hardcoded.

6. The admin area is a content management surface for blog posts, case studies, newsletter tools, and site settings. It uses dedicated admin components such as editors, tables, and row actions, and exposes matching `/api/admin/*` endpoints for server-side mutations.

7. The dashboard area is separate from admin and looks more like a personal productivity/data dashboard. It includes pages for focus and settings, plus server actions and API routes for GitHub and contest data, indicating live aggregation from external services.

8. Authentication is handled as a first-class subsystem, with pages for login, signup, magic-link, forgot-password, two-factor, and email verification. The auth implementation is split between `lib/auth.ts`, `lib/auth-client.ts`, `providers/AuthProvider.tsx`, and the catch-all auth API route, so auth state and session handling are centralized.

9. Persistence is MongoDB-based. The `models/` directory contains schemas for posts, case studies, visitors, tags, categories, newsletter subscribers, site settings, dashboard stats, streaks, and focus-day data, which shows the app uses a document database for both content and user/activity records.

10. Cross-cutting backend logic lives in `lib/`. This includes API helpers, SEO configuration, blog utilities, newsletter/email templates, token handling, landing-variant selection, and dashboard integrations. The `lib/dashboard/` subfolder likely orchestrates external data fetching and domain-specific transformations for the dashboard views.

11. Newsletter functionality is a standalone flow. There are public subscribe/unsubscribe/confirm/send API routes, a newsletter form component, and email template utilities, which implies email delivery and tokenized subscription confirmation are part of the architecture.

12. The app also includes infrastructure for SEO, metadata, and crawlability: custom robots/sitemap routes, a manifest, SEO helpers, and Open Graph image endpoints. That makes search visibility and share cards an explicit part of the site design.

13. Shared UI is organized by concern rather than by route. `components/ui` contains the design system primitives, while feature folders like `components/auth`, `components/blog`, `components/dashboard`, `components/newsletter`, and `components/admin` wrap those primitives into higher-level workflows.

14. Supporting providers and hooks handle global client behavior such as analytics, theming, responsive behavior, and likely auth/session context. This keeps the route components focused on page composition while shared runtime concerns stay in one place.

15. Overall data flow is: browser pages render from App Router routes, feature components call route handlers or server actions, API routes read/write MongoDB models and sometimes external services (GitHub/contest data, email delivery), and SEO/OG/robots/sitemap endpoints support discoverability and sharing.

Main entry points: [`app/layout.tsx`](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/layout.tsx) (App shell), [`app/blog/page.tsx`](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/blog/page.tsx) (Blog & cases), [`lib/auth.ts`](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/lib/auth.ts) (Backend lib), [`models/post.ts`](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/models/post.ts) (Mongo models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_public["Public site"]
  node_node_public_home["Home<br/>marketing route<br/>[page.tsx]"]
  node_node_public_content["Blog & cases<br/>content routes<br/>[page.tsx]"]
  node_node_resume["Resume<br/>static route<br/>[layout.tsx]"]
  node_node_public_ui["Public UI<br/>shared components<br/>[HeroSection.tsx]"]
  node_node_content_ui["Content UI<br/>feature components<br/>[BlogClient.tsx]"]
end

subgraph group_grp_auth["Auth flows"]
  node_node_auth["Auth flows<br/>auth routes<br/>[page.tsx]"]
  node_node_api_auth["Auth API<br/>session backend<br/>[route.ts]"]
end

subgraph group_grp_admin["Admin CMS"]
  node_node_admin["Admin console<br/>admin routes<br/>[page.tsx]"]
  node_node_api_admin["Admin APIs<br/>mutations<br/>[route.ts]"]
  node_node_admin_ui["Admin UI<br/>feature components<br/>[PostTable.tsx]"]
end

subgraph group_grp_dashboard["Personal dashboard"]
  node_node_dashboard["Dashboard<br/>[page.tsx]"]
  node_node_api_dashboard["Dashboard APIs<br/>integrations<br/>[route.ts]"]
  node_node_dashboard_ui["Dashboard UI<br/>feature components"]
end

subgraph group_grp_platform["Platform"]
  node_node_app_shell["App shell<br/>Next.js root<br/>[layout.tsx]"]
  node_node_api_content["Content APIs<br/>route handlers<br/>[route.ts]"]
  node_node_api_newsletter["Newsletter APIs<br/>email flow<br/>[route.ts]"]
  node_node_platform_lib["Backend lib<br/>helpers<br/>[auth.ts]"]
  node_node_data_models[("Mongo models<br/>persistence<br/>[post.ts]")]
  node_node_client_runtime["Client runtime<br/>providers & hooks<br/>[AuthProvider.tsx]"]
end

node_node_app_shell -->|"renders"| node_node_public_home
node_node_app_shell -->|"routes"| node_node_auth
node_node_app_shell -->|"routes"| node_node_admin
node_node_app_shell -->|"routes"| node_node_dashboard
node_node_app_shell -->|"routes"| node_node_public_content
node_node_public_home -->|"composes"| node_node_public_ui
node_node_public_content -->|"uses"| node_node_content_ui
node_node_public_content -->|"reads"| node_node_api_content
node_node_public_content -->|"persists"| node_node_data_models
node_node_admin -->|"composes"| node_node_admin_ui
node_node_admin -->|"mutates"| node_node_api_admin
node_node_api_admin -->|"writes"| node_node_data_models
node_node_dashboard -->|"composes"| node_node_dashboard_ui
node_node_dashboard -->|"reads"| node_node_api_dashboard
node_node_api_dashboard -->|"uses"| node_node_platform_lib
node_node_api_dashboard -->|"reads"| node_node_data_models
node_node_auth -->|"authenticates"| node_node_api_auth
node_node_api_auth -->|"uses"| node_node_platform_lib
node_node_api_newsletter -->|"uses"| node_node_platform_lib
node_node_api_newsletter -->|"writes"| node_node_data_models
node_node_content_ui -->|"uses"| node_node_platform_lib
node_node_public_ui -->|"depends on"| node_node_client_runtime
node_node_admin_ui -->|"depends on"| node_node_client_runtime
node_node_dashboard_ui -->|"depends on"| node_node_client_runtime

click node_node_app_shell "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/layout.tsx"
click node_node_public_home "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/page.tsx"
click node_node_public_content "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/blog/page.tsx"
click node_node_resume "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/resume/layout.tsx"
click node_node_auth "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/(auth)/login/page.tsx"
click node_node_admin "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/admin/page.tsx"
click node_node_dashboard "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/dashboard/page.tsx"
click node_node_api_content "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/api/blog/route.ts"
click node_node_api_admin "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/api/admin/posts/route.ts"
click node_node_api_dashboard "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/api/dashboard/github/route.ts"
click node_node_api_newsletter "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/api/newsletter/subscribe/route.ts"
click node_node_api_auth "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/api/auth/[...all]/route.ts"
click node_node_public_ui "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/components/sections/HeroSection.tsx"
click node_node_content_ui "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/components/blog/BlogClient.tsx"
click node_node_admin_ui "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/components/admin/PostTable.tsx"
click node_node_dashboard_ui "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/components/dashboard/dashboard-shell.tsx"
click node_node_platform_lib "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/lib/auth.ts"
click node_node_data_models "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/models/post.ts"
click node_node_client_runtime "https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/providers/AuthProvider.tsx"

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_public_home,node_node_public_content,node_node_resume,node_node_public_ui,node_node_content_ui toneBlue
class node_node_auth,node_node_api_auth toneAmber
class node_node_admin,node_node_api_admin,node_node_admin_ui toneMint
class node_node_dashboard,node_node_api_dashboard,node_node_dashboard_ui toneRose
class node_node_app_shell,node_node_api_content,node_node_api_newsletter,node_node_platform_lib,node_node_data_models,node_node_client_runtime toneIndigo
```

## Components

### Public site

Marketing pages, resume, blog, and case studies.

- [Home](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/page.tsx): marketing route · Primary public landing experience and service landing pages. · `app/page.tsx`
- [Blog & cases](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/blog/page.tsx): content routes · Public blog and case-study listings/details. · `app/blog/page.tsx`
- [Resume](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/resume/layout.tsx): static route · Resume and portfolio-oriented public pages. · `app/resume/layout.tsx`
- [Public UI](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/components/sections/HeroSection.tsx): shared components · Sections, landing pieces, layout, cards, and contact components used by marketing pages. · `components/sections/HeroSection.tsx`
- [Content UI](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/components/blog/BlogClient.tsx): feature components · Blog, case-study, and visitor-count presentation components. · `components/blog/BlogClient.tsx`

### Auth flows

Login and account verification surfaces.

- [Auth flows](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/(auth)/login/page.tsx): auth routes · Login, signup, magic link, password reset, 2FA, and email verification. · `app/(auth)/login/page.tsx`
- [Auth API](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/api/auth/[...all]/route.ts): session backend · Catch-all auth handler that centralizes authentication state and sessions. · `app/api/auth/[...all]/route.ts`

### Admin CMS

Authenticated content management and site settings.

- [Admin console](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/admin/page.tsx): admin routes · Authenticated management surface for content and settings. · `app/admin/page.tsx`
- [Admin APIs](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/api/admin/posts/route.ts): mutations · Server-side CRUD and site-settings/statistics endpoints for admin workflows. · `app/api/admin/posts/route.ts`
- [Admin UI](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/components/admin/PostTable.tsx): feature components · Editors, tables, row actions, and admin-specific workflows. · `components/admin/PostTable.tsx`

### Personal dashboard

Productivity and live external-data dashboard surfaces.

- [Dashboard](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/dashboard/page.tsx): dashboard routes · Personal dashboard with focus and settings views. · `app/dashboard/page.tsx`
- [Dashboard APIs](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/api/dashboard/github/route.ts): integrations · Live GitHub and contest data endpoints for the dashboard. · `app/api/dashboard/github/route.ts`
- [Dashboard UI](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/components/dashboard/dashboard-shell.tsx): feature components · Dashboard navigation, shell, and focus/settings controls. · `components/dashboard/dashboard-shell.tsx`

### Platform

Shared UI, backend helpers, persistence, and cross-cutting app infrastructure.

- [App shell](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/layout.tsx): Next.js root · Root layout and global styles for the App Router app. · `app/layout.tsx`
- [Content APIs](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/api/blog/route.ts): route handlers · Blog, case-study, taxonomy, visitor, and Open Graph endpoints. · `app/api/blog/route.ts`
- [Newsletter APIs](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/app/api/newsletter/subscribe/route.ts): email flow · Subscribe, confirm, unsubscribe, and send routes. · `app/api/newsletter/subscribe/route.ts`
- [Backend lib](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/lib/auth.ts): helpers · Auth, SEO, email, newsletter templates, landing variants, dashboard integrations, and API utilities. · `lib/auth.ts`
- [Mongo models](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/models/post.ts): persistence · Document schemas for posts, case studies, visitors, newsletter, settings, and dashboard activity. · `models/post.ts`
- [Client runtime](https://github.com/rahul1015s/rahulwebdev/blob/feat/blogmanagement-homepage/providers/AuthProvider.tsx): providers & hooks · Theme, analytics, auth provider, and responsive/client behavior. · `providers/AuthProvider.tsx`

## Connections

- App shell → Home: renders · Global shell hosts the public landing experience.
- App shell → Auth flows: routes · Root app boundary includes the authentication surfaces.
- App shell → Admin console: routes · Root app boundary includes the admin area.
- App shell → Dashboard: routes · Root app boundary includes the personal dashboard.
- App shell → Blog & cases: routes · Root app boundary includes blog and case-study content.
- Home → Public UI: composes · Marketing pages are assembled from shared sections and landing components.
- Blog & cases → Content UI: uses · Public content pages rely on blog and case-study feature components.
- Blog & cases → Content APIs: reads · Content pages fetch posts, cases, visitors, and SEO assets.
- Blog & cases → Mongo models: persists · Blog and case-study content are backed by MongoDB models.
- Admin console → Admin UI: composes · Admin screens are built from editors, tables, and action components.
- Admin console → Admin APIs: mutates · Admin UI talks to CRUD and settings endpoints.
- Admin APIs → Mongo models: writes · Admin handlers create, update, and delete persisted content.
- Dashboard → Dashboard UI: composes · Dashboard pages use a dedicated shell and controls.
- Dashboard → Dashboard APIs: reads · Dashboard surfaces aggregate GitHub and contest data.
- Dashboard APIs → Backend lib: uses · Dashboard routes depend on integration and transformation helpers.
- Dashboard APIs → Mongo models: reads · Dashboard stats and focus data are stored in MongoDB.
- Auth flows → Auth API: authenticates · Auth pages rely on the centralized auth route handler.
- Auth API → Backend lib: uses · Auth flow shares token, email, and auth helper logic.
- Newsletter APIs → Backend lib: uses · Newsletter endpoints use email templates and token utilities.
- Newsletter APIs → Mongo models: writes · Subscription state is stored in MongoDB.
- Content UI → Backend lib: uses · Content features use blog utilities, SEO helpers, and visitor logic.
- Public UI → Client runtime: depends on · Shared client behavior is provided by theme, analytics, and auth context.
- Admin UI → Client runtime: depends on · Admin interactions rely on shared client providers and hooks.
- Dashboard UI → Client runtime: depends on · Dashboard interactions rely on shared client providers and hooks.
