Prisma Addon

The Prisma addon in Servest provides an easy way to integrate Prisma ORM into your backend project.

It automates the setup of Prisma dependencies, configuration files, and environment variables to help you start working with databases faster.


How It Works

When you run:

Loading code snippet…

Servest will:

  1. Check the framework
    Ensures your project uses a supported Node.js framework. If not, the operation is canceled.

  2. Install Prisma dependencies
    Installs the required packages using your selected package manager (npm, pnpm, yarn, or bun).

    Packages installed (with versions):

    • prisma@6.15.0 (as a dev dependency)
    • @prisma/client@6.15.0 (as a runtime dependency)
  3. Generate Prisma configuration
    Creates the prisma/schema.prisma file with a default PostgreSQL setup:

    Loading code snippet…
  4. Create environment file
    Adds a .env file with a placeholder database URL if it does not already exist:

    Loading code snippet…
  5. Add Prisma scripts to package.json
    Adds or preserves these helpful scripts for common Prisma commands:

    Loading code snippet…

Example

After running the Prisma addon, your project structure may look like this:

Loading code snippet…

You can then run Prisma commands directly from your terminal:

Loading code snippet…

Notes

  • The addon checks if Prisma or @prisma/client are already installed to avoid duplicate setups.
  • It safely creates missing configuration or environment files without overwriting existing ones.
  • Make sure your .env file contains a valid DATABASE_URL before running migrations.
  • You can manually modify the provider (e.g., mysql, sqlite, mongodb) in schema.prisma as needed.

Why Use Prisma?

  • Type-safe queries → works seamlessly with TypeScript and autocompletes queries.
  • Cross-database support → supports PostgreSQL, MySQL, SQLite, MongoDB, and more.
  • Developer-friendly CLI → provides powerful commands for migrations and schema management.
  • Auto-generated client → reduces boilerplate code and increases development speed.
  • Integrated setup → Servest automates everything, so you can focus on writing your app instead of setting up ORM files.