# venkatesh5650/digital_businesscard_platform architecture

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

- Interactive diagram: https://gitdiagram.com/venkatesh5650/digital_businesscard_platform
- Repository: https://github.com/venkatesh5650/digital_businesscard_platform

## Overview

1. This is a Next.js App Router application centered on digital identity cards, with three major surfaces: a public marketing site, a user dashboard, and an admin console. The README is generic, but the file tree shows the real product shape.

2. The public-facing layer lives in `src/app/page.tsx`, `src/components/landing`, and `src/app/[slug]`. The root pages are marketing content, while the dynamic `/[slug]` route is the public card/profile page rendered for each card identity.

3. The card experience is a distinct subsystem. `src/components/card` contains the public card renderer, lead capture, social links, payment panel, and reusable fragments. `src/components/card/templates` and `src/data/templates.ts` indicate multiple card themes, with `src/data/coverPresets.ts` and `src/data/dummyCard.ts` supporting preview/default content.

4. Card data is exposed through a dedicated public API at `src/app/api/vcf/[slug]/route.ts`, which likely generates downloadable contact data. That makes the card page both a visual profile and a distribution channel for contact info.

5. Auth is handled as a separate boundary: `src/app/api/auth/[...nextauth]/route.ts`, `src/auth.config.ts`, and `src/lib/auth.ts` define the authentication stack, while `src/app/auth/signin`, `register`, and `error` provide the user-facing entry points. `src/middleware.ts` likely enforces route protection and/or maintenance gating.

6. The authenticated user workspace is under `src/app/dashboard`. It includes the main overview, card editor (`dashboard/card/[id]`), leads, payments, and legal pages. Client components such as `DashboardClient.tsx`, `CardEditorClient.tsx`, and `LeadsClient.tsx` suggest the server routes mostly frame the UI while interaction-heavy logic runs on the client.

7. The admin surface is separate from the user dashboard and is organized under `src/app/admin`. It includes overview, cards, users, payments, and settings, with shared navigation in `AdminNav.tsx` and admin-specific UI components in `src/components/admin`. This is a clear operator console for managing the platform rather than end-user content.

8. Payments are a first-class subsystem built around Razorpay. The integration is isolated in `src/lib/razorpay` with client, order service, verification, webhook handling, validation, and test coverage. The API routes in `src/app/api/payments/razorpay/*` handle order creation, verification, and webhook events, while dashboard/admin payment views consume that state.

9. Analytics and operational controls are also exposed as APIs. `src/app/api/analytics/view` and `click` capture user interaction, `src/app/api/dashboard/stats` feeds dashboard metrics, and `src/app/api/system/maintenance` supports platform maintenance mode. These endpoints suggest a telemetry-and-control plane alongside the product UI.

10. The business logic is concentrated in `src/lib`: database access (`db.ts`), shared actions (`actions.ts`, `admin-actions.ts`, `payment-actions.ts`), card mapping (`cardMapper.ts`), URL helpers, and email delivery (`mail.ts`). This keeps UI components thin and separates domain logic from route handlers.

11. Persistence is Prisma-based. `prisma/schema.prisma`, `prisma/seed.ts`, `dev.db`, and the Prisma config files indicate a schema-driven database layer with local seeded data for development. The presence of scripts like `promote-admin*.ts` and `promote.sql` shows operational tooling for role management.

12. The repo also contains deployment and environment management helpers (`set_vercel_envs.js`, `sync-vercel.js`, `upload_env.js`, `docs/RAZORPAY_GO_LIVE.md`), which matters because the payment and auth subsystems depend on correctly provisioned environment variables in production.

13. In architecture-diagram terms, the key boundaries are: public marketing vs authenticated app vs admin console; UI routes vs server API routes; core app logic vs Prisma persistence; and the isolated Razorpay integration boundary that connects checkout, verification, and webhook processing.

Main entry points: [`src/lib`](https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/lib) (App logic), [`src/app/[slug]/page.tsx`](https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/[slug]/page.tsx) (Public card), [`prisma/schema.prisma`](https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/prisma/schema.prisma) (Persistence), [`src/app/dashboard`](https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/app/dashboard) (Dashboard views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public surface"]
  node_home["Marketing site<br/>Next.js pages<br/>[page.tsx]"]
  node_public_card["Public card<br/>Dynamic profile route<br/>[page.tsx]"]
  node_card_ui["Card UI<br/>Card components"]
  node_landing_ui["Landing UI<br/>Marketing components"]
end

subgraph group_authenticated["Authenticated app"]
  node_dashboard_home["Dashboard<br/>User workspace<br/>[page.tsx]"]
  node_card_editor["Card editor<br/>Editor route<br/>[page.tsx]"]
  node_dashboard_views["Dashboard views<br/>Client screens"]
end

subgraph group_admin["Admin console"]
  node_admin_home["Admin overview<br/>Operator console<br/>[page.tsx]"]
  node_admin_sections["Admin sections<br/>Admin routes"]
end

subgraph group_api["API surface"]
  node_auth_routes["Auth pages<br/>Sign-in flow"]
  node_auth_api["Auth API<br/>NextAuth route<br/>[route.ts]"]
  node_telemetry_api["Telemetry APIs<br/>Interaction endpoints"]
  node_vcf_api["VCF export<br/>Public export API<br/>[route.ts]"]
  node_payments_api["Payments API<br/>Razorpay routes"]
end

subgraph group_core["Core logic"]
  node_app_logic["App logic<br/>Domain services"]
  node_razorpay["Razorpay core<br/>Payment integration"]
  node_auth_stack["Auth stack<br/>Auth config<br/>[auth.config.ts]"]
end

subgraph group_data["Data layer"]
  node_db[("Persistence<br/>Prisma database<br/>[schema.prisma]")]
  node_templates["Card templates<br/>Theme data"]
end

node_home -->|"renders"| node_landing_ui
node_home -.->|"links to"| node_public_card
node_public_card -->|"uses"| node_card_ui
node_public_card -->|"selects theme"| node_templates
node_public_card -.->|"exports contact"| node_vcf_api
node_dashboard_home -->|"hosts"| node_dashboard_views
node_dashboard_views -.->|"opens"| node_card_editor
node_dashboard_views -.->|"consumes"| node_payments_api
node_admin_home -->|"routes to"| node_admin_sections
node_admin_sections -.->|"manages"| node_db
node_auth_routes -->|"authenticates via"| node_auth_api
node_auth_api -->|"configured by"| node_auth_stack
node_auth_stack -.->|"uses"| node_app_logic
node_telemetry_api -->|"records via"| node_app_logic
node_telemetry_api -.->|"reads/writes"| node_db
node_vcf_api -->|"maps data via"| node_app_logic
node_payments_api -->|"delegates to"| node_razorpay
node_payments_api -->|"updates via"| node_app_logic
node_razorpay -.->|"syncs state"| node_db
node_app_logic -->|"persists via"| node_db
node_app_logic -.->|"uses"| node_templates

click node_home "https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/page.tsx"
click node_public_card "https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/[slug]/page.tsx"
click node_card_ui "https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/components/card"
click node_landing_ui "https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/components/landing"
click node_dashboard_home "https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/dashboard/page.tsx"
click node_card_editor "https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/dashboard/card/[id]/page.tsx"
click node_dashboard_views "https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/app/dashboard"
click node_admin_home "https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/admin/page.tsx"
click node_admin_sections "https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/app/admin"
click node_auth_routes "https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/app/auth"
click node_auth_api "https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/api/auth/[...nextauth]/route.ts"
click node_telemetry_api "https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/app/api"
click node_vcf_api "https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/api/vcf/[slug]/route.ts"
click node_payments_api "https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/app/api/payments/razorpay"
click node_app_logic "https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/lib"
click node_razorpay "https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/lib/razorpay"
click node_auth_stack "https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/auth.config.ts"
click node_db "https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/prisma/schema.prisma"
click node_templates "https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/data"

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_home,node_public_card,node_card_ui,node_landing_ui toneBlue
class node_dashboard_home,node_card_editor,node_dashboard_views toneAmber
class node_admin_home,node_admin_sections toneMint
class node_auth_routes,node_auth_api,node_telemetry_api,node_vcf_api,node_payments_api toneRose
class node_app_logic,node_razorpay,node_auth_stack toneIndigo
class node_db,node_templates toneTeal
```

## Components

### Public surface

Marketing site and public card/profile experience.

- [Marketing site](https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/page.tsx): Next.js pages · Public landing page and site chrome. · `src/app/page.tsx`
- [Public card](https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/[slug]/page.tsx): Dynamic profile route · Public identity card/profile page for a slug. · `src/app/[slug]/page.tsx`
- [Card UI](https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/components/card): Card components · Renderer, lead capture, social links, payment panel, and templates. · `src/components/card`
- [Landing UI](https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/components/landing): Marketing components · Hero, features, FAQ, CTA, and footer for the public site. · `src/components/landing`

### Authenticated app

User dashboard and card editing workspace.

- [Dashboard](https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/dashboard/page.tsx): User workspace · Authenticated overview and navigation shell. · `src/app/dashboard/page.tsx`
- [Card editor](https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/dashboard/card/[id]/page.tsx): Editor route · Per-card editing surface with client-side interaction. · `src/app/dashboard/card/[id]/page.tsx`
- [Dashboard views](https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/app/dashboard): Client screens · Leads, payments, and overview clients rendered inside the dashboard. · `src/app/dashboard`

### Admin console

Operator interface for platform management.

- [Admin overview](https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/admin/page.tsx): Operator console · Admin landing and shell for platform management. · `src/app/admin/page.tsx`
- [Admin sections](https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/app/admin): Admin routes · Cards, users, payments, and settings management pages. · `src/app/admin`

### API surface

Route handlers for auth, telemetry, cards, and payments.

- [Auth pages](https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/app/auth): Sign-in flow · Signin, register, and error entry points. · `src/app/auth`
- [Auth API](https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/api/auth/[...nextauth]/route.ts): NextAuth route · Authentication backend route. · `src/app/api/auth/[...nextauth]/route.ts`
- [Telemetry APIs](https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/app/api): Interaction endpoints · View and click tracking plus dashboard stats and maintenance control. · `src/app/api`
- [VCF export](https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/app/api/vcf/[slug]/route.ts): Public export API · Generates downloadable contact data for a public card slug. · `src/app/api/vcf/[slug]/route.ts`
- [Payments API](https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/app/api/payments/razorpay): Razorpay routes · Order creation, verification, and webhook processing. · `src/app/api/payments/razorpay`

### Core logic

Shared domain logic, integrations, and helpers.

- [App logic](https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/lib): Domain services · Shared actions, auth helpers, card mapping, mail, and dashboard/admin mutations. · `src/lib`
- [Razorpay core](https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/lib/razorpay): Payment integration · Client, order, verification, signatures, validation, and webhook services. · `src/lib/razorpay`
- [Auth stack](https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/src/auth.config.ts): Auth config · Route protection and NextAuth configuration. · `src/auth.config.ts`

### Data layer

Schema, seed data, and static content used across the app.

- [Persistence](https://github.com/venkatesh5650/digital_businesscard_platform/blob/main/prisma/schema.prisma): Prisma database · Prisma schema, seed data, and local development database. · `prisma/schema.prisma`
- [Card templates](https://github.com/venkatesh5650/digital_businesscard_platform/tree/main/src/data): Theme data · Card themes, cover presets, and dummy preview content. · `src/data`

## Connections

- Marketing site → Landing UI: renders · Landing page is composed from marketing components.
- Marketing site → Public card: links to · Public site leads into the card/profile experience.
- Public card → Card UI: uses · Card route is built from the public card component set.
- Public card → Card templates: selects theme · Profile rendering uses card templates and preview content.
- Public card → VCF export: exports contact · Card page is paired with contact-data export.
- Dashboard → Dashboard views: hosts · Dashboard overview frames the client screens.
- Dashboard views → Card editor: opens · Workspace includes per-card editing.
- Dashboard views → Payments API: consumes · Dashboard payment views rely on payment state.
- Admin overview → Admin sections: routes to · Admin landing fans out into management sections.
- Admin sections → Persistence: manages · Admin surfaces operate on persisted platform data.
- Auth pages → Auth API: authenticates via · User-facing auth screens connect to NextAuth backend.
- Auth API → Auth stack: configured by · Auth route depends on shared auth configuration.
- Auth stack → App logic: uses · Auth helpers live in the shared application logic layer.
- Telemetry APIs → App logic: records via · Telemetry and maintenance handlers delegate to shared actions.
- Telemetry APIs → Persistence: reads/writes · Metrics and control endpoints persist state.
- VCF export → App logic: maps data via · VCF export uses shared card and contact helpers.
- Payments API → Razorpay core: delegates to · Payment routes hand off to Razorpay services.
- Payments API → App logic: updates via · Payment outcomes flow through shared actions.
- Razorpay core → Persistence: syncs state · Payment integration stores and reconciles transaction data.
- App logic → Persistence: persists via · Core actions read and write through Prisma.
- App logic → Card templates: uses · Domain logic maps cards to theme and preview data.
