Hybrid CRM & Industrial Analytics Platform
CRM & Cloud Platform

Problem & Solution
Enterprises with geographically distributed purchasing sites face a critical visibility gap. Traditional cloud CRMs fail during inevitable internet outages, halting branch operations. Conversely, isolated local systems prevent head offices from tracking real-time average costs, procurement trends, and inventory levels across the network. This 'data silo' effect leads to inefficient purchasing strategies and high operational overhead.
I architected a Hybrid Cloud-Local CRM that bridges the gap between local reliability and cloud-scale intelligence. The system utilizes a 'Local-First' approach where branch sites process transactions with zero latency. A robust background synchronization engine handles data replication to a centralized Next.js cloud platform. This provides executives with real-time visibility into weights, costs, and branch performance, while ensuring that local sites remain 100% functional—even when completely offline.
Key Features & Business Impact
- Offline-First Operational Continuity: Branches can process purchases and weighing without an internet connection
- Centralized Procurement Analytics: Real-time visibility into average costs and weights across all distributed sites.
- Automatic Data Reconciliation: Robust sync engine to resolve data divergences once connectivity is restored.
- Multi-Tenant Data Isolation: Secure branch-specific reporting with hierarchical access levels.
- High-Performance Dashboard: Sub-second metric retrieval powered by Redis caching and materialized views.
Technical Deep Dive
Hybrid Architecture: Edge-to-Cloud Synchronization
The system utilizes a sophisticated Distributed Architecture to solve the 'Single Point of Failure' problem of standard SaaS. The cloud layer serves as the 'Single Source of Truth' for analytics and global state, while local instances act as high-availability edge nodes. This setup ensures that critical business logic—like purchasing and weighing—never stops due to ISP issues. Upon reconnection, the system executes an automated reconciliation protocol to ensure data parity across the network.
Enterprise Identity & Granular RBAC
Security is managed via a centralized OAuth provider integrated with a custom Role-Based Access Control (RBAC) engine. I implemented multi-layered authorization: middleware-level guarding for REST endpoints and decorator-based conditional rendering in the UI. Permissions are dynamic and 'tenant-aware,' ensuring branch managers can only access data relevant to their specific site, while regional supervisors maintain an aggregated view of their entire territory.
High-Throughput Data Ingestion & Consistency
The real-time pipeline is engineered for high-concurrency data ingestion. Local sites transmit transaction batches (ID, weight, unit cost) via secure APIs. To prevent data loss during spikes, the system implements a Retry-with-Backoff mechanism and deduplication logic at the ingestion layer. Once stored in PostgreSQL, raw events are asynchronously processed into time-series summaries, providing sub-second analytical response times for the management dashboard via Redis-cached query results.
Relational Modeling & Analytical Optimization
The PostgreSQL schema is optimized for both transactional (OLTP) and analytical (OLAP) workloads. Utilized Composite Indexing to accelerate temporal reporting. To mitigate the cost of heavy 'Average Price' calculations across millions of rows, I implemented Incremental Materialized Views. This allows the dashboard to serve complex procurement trends and inventory forecasts without putting load on the primary transaction tables, maintaining high performance as the data grows.
Technology Stack
NextJS
Typescript
TailwindCSS
PostgreSQL
Drizzle ORM
PM2