Authentication
- Run the following command in your terminal:
- This will open a browser window. Log in with your Neon account to complete authentication.
- Once authenticated, your credentials will be stored locally for use with the Neon CLI.
Database Branch Management
Overview
This integration automatically synchronizes local Git branches with corresponding Neon database branches. It enables seamless database isolation for each feature branch in our development workflow.Purpose
This solves a common development challenge: maintaining separate database environments for each Git branch. When we switch Git branches during development, the following happens:- Matching Neon database branch is created (if it doesn’t already exist)
- Local environment configuration is updated to point to the appropriate database branch
Key Features
- Automatic Branch Synchronization: Detects Git branch changes and creates matching database branches
- Environment Configuration: Updates the
.envfile with the correct database connection details - GitHub Branch Deletion Sync: Deletes Neon database branches when the corresponding Git branches are deleted in GitHub
Prerequisites
- Environment variables have been setup
- Access to Neon project
Usage
This script runs automatically whenever we switch Git branches. Typical usage looks like:- Creating a new feature branch: This creates a new Git branch and a matching Neon database branch.
- Switching to an existing branch: This updates the configuration to point to the corresponding Neon branch.
How It Works
- The script detects the current Git branch using
git rev-parse --abbrev-ref HEAD - It compares this with the previously used branch stored in the
.envfile - If we’ve switched branches, it:
- Checks if a matching Neon database branch exists
- Creates a new branch if needed
- Updates the
.envfile with the new connection details
Notes
- This script is intended to be run as part of our development workflow
- The branch cleanup strategy prioritizes branches older than 3 days
- Connection strings are automatically updated in our
.envfile - Neon database branches are automatically deleted when their corresponding Git branches are removed in GitHub
SQL Editor & Tables Browser
Overview
Neon provides a web-based SQL editor and a “Tables” tab in its dashboard, making it easy to interact with your Postgres databases visually and through direct queries — no external tools required.Key Features
SQL Editor
- Direct Querying: Run SQL queries against any database branch directly from your browser
- Branch Selection: Switch between database branches to work in isolated environments
- Autocompletion & Syntax Highlighting: Helpful developer features for fast, error-free writing
- Result Viewer: View and export query results in a structured format
Tables
- Visual Data Browser: View all tables in your selected database branch
- Inspect Table Structures: Quickly check column definitions, types, and indexes
- Browse Table Data: Explore, paginate, and filter through your data with ease
- Safe Exploration: Ideal for checking the current state of a branch without risking unintended changes
When to Use
- During development to inspect data or validate changes
- When debugging issues related to specific branches or migrations
- For quick one-off queries or schema exploration without a local setup
- To verify table structures or seed data in feature branches
