All Projects

Live

API Platform / SaaS

QR Connect API

An e-commerce API platform connecting businesses to buyers via QR codes with integrated payments and subscriptions.

Role: Backend Lead


Node.jsTypeScriptMongoDBStripePayPalQR CodeBullMQRediseCommerce
Problem Statement

Businesses need a frictionless way to set up digital storefronts where customers can instantly access products and checkout simply by scanning a QR code.

Target users: Small to medium businesses selling products, and consumers looking for quick, contactless purchasing.

Project Walkthrough

When building QR Connect, the goal was to create a frictionless bridge between physical spaces and digital commerce. The core problem was that setting up an e-commerce storefront is often too complex for small merchants, and checking out is too slow for on-the-go buyers. To solve this, I designed an API platform that automatically generates unique QR codes for businesses upon registration. When scanned, these codes take customers directly to the merchant's digital storefront.

I architected the backend using TypeScript, Node.js, and Express, adopting a clean, layered architecture to keep routing, business logic, and database operations distinct. Knowing that the system would handle sensitive financial transactions, I integrated both Stripe and PayPal. Rather than relying on synchronous API calls for payments, I implemented a robust webhook architecture. This ensures that order statuses and the internal business wallet balances are updated asynchronously and securely, even under heavy load. To prevent excessive calls to PayPal, I implemented a Redis caching layer for access tokens.

One of the most satisfying engineering decisions was offloading heavy tasks like sending transactional emails to background workers. I utilized BullMQ and Redis to create a reliable job queue, ensuring that the main API thread remains blazing fast for end-users. The result is a scalable, highly responsive backend that empowers businesses to sell effortlessly in the real world.


Tech Stack

Languages

TypeScriptNode.js

Frameworks

Express.js

Databases

MongoDB (Mongoose ODM)Redis

Cloud & Infrastructure

DigitalOcean Spaces / AWS S3Vercel (Frontend Hosting)

Dev Tools

BullMQ (Background Jobs)Bull Board (Queue Dashboard)NodemonESLintqrcode (QR code generation)

Authentication

JWT (JSON Web Tokens), bcrypt for password hashing, and Google OAuth.

Third-Party APIs & Integrations

Stripe

PayPal

Mailgun (Emails)

AWS S3 (File Storage)


System Architecture

Architecture Pattern

Layered Architecture (Routes → Controllers → Services → Models)

Request Data Flow

Client Request → Express Router → Zod Validator Middleware → Controller → Service Layer / Mongoose Model → MongoDB → JSON Response

Key Engineering Decisions

Separated the core business logic into reusable services. Implemented BullMQ with Redis for background job processing (like emails) to ensure fast API response times. Used webhook-driven architecture for robust payment status updates. Redis caching for PayPal access tokens to prevent rate limits.

Database Design

Key collections include: Business, Buyer, Admin, Product, Order, BusinessWallet, Subscription, SubscriptionPlan, and Transaction. Uses referencing heavily for relationships (e.g., Orders referencing Products and Buyers).

Module Structure

api/v1/routes/ - API endpoint definitionsapi/v1/controllers/ - Request handling and business logic orchestrationapi/v1/validators/ - Request payload validation (Zod)db/models/ - Mongoose schemas and database modelsservices/ - Core external integrations (Payments, Email, Files)queues/ & workers/ - BullMQ background job processing

Key Features & Implementation

QR Code Storefront Generation

When a business registers, a unique QR code is automatically generated and linked to their digital storefront URL.

How it was built

Uses bcrypt for password hashing, slugify to create a unique store URL, and the 'qrcode' package to generate the QR image on the fly during registration. Customers scanning the QR code are taken directly to the merchant's product catalog.

Dual Payment Gateway Integrations (Stripe & PayPal)

Processes one-time purchases and recurring business subscriptions.

How it was built

Integrated with both PayPal and Stripe APIs via the 'payment.service.ts'. Securely handles webhook events to verify signatures and asynchronously update Order or Subscription statuses in MongoDB. Redis caching stores PayPal OAuth access tokens to prevent API rate limits.

Business Wallet System

Allows businesses to track their earnings from orders and request withdrawals.

How it was built

Implemented a BusinessWallet and BusinessTransaction schema that acts as an internal ledger. Balances are updated securely upon successful order completions via webhooks.


Challenges & Engineering Decisions

One of the primary challenges was securely integrating multiple payment gateways (Stripe and PayPal) and handling their asynchronous webhooks. To prevent rate limits and optimize API calls, I implemented Redis caching for PayPal access tokens. Ensuring transactional integrity between orders completing and business wallets updating required careful orchestration within the webhook handlers. Additionally, setting up a reliable background queue with BullMQ was crucial to offload heavy tasks like email sending and QR code image processing.


API Documentation

API Route Namespaces

/api/v1/auth/api/v1/business/api/v1/buyers/api/v1/products/api/v1/orders/api/v1/subscriptions/api/v1/webhooks/api/v1/businessWallets