rembrembdocs

Get API info

curl http://localhost:8000/

Create a task

curl -X POST http://localhost:8000/tasks
-H "Content-Type: application/json"
-d '{"title": "Learn Prisma", "description": "Complete the Deno guide"}'

List all tasks

curl http://localhost:8000/tasks

Update a task (mark as completed)

curl -X PATCH http://localhost:8000/tasks/1
-H "Content-Type: application/json"
-d '{"completed": true}'

Delete a task

curl -X DELETE http://localhost:8000/tasks/1


You should see JSON responses for each request. The task ID will increment with each new task created.

You need a GitHub repository to deploy to Deno Deploy.

Create a `.gitignore` file:

.gitignore

.env node_modules/ generated/ deno.lock


Initialize and push your repository:

git init -b main git remote add origin https://github.com/<username>/prisma-deno-deploy git add . git commit -m "Initial commit" git push -u origin main


1.  Go to [https://dash.deno.com/](https://dash.deno.com/)
2.  Click **New Project** and select your GitHub repository
3.  Configure the deployment:
    -   **Framework preset**: No Preset
    -   **Install command**: `deno install`
    -   **Build command**: `deno run -A npm:prisma generate`
    -   **Entrypoint**: `index.ts`
4.  Click **Create & Deploy**

The first deployment will fail because you need to add the database connection string.

### [Add environment variables](#add-environment-variables)

1.  Go to your project's **Settings** > **Environment Variables**
2.  Add a new variable:
    -   **Key**: `DATABASE_URL`
    -   **Value**: Your Prisma Postgres connection string (copy from your `.env` file)
3.  Click **Save**

Trigger a new deployment by clicking **Redeploy** or pushing a new commit.

Once deployed, test your API at your Deno Deploy URL:

Replace with your actual Deno Deploy URL

curl https://your-project.deno.dev/

Create a task

curl -X POST https://your-project.deno.dev/tasks
-H "Content-Type: application/json"
-d '{"title": "Deploy to production"}'

List tasks

curl https://your-project.deno.dev/tasks


You successfully deployed a REST API to Deno Deploy using:

-   **Deno** as the runtime with native TypeScript support
-   **Prisma ORM** with the Postgres adapter for type-safe database access
-   **Prisma Postgres** as the managed database

Your project structure should look like this:

prisma-deno-deploy/ ├── deno.json ├── index.ts ├── prisma/ │ └── schema.prisma ├── prisma.config.ts ├── generated/ │ └── prisma/ │ └── ... └── .env


### [Next steps](#next-steps)

-   Add authentication using [Deno KV](https://docs.deno.com/deploy/reference/deno_kv/) for sessions
-   Add request validation with [Zod](https://zod.dev/)
-   Explore [Prisma Client extensions](../../../client-extensions/index.md) for custom functionality
-   Set up [Prisma Migrate](../../../../prisma-migrate/index.md) for schema versioning in production