1---
2title: Apps
3description: Prisma Compute apps as Stack resources — framework builds or Effect-native services, env wiring, custom domains, and a local dev command.
4---
5
6`Prisma.Compute` deploys an application onto Prisma's managed
7runtime. One resource covers the whole path: optional build, artifact
8upload, deployment, health check, and promotion — see
9[Deployments](/prisma/compute/deployments) for the lifecycle.
10
11## Framework apps
12
13For frontend frameworks, prefer the [`Prisma.Website` family](/prisma/frontend/websites).
14It provides framework-specific builds and native dev servers with the
15same `rootDir`, `env`, `assets`, `dev`, and `domain` vocabulary as other
16providers. Its output still runs on Bun in Compute, including static
17sites. Use `Prisma.Compute` directly for custom builds, server apps,
18and the Effect-native handlers below.
19
20Point `path` at the app. With `build: "auto"`, alchemy detects the
21framework, builds it, archives the output, and deploys the correct
22server entrypoint:
23
24```typescript
25const app = yield* Prisma.Compute("api", {
26 project,
27 path: "./app",
28 build: "auto",
29 healthCheck: { path: "/api/health" },
30 destroyOldDeployment: true,
31});
32```
33
34The server must listen on `PORT` (injected at runtime). Auto-build
35supports Bun, Next.js, Nuxt, Astro, TanStack Start, Vite, and NestJS. Generic
36Vite projects are deployed as static SPAs. Use an
37explicit build object when an app needs a custom command, output
38directory, or entrypoint.
39
40When `Prisma.Project` creates its default database, Prisma injects
41system-managed `DATABASE_URL` and `DATABASE_URL_POOLED` values into
42Compute deployments. Leave those keys out of `env`. For a standalone
43`Prisma.Postgres` database, create a `Prisma.Connection` and pass its
44outputs explicitly as shown in [Connections](/prisma/data/connections).
45
46`app.url` is the deployed endpoint.
47
48## Static sites
49
50Generic Vite apps work with `build: "auto"`. To deploy a directory that already
51contains static files, set `build.type` to `"static"` and point `outdir` at it.
52Alchemy packages the files with the HTTP entrypoint Prisma Compute requires;
53the application does not need its own server file or runtime dependency:
54
55```typescript
56const site = yield* Prisma.Compute("web", {
57 project,
58 path: "./site",
59 build: {
60 type: "static",
61 outdir: ".",
62 },
63});
64```
65
66Add `command` when the output directory needs to be built first:
67
68```typescript
69const site = yield* Prisma.Compute("web", {
70 project,
71 path: "./app",
72 build: {
73 type: "static",
74 command: "bun run build",
75 outdir: "dist",
76 spa: true,
77 },
78 dev: { command: "bun run dev", port: 5173 },
79});
80```
81
82Set `spa: true` for client-side routers so unmatched paths serve
83`index.html`. Leave it disabled for static sites that should return `404` for
84missing files. Directory indexes redirect to a trailing-slash URL so relative
85asset links resolve correctly.
86
87For static builds, `archiveIgnore` patterns are relative to `outdir`. The
88configured index page must remain in the archive; excluding it rejects the
89deployment.
90
91## Effect-native apps
92
93Pass `main` and an Effect body instead of a build, and the app is
94bundled from your Stack file — same shape as an Effect-native
95Cloudflare Worker or Lambda:
96
97```typescript
98export default Prisma.Compute(
99 "api",
100 { project, main: import.meta.filename },
101 Effect.gen(function* () {
102 const db = yield* Prisma.Connect(connection);
103 const sql = yield* SQL.Postgres({ url: db.databaseUrl });
104
105 return {
106 fetch: Effect.gen(function* () {
107 const users = yield* sql`SELECT * FROM users`;
108 return yield* HttpServerResponse.json(users);
109 }),
110 };
111 }).pipe(Effect.provide(Prisma.ConnectBinding)),
112);
113```
114
115## Custom domains
116
117Custom domains can only attach to an app on the project's current
118default branch. Creating the resource starts DNS and certificate
119provisioning; use `domain.dnsRecords` to configure DNS and inspect
120`domain.status` before directing production traffic:
121
122```typescript
123const domain = yield* Prisma.CustomDomain("api-domain", {
124 app,
125 hostname: "api.example.com",
126});
127```
128
129Changing the hostname or app in place is intentionally rejected.
130Create a second domain, verify DNS and TLS, cut traffic over, and then
131remove the old resource.
132
133## Local dev
134
135Under `bun alchemy dev`, `dev.command` runs your app locally (e.g.
136`vite dev`) with the same env the deployed app would see — including
137connection bindings, which resolve to the local
138[dev database](/prisma/data/postgres#local-dev):
139
140```typescript
141const app = yield* Prisma.Compute("web", {
142 project,
143 path: ".",
144 dev: { command: "bun run dev" },
145 env: { DATABASE_URL: connection.databaseUrl },
146});
147```
148
149## Where next
150
151- [Deployments](/prisma/compute/deployments) — health-checked
152 promotion, rollback, and deployment reuse.
153- [Connections](/prisma/data/connections) — the env and binding
154 wiring in detail.
155
156Reference:
157
158- [Compute API reference](/providers/prisma/compute)
159- [CustomDomain API reference](/providers/prisma/customdomain)