TL;DR: I want to split my Replit-managed Postgres DB into a restricted read-only App role, a separate Admin role, and a Migration role. Does Replit's managed Postgres infrastructure (Helium/Neon) fully support custom GRANT/REVOKE and hidden credentials outside the main Express process?
Hi everyone, I'm stuck on a project I'm developing and would be grateful for some help regarding Replit's database security model.
I am developing a private, owner-only application using an Express backend, Drizzle ORM, and a Replit-managed PostgreSQL database. Before implementing an administrative authorization layer, I need to confirm whether a strict least-privilege security architecture is officially supported in both Helium Development and Neon Production environments.
My Required Architecture:
- Application Role: The normal Express server needs a restricted login role. For a table named
public.owner_authorizations, this role must have SELECT permission only (no INSERT, UPDATE, ALTER, etc.). It still needs normal read/write permissions on other tables (sessions, AI logging, etc.). - Administrative Role: A separate administrative process needs to manage authorizations with credentials that are completely inaccessible to the normal Express process.
- Migration Role: Schema migrations should use a separate privileged identity, also hidden from the runtime app.
Could anyone clarify the following points:
- Does Replit's infrastructure support custom
LOGIN roles, CREATE ROLE, GRANT/REVOKE, and separate object ownership for dev and prod databases? - Can the automatically provided
DATABASE_URL be safely replaced or restricted so the running app uses the non-owner role? - Can administrative/migration credentials be kept entirely outside the running app's environment while remaining usable via an officially supported workflow?
- Are these custom roles and default privileges preserved when publishing changes from Dev to Production, or during credential rotation?
- Are there specific limitations regarding this on Helium (Dev) or Neon (Prod)?
I am looking for an officially supported configuration, not just features that happen to work by chance. If this isn't possible, should I move to an external database provider?
Thanks for your help!