@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
md 39 lines 1.64 KB
Rendered Raw
1 # Prisma tutorial
2
3 The complete application from the [four-part Prisma tutorial](https://alchemy.run/prisma/tutorial/part-1): a shared Project, Effect-native Compute API, Postgres connection, and Vite frontend.
4
5 ## Run
6
7 From the repository root, install dependencies with `pnpm install`. Then:
8
9 ```sh
10 cd examples/prisma-tutorial
11 bun alchemy profile edit --add Prisma
12 bun run deploy
13 ```
14
15 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.
16
17 ```sh
18 bun run dev
19 ```
20
21 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.
22
23 ## Test
24
25 ```sh
26 ALCHEMY_PROFILE=testing timeout 240 bun test
27 ```
28
29 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.
30
31 ## Cleanup
32
33 ```sh
34 bun run destroy
35 ```
36
37 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.
38
39 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.