Run `prisma dev` programmatically
Is there a programmatic function to have run
prisma dev
(local postgres db) programmatically? Thanks.2 Replies
You selected the bot's instantaneous insights. Let me compile your answer right away!
Short answer: No official programmatic API is documented to start prisma dev (the local Prisma Postgres server) from code.
What is available:
- You can start it via the CLI: npx prisma dev. This launches a local Prisma Postgres instance you can connect to, and you can control ports/names via flags (e.g., --name, --port) (Prisma CLI dev; Local development guide).
- You can stop or remove local instances via CLI subcommands: prisma dev stop and prisma dev rm (Prisma CLI dev).
Related context:
- Prisma is exploring/has demand for programmatic access for migrations/CLI, but there’s no documented stable library API for starting dev or running migrate from code. Users typically shell out to the CLI as a workaround (Programmatic access discussions/issues, Run migrations by code (issue)).
If you need to automate prisma dev today, invoke the CLI from your code (e.g., child_process/execa) and manage lifecycle with the available flags. The docs don’t provide an official Node API for this.
✅ Great, thanks for letting us know that this solved your question!
Glad to see that the bot response was helpful. 🙂