Core Problem Solved
Streamlined daily business reconciliation for multi-branch shop owners, decreasing end-of-day inventory auditing time by 50%, by designing a unified multi-tenant dashboard featuring real-time pawn analytics and strict store-level data isolation
Technical Architecture Breakdown
01
Ensured 100% data isolation across store locations by implementing a multi-tenant Express REST API using custom tenant context middleware and PostgreSQL row-level isolation via Prisma.
02
Cut high-frequency API response times by 45% by deploying a Redis caching layer for quick retrieval of active pawn tickets, dashboard metrics, and customer ledgers.
03
Reduced client-side re-render overhead by 35% by building a Next.js App Router frontend integrated with TanStack Query for server-side state synchronization and optimistic updates.
System Highlights & Key Features
- Increased API throughput by 3x and secured system endpoints by implementing JWT/RBAC security, rate-limiting middleware, and automated payload sanitization.
- Sustained >90% regression-free deployment confidence by authoring automated Vitest unit and integration suites covering auth, pawn ticket lifecycles, and payment workflows.
- Accelerated monthly financial auditing by 50% by building an automated payment ledger and report generation system with encrypted sensitive field storage
Code & Implementation Highlight
import { Request, Response, NextFunction } from 'express';
import { AsyncLocalStorage } from 'async_hooks';
interface TenantStore {
tenantId: string;
userId: string;
}
export const tenantStorage = new AsyncLocalStorage<TenantStore>();
export const tenantMiddleware = (req: Request, res: Response, next: NextFunction) => {
const tenantId = (req.headers['x-tenant-id'] as string) || req.user?.tenantId;
if (!tenantId) {
return res.status(400).json({ error: 'Tenant context missing' });
}
const store: TenantStore = {
tenantId,
userId: req.user?.id || '',
};
tenantStorage.run(store, () => {
next();
});
};Technologies & Frameworks
Next.js
TypeScript
Tailwind CSS
Node.js
Express.js
PostgreSQL
Docker
Redis
Git
Upstash
Framer Motion