t3-code-android-nightly/.repos/alchemy-effect/examples/prisma-tutorial
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00
..
src chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
test chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
.gitignore chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
alchemy.run.ts chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
index.html chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
package.json chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
README.md chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
tsconfig.json chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00

Prisma tutorial

The complete application from the four-part Prisma tutorial: a shared Project, Effect-native Compute API, Postgres connection, and Vite frontend.

Run

From the repository root, install dependencies with pnpm install. Then:

cd examples/prisma-tutorial
bun alchemy profile edit --add Prisma
bun run deploy

Open the returned website URL and click Read database time. The API executes SELECT current_timestamp::text AS time against Prisma Postgres; no schema setup is needed.

bun run dev

The frontend runs locally in Vite. The API, its database, and the shared Project remain remote because the Stack explicitly uses Alchemy.remote(). Credentials and cloud charges still apply. A separate --stage dev creates a separate remote backend rather than using another stage's database.

Test

ALCHEMY_PROFILE=testing timeout 240 bun test

The test deploys the real application, queries Postgres over HTTP, checks CORS and error routes, and destroys the Stack afterward. Set NO_DESTROY=1 only when retaining the deployment for manual browser verification.

Cleanup

bun run destroy

Use the profile and stage used for deployment. For retained test deployments, pass the test harness's stage with --stage; this is separate from the normal deploy stage. Retain .alchemy/ until cleanup finishes.

The API deliberately exposes only a read-only database timestamp and allows all origins. Restrict origins and add authentication before exposing private data. Only the public API URL goes into VITE_API_URL; database credentials stay in the Compute binding.