Skip to content

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

Docs update - Expand guide for generating types from the CLI (#9820)

Ryan Tipps1a8e5137c030
diff --git a/apps/reference/_supabase_js/working-with-types.md b/apps/reference/_supabase_js/working-with-types.md
index 519650ed995..311c0f30883 100644
--- a/apps/reference/_supabase_js/working-with-types.md
+++ b/apps/reference/_supabase_js/working-with-types.md
@@ -8,13 +8,29 @@ id: typescript-support
## Generating types
-You can use our CLI to generate types:
+You can use the [Supabase CLI](/docs/guides/cli) to generate types directly from your Postgres database’s schema:
+
+### Generate types from a remote database
+
+Install the [Supabase CLI](/docs/guides/cli#installation) locally, and then run:
+
+```bash
+supabase login
+supabase projects list
+supabase gen types typescript --project-id <project_id> > lib/database.types.ts
+```
+
+### Generate types from a local database
+
+Set up your [local development environment](/docs/guides/cli/local-development), and then run:
```bash
supabase start
supabase gen types typescript --local > lib/database.types.ts
```
+For additional methods, see the [CLI Reference Docs](/docs/reference/cli/usage#supabase-gen-types).
+
These types are generated directly from your database. Given a table `public.movies`, the definition will provide the following data:
```ts