Voucher Redemption System
A full-stack platform for managing voucher campaigns, redemption flows, and user tracking with a clean admin experience.
Lead Full Stack Developer
3 Months (Q2 2025)
The Challenge
Voucher campaigns often suffer from duplication fraud (double-redemption) and server latency when thousands of concurrent users attempt redemptions at campaign launch. The client needed a secure, low-latency validation system that guarantees single-redemption rules.
The Solution
Designed and built a distributed redemption engine. Used MongoDB transactions to guarantee atomicity and avoid double-claims. Implemented an in-memory caching layer with automatic expiration to validate voucher eligibility under 15ms. Designed a React dashboard for real-time validation logging and campaign metrics.
Impact & Achievements
Eliminated voucher duplication fraud completely (0 duplicate redemptions in production).
Improved average API response time for validation requests from 120ms to 12ms.
Successfully handled peaks of 850 concurrent requests/second during flash promotions.
Technical Snippet
Here is a look at a key implementation detail from this project:
// Atomically claim a voucher to prevent race conditions / double redemptions
async function redeemVoucher(db, voucherCode, userId) {
const session = db.startSession();
try {
session.startTransaction();
// Find voucher with status "Available"
const voucher = await db.collection('vouchers').findOne(
{ code: voucherCode, status: 'Available' },
{ session }
);
if (!voucher) {
throw new Error('Voucher is invalid or already redeemed');
}
// Atomically update status and attach redemption info
await db.collection('vouchers').updateOne(
{ _id: voucher._id },
{ $set: { status: 'Redeemed', redeemedBy: userId, redeemedAt: new Date() } },
{ session }
);
await session.commitTransaction();
return { success: true, message: 'Voucher redeemed successfully!' };
} catch (error) {
await session.abortTransaction();
throw error;
} finally {
session.endSession();
}
}