Overview

This page gives an overview of the Prisma internals and how it works "under the hood".

Note that this page does not contain any practical information that is relevant for using Prisma. It rather aims at providing a mental model for what the Prisma toolkit actually is and how the different tools that are available to developers are structured.

If you're new to Prisma, be sure to check out the Quickstart and Introduction pages first.

Modules and interfaces

The tools in the Prisma toolkit are built with respect to two dimensions:

  • Module: A set of functionality that's offered by Prisma
  • Interface: A way to use the functionality of a module

The following illustration gives an overview of the tools that exist (or are planned) in the Prisma toolkit:

Modules

Prisma provides a number of features which are implemented in the form of modules. Here is an overview of the modules Prisma provides:

  • Query: Send queries to your database
  • Migrate: Perform schema migrations in your database
  • Introspect: Read a database schema and translate into Prisma data model
  • Schema: Construct and modify a Prisma schema file
  • Generate: Generate clients for Prisma data sources

Interface

Interfaces offer a way to actually use the functionality of a module. The module-interface-matrix above shows four different levels of interfaces (from bottom to top):

  • Engines Implements the core functionality consumed by the higher-level interfaces
  • Library: A way to programmatically use the functionality of a module
  • CLI: A way to use the functionality of a module on the command line
  • GUI: A way to visually use the functionality of a module

Prisma engines

At the core of each module, there typically is a Prisma engine that implements the core set of functionality. Engines are implemented in Rust and expose a low-level API that is used by the higher-level interfaces.

A Prisma engine is the direct interface to the database, any higher-level interfaces always communicate with the database through the engine-layer.

As an example, Prisma Client connects to the query engine in order to read and write data in a database:

Edit this page on Github