# Prisma Composer (/docs/composer)

> For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL.

A TypeScript framework for defining applications composed of multiple services and resources, and deploying them to Prisma Compute and Prisma Postgres.

Location: Prisma Composer

With Prisma Composer, you describe your whole application in TypeScript: each service, plus whatever it depends on, such as other services, [Prisma Postgres](https://www.prisma.io/docs/postgres) databases, scheduled jobs, object storage, and secrets. One deploy command then provisions the services on [Prisma Compute](https://www.prisma.io/docs/compute), the databases on Prisma Postgres, and the authenticated connections between them.

You do not need Composer to deploy to Prisma Compute. If your application is a single service, you can deploy it to Compute directly. See [Deployments](https://www.prisma.io/docs/compute/deployments) for those paths.

> [!NOTE]
> Early Access
> 
> Prisma Composer is in [Early Access](https://www.prisma.io/docs/console/more/feature-maturity#early-access). APIs and commands can change between releases. The Composer commands ship inside the [Prisma CLI](https://www.prisma.io/docs/composer/cli-reference): run them with `npx prisma@next composer <command>`.

## What a Composer application is [#what-a-composer-application-is]

A Composer application is a tree of services and resources. Each service declares the resources it needs, such as a database. Services call each other through typed contracts. Step through how the pieces relate:

<ConceptAnimation name="composer-app-graph" />

## A minimal example [#a-minimal-example]

You declare a service as data instead of writing deployment scripts. The declaration below says the `storefront` service calls the `catalog` service's API and is built as a Next.js app:

```ts title="src/storefront/service.ts"
import nextjs from '@prisma/composer/nextjs';
import { rpc } from '@prisma/composer/service-rpc';
import { compute } from '@prisma/composer-prisma-cloud';
import { catalogContract } from '../catalog/contract.ts';

export default compute({
  name: 'storefront',
  deps: { catalog: rpc(catalogContract) },
  build: nextjs({ module: import.meta.url, appDir: '..' }),
});
```

At runtime, the service receives a typed client for each declared dependency from `service.load()`. The contract determines which methods that client exposes and their TypeScript types, and calling one is an ordinary async function call:

```ts title="src/storefront/data.ts"
import service from './service.ts';

const { catalog } = service.load();
const { products } = await catalog.listProducts({});
```

The root module ties the application together, wiring each declared dependency to the service or resource that provides it:

```ts title="module.ts"
import { module } from '@prisma/composer';
import catalogModule from './src/catalog/module.ts';
import ordersModule from './src/orders/module.ts';
import storefrontService from './src/storefront/service.ts';

export default module('store', ({ provision }) => {
  const catalog = provision(catalogModule);
  const orders = provision(ordersModule, { deps: { catalog: catalog.rpc } });
  provision(storefrontService, { deps: { catalog: catalog.rpc, orders: orders.rpc } });
});
```

TypeScript checks the wiring: a dependency bound to a producer with a different contract, a missing RPC handler, or a config value of the wrong shape is a compile error, not a failed deploy.

## From declaration to deployment [#from-declaration-to-deployment]

`npx prisma@next composer deploy module.ts` loads the root module, compares it with the deploy state stored for that environment, and creates or updates the services on Prisma Compute and the databases on Prisma Postgres. Re-running a deploy applies only the difference:

<ConceptAnimation name="composer-deploy-flow" />

## Core concepts [#core-concepts]

* **App**: the complete deployable application, defined by the root module. Deployed as one Prisma [project](https://www.prisma.io/docs/compute#the-model).
* **Service**: a running application component, declared with `compute()`. Deployed as one Prisma Compute service.
* **Resource**: something a service depends on that is not a service: a Prisma Postgres database, a bucket, or a secret.
* **Contract**: the typed interface through which services communicate, written as [Standard Schema](https://standardschema.dev) definitions.
* **Module**: a reusable unit that provisions services and resources behind a typed boundary, such as a service packaged with its own database.

[Apps and Modules](https://www.prisma.io/docs/composer/apps-and-modules) covers each in depth.

## Design principles [#design-principles]

Two choices shape the rest of the framework. First, application code does not read `process.env` or hardcode URLs. Dependencies arrive typed through `service.load()`, so production, an isolated stage, and a test all run the same code with different injected values. Second, Composer does not bundle or transform your code. You build with your own bundler, and the deploy assembles what you built.

## Get started [#get-started]

- [Getting started](https://www.prisma.io/docs/composer/getting-started): Build and run a two-service application locally, then deploy it.

- [Port an existing app](https://www.prisma.io/docs/composer/porting-an-app): Keep your server code and add the declarations around it.

## Use Composer with an AI coding agent [#use-composer-with-an-ai-coding-agent]

Composer's declaration-based API works well with coding agents because mistakes fail the TypeScript compile instead of a deploy. Before your agent writes Composer code, install the Composer skill, which gives it the current authoring API to work from:

  

#### bun

```bash
bunx skills add prisma/composer
```

#### pnpm

```bash
pnpm dlx skills add prisma/composer
```

#### yarn

```bash
yarn dlx skills add prisma/composer
```

#### npm

```bash
npx skills add prisma/composer
```

The `prisma-composer` skill documents the full authoring API, the CLI commands, and the first-party Modules for scheduled jobs, object storage, and event streams. It is one of several [Prisma agent skills](https://www.prisma.io/docs/ai/tools/skills). Review the generated declarations like any other TypeScript: `npx tsc --noEmit` checks the wiring before you deploy.

## What to read next [#what-to-read-next]

Start with [Apps and Modules](https://www.prisma.io/docs/composer/apps-and-modules) for how services, resources, and Modules compose into an app, then [Services and contracts](https://www.prisma.io/docs/composer/services-and-contracts) for the typed RPC between them. When you're ready to run something, [Local development](https://www.prisma.io/docs/composer/local-development) works with no cloud credentials, and [Deploying](https://www.prisma.io/docs/composer/deploying) covers production, stages, and CI. Check [Limitations](https://www.prisma.io/docs/composer/limitations) before committing to a design.

## Related pages

- [`Build faster with Prisma + AI`](https://www.prisma.io/docs/ai): Build faster with Prisma and AI coding tools like Cursor, Codex, and ChatGPT
- [`CLI Overview`](https://www.prisma.io/docs/cli): The Prisma CLI is the command-line interface for Prisma ORM. Use it to initialize projects, generate Prisma Client, manage databases, run migrations, and more
- [`Console`](https://www.prisma.io/docs/console): Learn how to use the Console to manage and integrate Prisma products into your application.
- [`Guides`](https://www.prisma.io/docs/guides): A collection of guides for various tasks and workflows
- [`Introduction to Prisma 8`](https://www.prisma.io/docs/v8): Prisma 8 is the next major version of Prisma ORM, available as a Release Candidate.