Technology Stack
Lula Direct × PDI Conexxus Loyalty Integration — 3 services, 12+ technologies, 1 unified platform
🌐
Frontend
Next.js 14 · React 18 · Tailwind
⚙️
Backend
MedusaJS · Node.js 18 · PostgreSQL
🛡️
Microservice
NestJS 10 · TypeORM · PDI REST
🔌
External
PDI Conexxus v1.1 · OAuth2 · TLS
Core Frameworks & Runtimes
Open-source headless commerce engine powering catalog, inventory, orders, and checkout orchestration with plugin architecture.
Backend core, REST API endpoints, database ORM, plugin system
React framework with server components, App Router, and built-in optimizations for the customer-facing storefront experience.
Pages, API routes, SSR/SSG, image optimization
Progressive Node.js framework for the dedicated loyalty microservice — dependency injection, modules, guards, and interceptors.
Loyalty Service, DI container, module system, interceptors
JavaScript runtime powering all three services — async I/O, event-driven architecture, and npm ecosystem for rapid development.
V8 engine, async I/O, event loop, npm ecosystem
Type-safe superset of JavaScript used across all services — interfaces for PDI models, DTOs, and shared contracts between layers.
Type checking, IDE support, PDI model interfaces, DTOs
Data Layer & State Management
Relational database for Medusa commerce data — orders, products, customers. Loyalty sessions and store configs stored via TypeORM entities.
Connection pooling, query execution, transaction management
In-memory data store for loyalty session caching, rate limiting PDI API calls, and circuit breaker state management.
Connection: redis:6379, session cache, rate limiter
Server state management for the storefront — automatic cache invalidation, optimistic updates for loyalty reward selection, and query deduplication.
API data fetching, infinite queries, optimistic updates
Utility-first CSS framework for storefront styling — responsive design, dark mode ready, and consistent design tokens across components.
Layout, typography, responsive breakpoints, JIT mode
🔌 PDI Conexxus Protocol Stack
📱
Storefront
React UI
Phone Entry
→
⚙️
Medusa API
REST Endpoints
/store/loyalty
→
🛡️
Loyalty Service
NestJS
Session Manager
→
🔐
OAuth2
client_credentials
Bearer Token
→
🏢
PDI Conexxus
REST API v1.1
OpenAPI 3.0.3
TLS 1.2+
Transport Security
Version & Compatibility Matrix
| Technology |
Version |
Layer |
Purpose |
Maturity |
| MedusaJS |
1.x |
Backend |
Commerce Engine |
|
| Next.js |
14 |
Frontend |
Storefront UI |
|
| NestJS |
10 |
Microservice |
Loyalty Service |
|
| PostgreSQL |
14+ |
Database |
Primary Store |
|
| TypeScript |
5.x |
All Layers |
Type Safety |
|
| PDI Conexxus |
v1.1 |
External |
Loyalty Host API |
|
| TanStack Query |
v5 |
Frontend |
Server State |
|
| Tailwind CSS |
v3 |
Frontend |
Utility Styles |
|
Infrastructure & Tooling
Container runtime for packaging and deploying all three services with consistent environments across dev, staging, and production.
Docker Compose, multi-stage builds, service orchestration
Object-relational mapper providing entity definitions, database migrations, and query builder for both Medusa and Loyalty Service.
Entity definitions, migrations, query builder, relations
Client credentials flow for authenticating with PDI Conexxus API. Bearer tokens with automatic refresh and secure credential storage.
Token generation, auto-refresh, credential management
JavaScript testing framework for unit and integration tests across all services with snapshot testing and mock support.
Unit tests, integration tests, mocks, coverage reports
Static analysis and auto-formatting for consistent code style across all TypeScript services and React components.
Linting rules, auto-format, pre-commit hooks
PDI Conexxus REST API specification defining all 8 POST endpoints, request/response schemas, and authentication requirements.
API documentation, schema validation, code generation
MedusaJS Backend
Headless commerce engine handling product catalog, inventory, orders, and core checkout logic. Integrates with Loyalty Service for reward computation and PDI for real-time member validation.
Next.js Storefront
Customer-facing application managing product browsing, cart operations, and checkout experience. Synchronizes loyalty session state and displays personalized rewards in real-time.
NestJS Loyalty Service
Dedicated microservice orchestrating PDI API interactions, managing loyalty calculations, session state, and reward tracking. Acts as the integration bridge between Medusa and PDI systems.
Integration Flow
End-to-end loyalty lifecycle — from phone number entry to points finalization
Identify
Customer enters loyalty phone number at checkout
Storefront
→
PDI Lookup
Medusa routes to Loyalty Service; validates member via PDI
Backend
→
Rewards
Instant rewards auto-applied; optional rewards displayed for selection
Service
→
Cart Eval
Cart re-evaluated with loyalty discounts; totals recalculated
Backend
→
Finalize
Order completes; deferred FinalizeRewards sent to PDI with actual items
PDI API
Data Synchronization Strategy
Real-time member data is cached in LoyaltySession. Circuit breaker prevents cascading failures if PDI is unavailable. Session state is ephemeral (cleared on order completion). Loyalty metadata is persisted in order records for audit and reconciliation purposes.