Why Every BaaS Project Needs a Dedicated Physical PostgreSQL Database
How physical per-project PostgreSQL 18 databases prevent cross-tenant leaks, simplify Law 91/2025 compliance, and unlock lossless .hpb portability.
Shared multi-tenant databases leave every application exposed to a single missing WHERE clause or misconfigured policy. Under strict privacy regulations such as Vietnam's Personal Data Protection Law 91/2025/QH15, logical separation alone creates unnecessary blast radius.
Habify Base provisions an isolated physical PostgreSQL 18 database (hb_proj_<ulid>) per project, paired with a dedicated operational role (hb_role_<ulid>) and an isolated Data API execution role (hb_rls_<ulid> marked NOLOGIN, NOINHERIT, with zero CONNECT privilege).
Even anonymous browser requests carrying only hb_pk_* must execute inside a transaction running SET LOCAL ROLE hb_rls_<ulid> with app.current_role = 'anon'. Any public table missing ENABLE + FORCE ROW LEVEL SECURITY or lacking at least one policy fails closed immediately.
Standard FORCE ROW LEVEL SECURITY SQL Pattern
Whether authoring SQL manually or via our /skill.md AI integration, enable both statements below on every public table:
ALTER TABLE public.customer_leads ENABLE ROW LEVEL SECURITY;
ALTER TABLE public.customer_leads FORCE ROW LEVEL SECURITY;
CREATE POLICY "leads_owner_only" ON public.customer_leads
USING (owner_id = current_setting('app.current_user_id', true))
WITH CHECK (owner_id = current_setting('app.current_user_id', true));Frequently Asked Questions
Are PostgreSQL storage and MAU pooled across Projects?
Yes. All Workspace quotas (MAU, PostgreSQL DB GB, R2 Storage, Egress, and API Requests) are pooled across the Workspace so growing projects never hit artificial silos.
Related Documentation & Guides
Launch This Architecture in Free Sandbox in 3 Minutes
Spin up an isolated PostgreSQL 18 database, grab your hb_pk_* / hb_sk_* keys, and wire @habifybase/sdk.