Files
supabase/apps/docs/content/guides/local-development.mdx
Akash Santra 34c5a9aa7a docs: improve React quickstart with error handling and fix Docker capitalization (#45320)
## I have read the CONTRIBUTING.md file.

YES

## What kind of change does this PR introduce?

Docs update

## What is the current behavior?

- The React quickstart example does not handle errors when fetching
data.
- The local development guide uses inconsistent capitalization for
"docker".

## What is the new behavior?

- Adds basic error handling (`error` check) in the React quickstart
example to improve reliability.
- Fixes capitalization from "docker" → "Docker" for consistency with
official naming.

## Additional context

These are small improvements to enhance clarity and developer experience
in the docs.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Enhanced React quickstart guide with error handling for database
queries to prevent invalid data processing
  * Corrected capitalization in local development guide

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-07 08:54:18 +02:00

157 lines
4.8 KiB
Plaintext

---
title: Local Development & CLI
subtitle: Learn how to develop locally and use the Supabase CLI
---
Develop locally while running the Supabase stack on your machine.
<Admonition type="note">
As a prerequisite, you must install a container runtime compatible with Docker APIs.
- [Docker Desktop](https://docs.docker.com/desktop/) (macOS, Windows, Linux)
- [Rancher Desktop](https://rancherdesktop.io/) (macOS, Windows, Linux)
- [Podman](https://podman.io/) (macOS, Windows, Linux)
- [OrbStack](https://orbstack.dev/) (macOS)
</Admonition>
## Quickstart
1. Install the Supabase CLI:
<Tabs scrollable size="small" type="underlined" defaultActiveId="npm" queryGroup="package-manager"><TabPanel id="npm" label="npm">
```sh
npm install supabase --save-dev
```
</TabPanel><TabPanel id="yarn" label="yarn">
```sh
NODE_OPTIONS=--no-experimental-fetch yarn add supabase --dev
```
</TabPanel><TabPanel id="pnpm" label="pnpm">
```sh
pnpm add supabase --save-dev --allow-build=supabase
```
<Admonition type="note">
The `--allow-build=supabase` flag is required on pnpm version 10 or higher. If you're using an older version of pnpm, omit this flag.
</Admonition>
</TabPanel><TabPanel id="brew" label="brew">
```sh
brew install supabase/tap/supabase
```
</TabPanel></Tabs>
2. In your repo, initialize the Supabase project:
<Tabs scrollable size="small" type="underlined" defaultActiveId="npm" queryGroup="package-manager"><TabPanel id="npm" label="npm">
```sh
npx supabase init
```
</TabPanel><TabPanel id="yarn" label="yarn">
```sh
yarn supabase init
```
</TabPanel><TabPanel id="pnpm" label="pnpm">
```sh
pnpx supabase init
```
</TabPanel><TabPanel id="brew" label="brew">
```sh
supabase init
```
</TabPanel>
</Tabs>
3. Start the Supabase stack:
<Tabs scrollable size="small" type="underlined" defaultActiveId="npm" queryGroup="package-manager"><TabPanel id="npm" label="npm">
```sh
npx supabase start
```
</TabPanel><TabPanel id="yarn" label="yarn">
```sh
yarn supabase start
```
</TabPanel><TabPanel id="pnpm" label="pnpm">
```sh
pnpx supabase start
```
</TabPanel><TabPanel id="brew" label="brew">
```sh
supabase start
```
</TabPanel>
</Tabs>
4. View your local Supabase instance at [http://localhost:54323](http://localhost:54323).
<Admonition type="caution">
If your local development machine is connected to an untrusted public network, you should create a separate Docker network and bind to 127.0.0.1 before starting the local development stack. This restricts network access to only your localhost machine.
```sh
docker network create -o 'com.docker.network.bridge.host_binding_ipv4=127.0.0.1' local-network
npx supabase start --network-id local-network
```
You should never expose your local development stack publicly.
</Admonition>
## Local development
Local development with Supabase allows you to work on your projects in a self-contained environment on your local machine. Working locally has several advantages:
1. Faster development: You can make changes and see results instantly without waiting for remote deployments.
2. Offline work: You can continue development even without an internet connection.
3. Cost-effective: Local development is free and doesn't consume your project's quota.
4. Enhanced privacy: Sensitive data remains on your local machine during development.
5. Easy testing: You can experiment with different configurations and features without affecting your production environment.
To get started with local development, you'll need to install the [Supabase CLI](#cli) and Docker. The Supabase CLI allows you to start and manage your local Supabase stack, while Docker is used to run the necessary services.
Once set up, you can initialize a new Supabase project, start the local stack, and begin developing your application using local Supabase services. This includes access to a local Postgres database, Auth, Storage, and other Supabase features.
## CLI
The Supabase CLI is a powerful tool that enables developers to manage their Supabase projects directly from the terminal. It provides a suite of commands for various tasks, including:
- Setting up and managing local development environments
- Generating TypeScript types for your database schema
- Handling database migrations
- Managing environment variables and secrets
- Deploying your project to the Supabase platform
With the CLI, you can streamline your development workflow, automate repetitive tasks, and maintain consistency across different environments. It's an essential tool for both local development and CI/CD pipelines.
See the [CLI Getting Started guide](/docs/guides/local-development/cli/getting-started) for more information.