Primsell NFT E-Commerce
Web3 NFT Campaign Platform with 7-Service Monorepo
Architected 7-service monorepo with Express.js + NestJS backends, Awilix DI container, and event-driven workflow engine using EventEmitter2. 11 background daemons handle async processing — order expiration, OpenSea/Rarible secondary sales parsing, smart contract deployment, and POAP distribution. Stripe webhooks with Binance API currency conversion.
Key Features
- 7-service monorepo with Awilix DI container — 19 controllers, 27+ services, 24 Sequelize models
- Event-driven workflow engine: OrderWorkflow, ContractWorkflow, RewardDistributionWorkflow state machines
- 11 background daemons with 60-second execution locks, structured error logging, and Sentry alerts
- Stripe payment integration with webhooks, payment intents, and Binance API currency conversion
- OpenSea/Rarible secondary sales parsing for real-time royalty calculations
- Redis caching with ioredis + Cache Manager abstraction
Tech Stack
Backend
Blockchain
Infra
Frontend
Challenges & Solutions
Event-Driven Workflow Engine
Complex business processes — order lifecycle, contract deployment, reward distribution — required reliable state machine orchestration across 7 services without data loss.
Built custom workflow engine using EventEmitter2 with PostgreSQL-backed state machines. Abstract base classes (AbstractService, AbstractDaemon, AbstractSubscriber) standardized the pattern. 11 daemons handle async processing with 60-second execution locks and Sentry alerting.
Multi-Marketplace Royalty Tracking
NFT secondary sales happen across OpenSea and Rarible with different APIs and data formats — need real-time royalty calculations and automatic reward distribution.
Background daemons poll marketplace APIs, normalize sale data, calculate creator royalties in basis points, and trigger automated reward distribution via smart contract calls. Structured error logging to DB with auto-cleanup of old records.
Monorepo State Management
4 React frontends needed consistent data handling while serving different user journeys — admin dashboard, checkout, QR redemption, and KYC verification.
Redux Toolkit for UI state (modals, filters) + React Query for server state (API caching, background sync). Shared component layer as git submodule ensured consistent MUI-based UI. Redux-Saga handled complex async flows like payment confirmation chains.