B2B2C Platform Development with Data Isolation
Imagine you launch a marketplace where hundreds of partners sell services to end customers. Data from different partners must not intersect — or risk leaks and NDA violations. How do you organize isolation without losing performance? This is a challenge we solve every day. Over the years, we have delivered 45+ projects for marketplaces and aggregators.
A B2B2C platform combines an operator, business partners, and end consumers. Each level has its own interfaces and access rules. Turnkey development includes three-tier architecture, data isolation, and complex financial logic. We use a modern stack: React, Node.js, PostgreSQL. This article covers key aspects: setting up multi-tenancy, white-label, and calculations.
The platform must be flexible to adapt to different partners and reliable to run without failures. We choose a stack that ensures both. Let's start with architecture.
Three-Tier Architecture
Platform (operator)
↓ provides infrastructure
Business partners (B2B clients, vendors, service providers)
↓ serve via the platform
End consumers (B2C users)
Each level has its own interface and access rules:
- Operator — superadmin, sees everything, manages partners
- Partner — sees only their clients and analytics
- Consumer — sees only their content and services
Problems We Solve
Data isolation
Data from different partners must not mix — this is a matter of security and trust. We use three isolation strategies:
-
Row-Level Security (RLS) — single database with tenant filter, cheap and scalable to thousands of partners.
- Separate PostgreSQL schemas — better isolation, but migration complexity rises.
- Separate databases — maximum isolation for enterprise partners.
Comparison:
| Criterion |
RLS |
Schema per tenant |
Separate DB |
| Isolation |
Medium |
High |
Maximum |
| Migration complexity |
Low |
Medium |
High |
| Performance at 1000 tenants |
Excellent |
Good |
Satisfactory |
Example RLS policy
CREATE POLICY tenant_policy ON orders
USING (tenant_id = current_setting('app.tenant_id')::int);
According to PostgreSQL Documentation, RLS allows efficient row-level data isolation.
White-label complexity
Partners want the platform to look like their own product. White-label is implemented via:
- Custom domain (
partner.yourplatform.com)
- Logo and color scheme based on CSS variables
- Custom email notification templates
Middleware determines the tenant by domain, loads settings from the database, and applies the theme. This approach works 2–3 times faster than iframe embedding.
Multi-tenant billing
In a B2B2C platform, three parties participate in a transaction:
- Consumer pays X
- Partner receives X − platform commission
- Platform receives commission
Additional factors: referral programs, partner discounts, and promo codes. Automated reconciliation reduces commission leakage by up to 30% in typical setups.
How We Do It: A Case Study
For an aggregator of logistics services, we built a full white-label platform with 200+ tenants. We used PostgreSQL RLS combined with schema-per-tier for critical financial data. Each partner got a branded subdomain and custom checkout flow. The billing engine handles tiered commissions and real-time payouts. Onboarding time from registration to first transaction averaged 1.5 days. The platform processes over 10,000 transactions daily with 99.9% uptime under standard SLAs.
Our Process
-
Data gathering — analyze partner tiers, data sensitivity, compliance requirements.
-
Audit/analysis — review existing infrastructure, discuss integration points.
-
Design — propose multi-tenancy strategy, white-label architecture, billing logic.
-
Estimation — provide timeline and cost breakdown based on scope.
-
Development — build with CI/CD, isolated environments for each tenant.
-
Testing — load testing with realistic tenant mix, security audit.
-
Launch — phased rollout, monitoring, and knowledge transfer.
Timelines
- MVP with partner management, white-label, data isolation, and basic finances: 4–6 months.
- Full platform with marketplace, mobile apps, and analytics: 8–14 months.
Exact duration depends on feature set, number of integrations, and partner volume. We adjust sprint planning after the initial audit.
Common Mistakes & Pitfalls
-
Starting with separate databases for every tenant — increases cost and migration effort unnecessarily; start with RLS and scale up when needed.
-
Not planning for tenant-aware caching — global caches can leak data between tenants; use per-tenant cache keys or separate cache instances.
-
Ignoring regional compliance — if partners operate in different jurisdictions (GDPR, CCPA), the platform must support data residency at the tenant level.
What's Included in Our Work
When you order B2B2C platform development, we provide:
- Architectural documentation (ERD, sequence diagrams)
- CI/CD with environment isolation
- Integration with payment systems (Stripe Connect, YooKassa)
- Partner team training
- Technical support for the first 3 months
Full scope is defined during estimation.
Technical Stack
| Component |
Technology |
| Tenant isolation |
PostgreSQL RLS + schema per tenant |
| White-label |
Subdomains + CSS custom properties |
| Auth |
OAuth2 (separate clients for partner and consumer) |
| Payments |
Stripe Connect / Yookassa agency scheme |
| Analytics |
ClickHouse or PostgreSQL + Metabase |
Get Started
Contact us to discuss your project. Our engineers hold AWS and PostgreSQL certifications and can help choose the optimal architecture for your needs.
Development of Corporate Portals and Internal Systems
We specialize in developing corporate portals — CRM, ERP, LMS, and Intranet. Each project starts not with landing page layout, but with how business rules will be embedded into the architecture: who sees which data, how 1C and accounting systems sync, how 500 contacts turn into 500,000 without performance degradation. Over 7 years, we have delivered over 40 portals for companies with 50 to 5000 employees. We will evaluate your project in two business days — just contact us.
A public website can be launched without detailed design — iteratively improved based on feedback. With a corporate portal, this approach does not work: the cost of fixing architectural decisions after launch for 200 users is incomparably higher. Therefore, we spend 70% of our time on analysis and prototyping, and write code only after the role matrix and integration scheme are approved.
Three areas where bad decisions are often made: access rights model, performance on large data, and real-time updates.
How to build a role model for 30 departments?
Access rights model. "A manager sees only their own clients, a department head sees the entire department, a director sees the whole company, but financial data is visible only to the CFO and above." This is not three roles — it's a matrix of roles, permissions, organizational units, and record ownership. Implementing it with if ($user->role === 'manager') in controllers will make the code unmaintainable after six months.
The correct approach: Spatie Laravel Permission for basic role model + Policy classes for object-level permission (can('view', $deal) checks not only the role but also ownership). For complex hierarchical structures — ABAC (Attribute-Based Access Control) instead of RBAC.
Performance on large data. CRM with 500,000 contacts, filtering by 10 fields, sorting by activity — a naive implementation yields 15-second queries. Composite indexes, denormalization of aggregates (last_activity_at on the record itself instead of MAX over related table), Elasticsearch for full-text search on contacts.
Real-time updates. Multiple employees working on the same document or task. Without WebSocket — constant setInterval with polling every 5 seconds, extra server load, update delays. Laravel Broadcasting + Pusher/Soketi or a custom WebSocket server on Node.js — for notifications and real-time changes.
CRM Systems
Typical set: contacts, companies, deals, activities, sales funnel, reports. Technically straightforward. The complexity lies in the details.
Pipeline with custom stages. Every company wants its own funnel. Stages must be configurable without deployment. Table pipeline_stages with position, color, is_final, probability — and drag-and-drop for reordering on UI (React DnD or dnd-kit).
Change history. Who and when changed a deal status, reassigned a responsible person, added a note. Audit log via Observer or spatie/laravel-activitylog. On UI — timeline with filtering by activity type.
Email integration. IMAP/SMTP for connecting corporate mailbox, automatic linking of incoming emails to contacts by email address. This works reliably only with proper handling of bounces, spam, auto-replies — filtering is required.
Why is ERP not about code but about data?
ERP is when CRM, warehouse, production, accounting, and HR are unified into a single system. Full ERP from scratch is rare (usually integrating with existing systems), but modular systems for specific businesses are common.
Key principle: financial operations must be immutable. Not UPDATE orders SET status = 'cancelled' — but creating a new record order_cancellations with a reference to the original order. This is the immutable ledger principle, which simplifies auditing and reconciliation.
Integration with 1C is almost always part of an ERP project. Two-way synchronization: from 1C to portal (directories, balances, prices) and from portal to 1C (orders, documents). RabbitMQ as an event bus between systems is more reliable than direct HTTP interaction — if 1C is unavailable, messages wait in the queue.
How are LMS structured: learning platforms?
Learning Management System — courses, modules, lessons, tests, certificates, user progress.
Video content is the most demanding part of an LMS. Storing video on your own server and serving via Nginx is a bad idea: expensive, slow, no adaptive bitrate. Correct approach: upload to S3/Cloudflare R2, transcode via AWS Elemental MediaConvert or Mux, HLS playlist for adaptive streaming via Video.js or Plyr.
Viewing progress — periodic sending of watch_position from the frontend (every 10–30 seconds), storage in Redis with periodic synchronization to PostgreSQL. Do not save every second to the database — it will kill performance.
SCORM compatibility — if integration with corporate training materials is needed. Separate module, there are ready libraries (scorm-again).
Intranet and HR Portals
Corporate intranet: news, documents, organizational structure, HR processes (vacations, requests, KPIs).
Organizational structure in the database is a hierarchical structure. Adjacency list (parent_id on each record) is simple to implement but slow for recursive queries. Nested Sets or Closure Table are faster for reading hierarchies, more complex for changes. In PostgreSQL — recursive CTEs (WITH RECURSIVE) with adjacency list — a balance between simplicity and performance.
Document and request approval — workflow engine. Simple linear approvals (employee → manager → HR → accountant) can be done without a special engine. Non-linear (parallel branches, conditional transitions, delegation) — consider ready solutions: Temporal.io for workflow orchestration or a custom state machine based on the state-machine pattern.
What is included in the work
When ordering a corporate portal development, you receive:
- Architectural documentation (ER diagrams, integration scheme, role matrix)
- Full code in a Git repository with CI/CD
- Access to infrastructure (hosting, databases, storage)
- Training for administrators and key users (2–3 sessions)
- Warranty support for 3 months after launch
Our design principles rely on official Laravel documentation on authorization (Policies) and recommendations for working with queues.
Technical Stack for Portals
| Layer |
Tools |
| Backend |
Laravel + PostgreSQL |
| Frontend |
React + TypeScript (Inertia.js or separate SPA) |
| Real-time |
Laravel Echo + Soketi / Pusher |
| Search |
Meilisearch (quick start) or Elasticsearch (volume) |
| Queues |
Laravel Queue + Redis |
| Files |
S3-compatible (MinIO self-hosted or AWS S3) |
| Monitoring |
Sentry + Telescope (dev) |
Timeline Estimates
| Portal Type |
Timeline |
| CRM (basic) |
10–16 weeks |
| LMS (courses + video + tests) |
14–22 weeks |
| HR Portal (vacations, KPIs, org structure) |
12–20 weeks |
| Corporate ERP (modular) |
24–52 weeks |
The cost is calculated individually after a detailed analysis of requirements and role model. To get a preliminary estimate, contact us — we will analyze your task and offer an optimal turnkey solution.