HomeCoding & DevelopmentPrisma Assistant

Prisma Assistant Product Information

Prisma Assistant

Prisma Assistant is an interactive tool built by AE Studio that lets you converse with your Prisma schema to gain insights and generate code directly within your development environment. It runs as a local server accessible via a URL provided after startup and requires an OpenAI API key to operate.

Key Use Cases

  • Explore your Prisma schema through natural language queries.
  • Generate and refine TypeScript queries, including complex includes and relations.
  • Quickly list and inspect models, fields, relations, and you can fetch related data using generated code.
  • Iterate on database access patterns with AI-assisted suggestions.

Getting Started

  1. Obtain an OpenAI API key from the OpenAI API portal.
  2. Set the environment variable in your OS:
  • MacOS/Linux: export PRISMA_ASSISTANT_OPENAI_API_KEY=your_openai_api_key
  • Windows: set PRISMA_ASSISTANT_OPENAI_API_KEY=your_openai_api_key
  1. Start the Prisma Assistant server from the root of your Prisma project:
  • Run: npx prisma-assistant@latest
  1. After the server starts, it will provide a URL to access the UI in your web browser.

Optional Environment Variables

  • PRISMA_ASSISTANT_OPENAI_MODEL: ID of the model to use.
  • PRISMA_ASSISTANT_OPENAI_API_BASE_URL: Override the default API base URL.

Run It with Ollama

You can run Prisma Assistant with Ollama by configuring:

  • PRISMA_ASSISTANT_OPENAI_MODEL="llama2" (or another model)
  • PRISMA_ASSISTANT_OPENAI_API_KEY="ollama"
  • PRISMA_ASSISTANT_OPENAI_API_BASE_URL="http://localhost:11434/v1"

Security Considerations

Your OpenAI API key is sensitive and remains on your machine while Prisma Assistant runs locally. Keep the key secure and do not share it.


How to Use Prisma Assistant

  1. Start the server as described above.
  2. Open the provided URL in your browser.
  3. Interact with your Prisma schema using natural language prompts to generate TypeScript queries and get code suggestions.
  4. Copy and adapt the generated code into your project.

Features

  • Local-first AI assistant for Prisma schemas
  • Conversational interface to inspect models, fields, and relations
  • AI-generated TypeScript code for queries with includes and nested relations
  • Quick schema exploration without leaving your IDE
  • Optional Ollama/alternative model support for local inference
  • Security-conscious: runs entirely on your machine with your API key