mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Docs, one new section on the `@supabase/server` Installing page. ## What is the current behavior? The Deno install instructions stop at `deno add jsr:@supabase/server`. A user who then imports `@supabase/server/middleware/postgres` on Deno or Edge Functions passes `deno check` and fails at startup with `Could not find package 'pg'`, because Deno resolves an optional peer only when the user's own code imports it. Nothing on the page says so. ## What is the new behavior? A new "Optional peer dependencies on Deno" row under the JSR section explains why, shows the bare `import 'pg'` at the top of the entry module, gives the `deno info` check, and notes the `--minimum-dependency-age 0` flag for same-day releases. Both hand-maintained copies of the partial are updated and stay identical: the spec partial for the reference site and the `docs/ref` copy for the markdown build. ## Additional context `pg` is the only optional peer a user can hit today. The MCP entry will add another once it ships and gets documented then. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added Deno installation guidance for Postgres middleware that requires the optional `pg` dependency. * Clarified that importing `pg` directly is necessary for Deno to resolve it at runtime. * Added commands for verifying package resolution and handling Deno’s minimum dependency age checks. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
112 lines
2.6 KiB
Plaintext
112 lines
2.6 KiB
Plaintext
---
|
|
id: installing
|
|
title: Installing
|
|
slug: installing
|
|
---
|
|
|
|
### Install as a package
|
|
|
|
<RefSubLayout.EducationRow>
|
|
<RefSubLayout.Details>
|
|
|
|
Install `@supabase/server` via your package manager.
|
|
|
|
</RefSubLayout.Details>
|
|
|
|
<RefSubLayout.Examples>
|
|
|
|
<Tabs
|
|
size="small"
|
|
type="underlined"
|
|
defaultActiveId="npm"
|
|
queryGroup="platform"
|
|
>
|
|
<TabPanel id="npm" label="npm">
|
|
|
|
```sh Terminal
|
|
npm install @supabase/server
|
|
```
|
|
|
|
</TabPanel>
|
|
<TabPanel id="yarn" label="Yarn">
|
|
|
|
```sh Terminal
|
|
yarn add @supabase/server
|
|
```
|
|
|
|
</TabPanel>
|
|
<TabPanel id="pnpm" label="pnpm">
|
|
|
|
```sh Terminal
|
|
pnpm add @supabase/server
|
|
```
|
|
|
|
</TabPanel>
|
|
</Tabs>
|
|
|
|
</RefSubLayout.Examples>
|
|
</RefSubLayout.EducationRow>
|
|
|
|
### Use via JSR (Deno / Bun)
|
|
|
|
<RefSubLayout.EducationRow>
|
|
<RefSubLayout.Details>
|
|
|
|
`@supabase/server` is also published to [JSR](https://jsr.io/@supabase/server) for Deno and Bun environments.
|
|
|
|
</RefSubLayout.Details>
|
|
|
|
<RefSubLayout.Examples>
|
|
|
|
<Tabs
|
|
size="small"
|
|
type="underlined"
|
|
defaultActiveId="deno"
|
|
queryGroup="platform"
|
|
>
|
|
<TabPanel id="deno" label="Deno">
|
|
|
|
```sh Terminal
|
|
deno add jsr:@supabase/server
|
|
```
|
|
|
|
</TabPanel>
|
|
<TabPanel id="bun" label="Bun">
|
|
|
|
```sh Terminal
|
|
bunx jsr add @supabase/server
|
|
```
|
|
|
|
</TabPanel>
|
|
</Tabs>
|
|
|
|
</RefSubLayout.Examples>
|
|
</RefSubLayout.EducationRow>
|
|
|
|
### Optional peer dependencies on Deno
|
|
|
|
<RefSubLayout.EducationRow>
|
|
<RefSubLayout.Details>
|
|
|
|
Some entry points rely on optional peer dependencies. `@supabase/server/middleware/postgres` and `@supabase/server/middleware/postgres-admin` need `pg`. Deno resolves an optional peer only when your own code imports it. A pin in `deno.json` alone is not enough: `deno check` passes and the function fails at startup with `Could not find package 'pg'`.
|
|
|
|
Add a bare import once, at the top of your entry module — no separate `deno add npm:pg` or `package.json` entry is needed. `deno info` lists `npm:/pg@...` once the package is in the module graph.
|
|
|
|
Deno 2.9 and later apply a minimum dependency age to npm packages. To use a release published the same day, pass `--minimum-dependency-age 0` to `deno check`.
|
|
|
|
</RefSubLayout.Details>
|
|
|
|
<RefSubLayout.Examples>
|
|
|
|
```ts index.ts
|
|
import 'pg'
|
|
import { withPostgresClient } from '@supabase/server/middleware/postgres'
|
|
```
|
|
|
|
```sh Terminal
|
|
deno info index.ts | grep "npm:/pg@"
|
|
```
|
|
|
|
</RefSubLayout.Examples>
|
|
</RefSubLayout.EducationRow>
|