Documentation

Guides and references

Backend

Database

Supabase setup, schema, and queries.

Overview

NextBento uses Supabase (PostgreSQL) for the database. Supabase provides:

  • PostgreSQL database
  • Row Level Security (RLS)
  • Realtime subscriptions

Storage is available on the Supabase platform but is not a shipped NextBento product feature yet.

Client Setup

UsageImportDescription
Server@/lib/supabase/serverServer-side queries, cookies
Client@/lib/supabase/clientClient components
Middleware@/lib/supabase/middlewareSession refresh

Schema

The schema is defined in Supabase migrations. Run migrations from the Supabase CLI or Dashboard. Typical tables include:

  • profiles — User profiles + onboarding_completed
  • subscriptions — Stripe subscription data (owner)
  • team_members — Team membership (admin | member)
  • team_invitations — Pending invites with role
  • api_keys — API keys (hashed)
  • activity_logs — Activity history

RLS (Row Level Security)

Enable RLS on all tables. Policies control who can read/write. Never bypass RLS from the client — use service role only in trusted server code.

Best Practices

  • Use server-side Supabase client for mutations
  • Validate user identity before queries
  • Use migrations for schema changes
  • See Supabase Setup for setup and schema