-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(compute): use Composer and Prisma 8 in templates #8566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AmanVarshney01
wants to merge
3
commits into
latest
Choose a base branch
from
codex/update-compute-templates-prisma-8-composer
base: latest
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,21 @@ | ||
| # Prisma Compute examples | ||
|
|
||
| These examples show Prisma ORM apps deployed to Prisma Compute. | ||
| These examples show Prisma 8 apps deployed to Prisma Compute with Prisma | ||
| Composer. | ||
|
|
||
| | Example | Description | | ||
| | --- | --- | | ||
| | [`hono`](./hono) | Hono API on Node.js. | | ||
| | [`nextjs`](./nextjs) | Next.js App Router app using standalone output for Prisma Compute. | | ||
| | [`tanstack-start`](./tanstack-start) | TanStack Start app using the Nitro Vite plugin output supported by Prisma Compute. | | ||
|
|
||
| Each example includes Prisma ORM, a PostgreSQL schema, seed data, and scripts for | ||
| local development and Prisma Compute deployment. | ||
| Each example includes a Prisma 8 contract, generated typed client metadata, | ||
| seed data, a Composer module, and a GitHub Actions deployment workflow. | ||
| Deploy the companion Console change before publishing these templates so the | ||
| one-click flow can validate and copy their Composer files. | ||
|
|
||
| The Compute scripts call `bunx @prisma/cli@next` directly, so the examples do | ||
| not pin or install the Prisma CLI. They use `@next` because these examples | ||
| target the Prisma 8 release candidate, while the `latest` npm tag still points | ||
| at the earlier 3.x beta CLI with a different command set. When Prisma 8 reaches | ||
| general availability, the `@next` references will switch to `@latest`. | ||
| The templates pin the Prisma 8 release candidate and its compatible Composer | ||
| integration. They use `bunx @prisma/cli@next` for Prisma Cloud commands because | ||
| the `latest` tag still points at the earlier CLI command set. These pins can | ||
| move to stable releases after Prisma 8 and the matching Composer integration | ||
| reach general availability. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| src/prisma/contract.json linguist-generated | ||
| src/prisma/contract.d.ts linguist-generated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| name: prisma-deploy | ||
|
|
||
| on: | ||
| push: | ||
| delete: | ||
|
|
||
| concurrency: | ||
| group: prisma-deploy-${{ github.event_name == 'delete' && github.event.ref || github.ref_name }} | ||
| cancel-in-progress: false | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| deploy: | ||
| if: github.event_name == 'push' && github.ref_type == 'branch' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| - uses: prisma/cloud-deploy-action@v1 | ||
| with: | ||
| build-command: bun run build | ||
|
|
||
| teardown: | ||
| if: github.event_name == 'delete' && github.event.ref_type == 'branch' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| - uses: prisma/cloud-deploy-action@v1 | ||
| with: | ||
| mode: destroy | ||
| stage: ${{ github.event.ref }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,5 +2,5 @@ node_modules | |
| dist | ||
| .env | ||
| .prisma | ||
| prisma/migrations | ||
| src/generated/prisma | ||
| .prisma-composer | ||
| .alchemy | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [install] | ||
| # Composer needs the alchemy binary and deployable builds cannot contain symlinks. | ||
| linker = "hoisted" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { module } from '@prisma/composer' | ||
| import { pnPostgres } from '@prisma/composer-prisma-cloud/prisma-next' | ||
|
|
||
| import { databaseContract } from './src/prisma/composer.ts' | ||
| import service from './src/service.ts' | ||
|
|
||
| export default module('prisma-compute-hono', ({ provision }) => { | ||
| const database = provision( | ||
| pnPostgres({ | ||
| name: 'database', | ||
| contract: databaseContract, | ||
| config: 'prisma-next.config.ts', | ||
| }), | ||
| ) | ||
|
|
||
| provision(service, { | ||
| id: 'web', | ||
| deps: { db: database }, | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { defineConfig } from '@prisma/composer/config' | ||
| import { nodeBuild } from '@prisma/composer/node/control' | ||
| import { prismaCloud, prismaState } from '@prisma/composer-prisma-cloud/control' | ||
|
|
||
| export default defineConfig({ | ||
| extensions: [prismaCloud(), nodeBuild()], | ||
| state: prismaState(), | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import 'dotenv/config' | ||
| import { defineConfig } from '@prisma/orm-postgres/config' | ||
|
|
||
| export default defineConfig({ | ||
| contract: './src/prisma/contract.prisma', | ||
| db: { | ||
| connection: process.env['DATABASE_URL']!, | ||
| }, | ||
| }) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { pnContract } from '@prisma/composer-prisma-cloud/prisma-next' | ||
|
|
||
| import type { Contract } from './contract.d.js' | ||
| import contractJson from './contract.json' with { type: 'json' } | ||
|
|
||
| export const databaseContract = pnContract<Contract>(contractJson) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.