How venkatesh5650/digital_businesscard_platform works
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: lib App logic · page.tsx Public card · schema.prisma Persistence · dashboard Dashboard views
Components 19
Public surface
Marketing site and public card/profile experience.
- Marketing site · Public landing page and site chrome.
src/app/page.tsx - Public card · Public identity card/profile page for a slug.
src/app/[slug]/page.tsx - Card UI · Renderer, lead capture, social links, payment panel, and templates.
src/components/card - Landing UI · Hero, features, FAQ, CTA, and footer for the public site.
src/components/landing
Authenticated app
User dashboard and card editing workspace.
- Dashboard · Authenticated overview and navigation shell.
src/app/dashboard/page.tsx - Card editor · Per-card editing surface with client-side interaction.
src/app/dashboard/card/[id]/page.tsx - Dashboard views · Leads, payments, and overview clients rendered inside the dashboard.
src/app/dashboard
Admin console
Operator interface for platform management.
- Admin overview · Admin landing and shell for platform management.
src/app/admin/page.tsx - Admin sections · Cards, users, payments, and settings management pages.
src/app/admin
API surface
Route handlers for auth, telemetry, cards, and payments.
- Auth pages · Signin, register, and error entry points.
src/app/auth - Auth API · Authentication backend route.
src/app/api/auth/[...nextauth]/route.ts - Telemetry APIs · View and click tracking plus dashboard stats and maintenance control.
src/app/api - VCF export · Generates downloadable contact data for a public card slug.
src/app/api/vcf/[slug]/route.ts - Payments API · Order creation, verification, and webhook processing.
src/app/api/payments/razorpay
Core logic
Shared domain logic, integrations, and helpers.
- App logic · Shared actions, auth helpers, card mapping, mail, and dashboard/admin mutations.
src/lib - Razorpay core · Client, order, verification, signatures, validation, and webhook services.
src/lib/razorpay - Auth stack · Route protection and NextAuth configuration.
src/auth.config.ts
Data layer
Schema, seed data, and static content used across the app.
- Persistence · Prisma schema, seed data, and local development database.
prisma/schema.prisma - Card templates · Card themes, cover presets, and dummy preview content.
src/data
Connections 21
- 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.