Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: add more deno esm.sh and vscode guidance.

thorwebdeve249a8412586
diff --git a/apps/docs/pages/guides/functions/quickstart.mdx b/apps/docs/pages/guides/functions/quickstart.mdx
index 17f0ca95de5..be7537510fd 100644
--- a/apps/docs/pages/guides/functions/quickstart.mdx
+++ b/apps/docs/pages/guides/functions/quickstart.mdx
@@ -27,7 +27,7 @@ Follow the steps to prepare your Supabase project on your local machine.
- Login to the CLI using the command: `supabase login`. [Docs](/docs/reference/cli/usage#supabase-login).
- Initialize Supabase inside your project using the command: `supabase init`. [Docs](/docs/guides/getting-started/local-development#getting-started).
- Link to your Remote Project using the command `supabase link --project-ref your-project-ref`. [Docs](/docs/reference/cli/usage#supabase-link).
-- Optional: Setup your environment: Follow [this setup guide](https://deno.land/manual/getting_started/setup_your_environment) to integrate the Deno language server with your editor.
+- Setup your environment: Follow [the steps below](/docs/guides/functions/quickstart#setting-up-your-environment).
## Create an Edge Function
@@ -76,6 +76,7 @@ If you receive an error `Invalid JWT`, find the `ANON_KEY` of your project in th
or using one of the [client libraries](/docs#reference-documentation), e.g. using [supabase-js](/docs/reference/javascript/functions-invoke):
```js
+// https://supabase.com/docs/reference/javascript/installing
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
@@ -88,11 +89,51 @@ const { data, error } = await supabase.functions.invoke('hello-world', {
After invoking your Edge Function you should see the response `{ "message":"Hello Functions!" }`.
+## Importing Node npm modules
+
+We recommend using [esm.sh](https://esm.sh/) for importing Node.js modules that are published to npm. To do so you simply put `https://esm.sh/` in front of the package name.
+
+For example, when you want to use supabase-js within Supabase Edge Functions, you would import `createClient` as follows:
+
+```ts
+import { createClient } from 'https://esm.sh/@supabase/supabase-js@2'
+```
+
+As long as your environment is set up properly and the module you're importing is exporting types, the import will have types and autocompletion support.
+
## Setting Up Your Environment
You can follow the [Deno guide](https://deno.com/[email protected]/getting_started/setup_your_environment) for setting up your development environment with your favorite editor/IDE.
-When developing with VS Code inside of an existing application, you can utilize [multi-root workspaces](https://code.visualstudio.com/docs/editor/workspaces#_multiroot-workspaces).
+### Deno with Visual Studio Code (vscode)
+
+Install the Deno language server [via this link](vscode:extension/denoland.vscode-deno) or by browsing the extensions in vscode and choosing to install the _Deno_ extension.
+
+#### Partially Deno enabling a workspace
+
+In a given workspace (or workspace folder), sub-paths can be enabled for Deno, while code outside those paths will be not be enabled and the vscode built-in JavaScript/TypeScript language server will be used.
+
+For example if you have a project like this:
+
+```txt
+project
+├── app
+└── supabase
+ └── functions
+```
+
+Where you only want to enabled the `supabase/functions` path (and its subpaths) to be Deno enabled, you will want to add `./supabase/functions` to the list of _Deno: Enable Paths_ in the configuration. In your `.vscode/settings.json` file add:
+
+```json
+{
+ "deno.enablePaths": ["./supabase/functions"],
+ "deno.importMap": "./supabase/functions/import_map.json"
+}
+```
+
+#### Multi-root workspaces
+
+Alternatively, you can utilize [multi-root workspaces](https://code.visualstudio.com/docs/editor/workspaces#_multiroot-workspaces).
<div className="video-container">
<iframe
@@ -143,7 +184,7 @@ For use-cases which require low-latency we recommend [Edge Functions](/docs/guid
We recommend developing “fat functions”. This means that you should develop few large functions, rather than many small functions. One common pattern when developing Functions is that you need to share code between two or more Functions. To do this, you can store any shared code in a folder prefixed with an underscore (`_`). We recommend this folder structure:
-```bash
+```txt
└── supabase
├── functions
│ ├── import_map.json # A top-level import map to use across functions.