Best way to duplicate a project with schema + migration history but without data?

Hi! We're building a multi-tenant SaaS where each organization gets their own Neon project. When provisioning a new org, we need to replicate the structure from a "template" project.

What we need to copy:
  • All branches (production, staging, preview, etc.)
  • The schema (tables, indexes, extensions, etc.)
  • The drizzle.__drizzle_migrations table contents (so Drizzle ORM knows which migrations have been applied)
What we DON'T need:
  • Any data from the public schema tables (they start empty)
Current approach (feels overly complex):
  • Create new project with production branch
    For each branch in template project:
  • Create branch with endpoints: [{ type: "read_write" }]
  • Use getProjectBranchSchema API to fetch schema SQL
  • Strip privilege statements via regex (fragile!)
  • Execute schema SQL on new branch
  • Manually query drizzle.__drizzle_migrations from source and insert into destination
Questions:
  • Is there a simpler way to "clone" or "fork" a project structure without data?
  • Would init_source: "schema-only" on branch creation help here? Does it copy the drizzle schema too or just public?
  • Any way to create a project from a template/snapshot that includes schema but excludes data?
  • Alternatively - if we copy WITH data, is there an efficient way to truncate all tables in public schema afterward?
We're using the @neondatabase/api-client TypeScript SDK. Any guidance on the recommended pattern for this use case would be great!
Was this page helpful?