The challenge
The client needed a secure document management platform for regulated industries — law firms, accounting practices, and healthcare providers. Multi-tenancy was critical: each organization's data must be completely isolated, with SOC 2 Type II compliance as a launch requirement.
The platform needed real-time collaboration (multiple users editing documents simultaneously), granular role-based access control, and a billing system supporting per-seat pricing with annual contracts.
Our approach
We designed a PostgreSQL Row-Level Security (RLS) multi-tenancy model — tenant isolation at the database level, not just the application level. Every table has RLS policies ensuring queries can only access the current tenant's data, even if application code has a bug.
For real-time collaboration, we leveraged Supabase Realtime for presence awareness and Tiptap for collaborative rich-text editing with conflict resolution.
Key technical decisions:
- Supabase with PostgreSQL RLS for database-level tenant isolation
- Tiptap Editor for collaborative document editing with real-time sync
- Chose NOT to build our own auth — Supabase Auth with SAML SSO for enterprise tenants
- Per-seat Stripe billing with metered usage for storage overage
What we built
A SOC 2 compliant document management platform serving 200+ organizations:
- Multi-tenant architecture with PostgreSQL RLS (zero cross-tenant data leaks)
- Real-time collaborative document editor with presence indicators
- Role-based access: Owner, Admin, Editor, Viewer with granular permissions
- Per-seat Stripe billing with annual contracts and storage metering
- Full audit trail logging every document access, edit, and share
- SAML SSO integration for enterprise clients
- Automated backup with point-in-time recovery