Introduction
Relevant source files
The following files were used as context for generating this wiki page:
DRX CRM (also referred to as DeelRx) is a privacy-first, mobile-optimized point-of-sale (POS), customer relationship management (CRM), and inventory management system designed specifically for small businesses and regulated retail environments. The platform prioritizes financial accuracy, immutable audit trails, and data isolation through a multi-tenant architecture. It enables businesses to handle complex workflows such as fractional inventory sales, automated credit limit recommendations, and role-based operational gates.
Sources: README.md:3-8, testsprite_tests/standard_prd.json:7-13
The system is built on a modern full-stack architecture using Next.js 16 (React 19), TypeScript, and Supabase (PostgreSQL), with a recent migration toward Prisma ORM for enhanced data access logic. It operates with a "local-first" data approach to support offline transactions while ensuring eventual consistency through automatic synchronization with the cloud backend.
Sources: README.md:27-38, CHANGELOG.md:25-32, scripts/help-center-data.ts:16-18
Core System Architecture
DRX CRM employs a multi-tenant architecture where each business (tenant) is completely isolated from others. Data isolation is enforced at the database level using PostgreSQL Row Level Security (RLS), ensuring that staff in one business cannot access data belonging to another.
Sources: README.md:121-125, scripts/help-center-data.ts:101-103, testsprite_tests/standard_prd.json:33-35
High-Level Component Flow
The following diagram illustrates the interaction between the mobile-first frontend, the API layer, and the isolated data storage.
The application distinguishes between the Marketing/Landing Page and the App Shell using Next.js route groups, allowing for distinct routing and middleware logic for authenticated users.
Sources: CHANGELOG.md:76-77, README.md:104-115
Key Functional Modules
Point of Sale (POS) & Sales
The POS module is optimized for one-handed mobile operation and supports high-speed transaction processing. Key capabilities include:
- Fractional Sales: Accurate tracking for items sold by weight (grams) or count.
- Price Overrides: Role-validated adjustments that require manager approval and log reasons for audit tracking.
- Offline Mode: Transactions are stored locally when connectivity is lost and synced automatically upon reconnection.
Sources: README.md:13-14, app/(app)/help/page.tsx:75-80, testsprite_tests/standard_prd.json:16-17, scripts/help-center-data.ts:211-213
Inventory Management
Inventory is tracked using a "Canonical Stock" system which handles unit conversions (e.g., converting an eighth of flower into 3.5 grams). The intake workflow ensures that cost history is maintained and unusual cost deviations are flagged for review.
Sources: README.md:144-149, test-inventory-intake.sh:89-105, scripts/help-center-data.ts:227-230
Credit & CRM
The CRM module manages customer profiles while adhering to strict privacy presets. It includes an AI-powered credit decision engine that recommends limits based on purchase history and utilization.
Sources: README.md:151-156, app/(app)/help/page.tsx:126-130, scripts/help-center-data.ts:515-518
| Feature | Description | Relevant Files |
|---|---|---|
| RBAC | Role-Based Access Control (Owner, Manager, Staff) | user_roles, lib/auth |
| Audit Logs | Append-only logs for sensitive actions | system_audit_log, app/api/admin/audit-logs |
| RTBF | Right to be Forgotten PII masking | app/api/v1/tenant/[tenantId]/user/[userId]/delete |
| Intake | Workflow for stock arrival and cost averaging | inventory_intakes, test-inventory-intake.sh |
Sources: README.md:15-22, testsprite_tests/standard_prd.json:23-31, CHANGELOG.md:80-82
Data Security and Governance
DRX CRM implements a strict governance policy known as the "Wrelik Modular Stack." This includes a ban on direct vendor SDK imports in certain modules to maintain architectural purity and a "Phase 1 Stack Policy Audit" for compliance.
Sources: CHANGELOG.md:10-15
Security Enforcement Flow
The following sequence diagram shows how a sensitive action, such as a price override or inventory adjustment, is validated.
Audit logs are tenant-isolated and support filtering by action type, user, and date range. Once recorded, these logs cannot be modified or deleted.
Sources: testsprite_tests/standard_prd.json:45-55, app/(app)/admin/page.tsx:43-51, scripts/help-center-data.ts:635-637
Summary
The Introduction to the DRX CRM project establishes it as a robust, privacy-centric solution for retail management. By combining a mobile-first user experience with enterprise-grade security features like immutable audit logs and AI-driven credit analysis, the system provides small businesses with tools typically reserved for larger operations while maintaining strict data sovereignty and compliance.
Sources: README.md:3-8, testsprite_tests/standard_prd.json:7-13