How pankajkumardev/flowpay works
Main Components
• Frontend Applications:
• user-app: The primary user interface with pages for dashboard, bank pages (HDFC, Axis), authentication, and more.
• merchant-app: Another Next.js–based app handling merchant related interfaces and possibly payment or transactional views.
• Backend Services:
• Bank-WebHook: Implements endpoints for receiving external webhook events. Also, note the future plans for Express integration.
• Next.js API routes in both user-app and merchant-app: These handle authentication (using NextAuth & JWT), money transfers, and wallet operations.
• Shared/Utility Packages:
• packages/db: Contains database logic/ORM (Prisma with PostgreSQL/NeonDB, migrations, and seeding).
• packages/ui: Reusable UI components.
• packages/store: State management logic (using Recoil or similar approaches).
• Other shared configuration packages (eslint-config, typescript-config) that enforce coding standards across the monorepo.
• External Services and Infrastructure:
• Database: PostgreSQL managed via Prisma.
• Authentication service: NextAuth, JWT based session management.
• Deployment Platforms: AWS EC2 for Docker-based deployments and Vercel for production-ready deployments.
• Future external integrations: Webhook endpoints (potential Express server) for communicating with external banks or notification systems.
Relationships and Data Flow
• Users interact with the frontend applications via browsers. The user-app and merchant-app serve distinct roles (user dashboard, transactions, merchant operations).
• Both frontend apps include API routes that connect to backend logic for authentication, fund transfers, and transaction management.
• The Bank-WebHook app is an independent service receiving callbacks or notifications (webhooks) from the banks’ simulated pages.
• All backend components use the packages/db module to interact with the PostgreSQL database through Prisma ORM.
• Shared packages (UI, store) are consumed by the frontend apps to maintain consistency in design and state management.
• API communication flows:
• Client ↔ Frontend app (Next.js pages/components)
• Frontend app ↔ Internal API endpoints (via Next.js API routes)
• API endpoints ↔ Database (using Prisma)
• Backend services (Bank-WebHook) may communicate with frontend apps or pull in data from the database when processing webhooks.
• Deployment and CI/CD pipelines (Docker configurations, GitHub workflows) ensure smooth deployment and continuous integration across apps.
Architectural Patterns and Design Principles
• Monorepo Structure with Turborepo: Useful for managing multiple apps and shared packages under one repository.
• Separation of Concerns: Clear division between frontend (UI applications) and backend (API handling, webhook processing, database operations).
• Modular Design: The use of shared packages for the db, UI, and store encourages reusability and consistency across the system.
• Secure and Scalable Communication: Emphasize NextAuth for authentication and JWT sessions, utilizing REST-like API endpoints for internal interactions.
• Modern Frontend Framework: Built on Next.js with TailwindCSS, supplemented with interactive elements from Framer Motion.