How shiva-gsk/digiwallet-mcp works
Project type and purpose
• This is a full-stack web application called “Digital Wallet Management System” built on Next.js (app directory), Tailwind CSS, Node.js + Prisma, and PostgreSQL. It provides user-facing wallet UI, admin dashboards, serverless API routes, business logic actions, and integrates external services (Clerk, Stripe, Resend).
File structure
• Top-level “digiwallet” directory contains:
• app/ – Next.js app directory including pages (React server/client components) and server actions under app/actions, plus API routes under app/api
• components/ – UI components organized by feature and a shared ui/ subfolder
• lib/ – low-level helpers (db client, utils)
• models/ – SQL schema, queries, Prisma schema
• prisma/ – Prisma schema definition
• utils/ – cross-cutting services (emailService, OTP)
• middleware.ts, next.config.ts – global config
• “mcp” directory holds a separate Python microservice (Flask or similar), suggesting an auxiliary processing component.
Extract architecture details from the README
• Frontend: Next.js, responsive pages
• Backend: Node.js + Prisma ORM connecting to Neon/PostgreSQL
• Auth: Clerk (OAuth, email/MFA) with webhook handling
• Payments: Stripe (create-payment-intent route)
• Email: Resend service for notifications
• Hosting: Vercel serverless functions
Main components and how to represent them
a. Client / Browser / Mobile (Users)
• Interacts via HTTPS with Next.js frontend
b. Next.js Frontend Layer (Vercel)
• app/layout.tsx, page.tsx (React Server/Client components)
• UI Components (components/…)
• Server Actions (app/actions/*.ts) for data mutations/fetches
• API Routes (app/api/*/route.ts) for webhooks, payments, password resets
c. Business Logic Layer
• Actions (depositMoney, sendMoney, getTransactions, etc.)
• Utilities (lib/utils.ts, otpService.js, emailService.js)
• Middleware (middleware.ts) for authentication/authorization
d. Data Access Layer
• Prisma Client (lib/db.ts)
• SQL queries (models/sqlQueries/*.ts)
• Prisma schema (prisma/schema.prisma)
e. Database
• PostgreSQL (Neon)
f. External Services
• Clerk Auth Service (OAuth, user management, webhooks)
• Stripe Payments (create-payment-intent)
• Resend Email Service
g. Auxiliary Python Microservice (“mcp”)
• app.py, req.py: separate service possibly for batch processing or analytics
• Communicates over HTTP or message queue to main backend
Relationships & interactions
• User → Next.js Frontend (HTTPS)
• Frontend Server Components & Client Components call Server Actions & API Routes
• Server Actions & API Routes → Prisma Client → PostgreSQL
• API Routes → External Services (Clerk Webhooks, Stripe API, Resend API)
• External events (Clerk webhooks) → API route /api/webhooks/clerk/route.ts
• Python microservice (“mcp”) ↔ HTTP API endpoints on Next.js or direct DB access (as per design)
• Vercel hosts Next.js serverless functions and static assets
Architectural patterns & design principles
• Serverless functions for backend logic (Next.js API routes)
• Separation of concerns:
• Presentation (components/ + app/pages)
• Business logic (app/actions + utils)
• Data access (lib/db + models)
• Use of React Server Components and Client Components in Next.js 13 app directory
• Modular SQL queries for maintainability
• Middleware layer for auth enforcement
• Integration points for third-party services (Auth, Payments, Email)
Final advice
• Be thorough: break down into UI, server actions, API routes, data access, and external integrations
• Moving parts (webhooks, payments, email, auth)
• In layers for readability and show dependencies clearly