Anish
← Back to Projects
Full-StackJump to LLD ↓

SmartPay: Digital Wallet

Peer-to-peer FinTech wallet using MongoDB multi-document ACID transactions to prevent race conditions, containerized on AWS EC2 with CI/CD.

Node.jsReactMongoDBDockerAWSZod

Overview

The Problem

Concurrent peer-to-peer transfers can cause double-spending or partial balance updates if debit and credit operations aren't atomic.

The Solution

Built a full-stack wallet backed by MongoDB multi-document ACID transactions, strict Zod payload validation, and stateless JWT auth.

Key Engineering Highlights

  • Guaranteed atomic debit/credit balance updates using Mongoose sessions and ACID transactions.
  • Hardened API endpoints with Zod schemas, bcrypt password hashing, and rate-limiting.
  • Containerized the Node.js backend with Docker and automated AWS EC2 deployments via GitHub Actions.
Architecture

Low-Level Design (LLD)

Request validation pipeline, authentication middleware, and the transactional transfer flow.

SmartPay P2P Transfer Sequence & Schema
SmartPay P2P Transfer Sequence & Schema

ACID Transfer Flow

Starts a MongoDB session, verifies sender balance, debits sender, credits receiver, and commits—rolling back automatically on any failure.

Security & Validation Layer

Incoming payloads pass through rate-limiting → JWT verification middleware → Zod schema parsing before hitting controller logic.

Data Model

Normalized User and Account collections with integer-based currency representation (paise/cents) to avoid floating-point drift.