Skip to main content
Neon is the serverless Postgres database platform used in this monorepo. It provides a fully-managed database solution that handles infrastructure management, allowing developers to focus on building applications. Neon combines the power of Postgres with features like branch management that integrates with our Git workflow, making database schema changes and migrations more manageable across different environment

Authentication

  1. Run the following command in your terminal:
neonctl auth
  1. This will open a browser window. Log in with your Neon account to complete authentication.
  2. 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:
  1. Matching Neon database branch is created (if it doesn’t already exist)
  2. 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 .env file 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.
git checkout -b new-feature
  • Switching to an existing branch: This updates the configuration to point to the corresponding Neon branch.
git checkout existing-branch
No additional commands are needed — the script monitors Git branch changes and handles everything in the background.

How It Works

  1. The script detects the current Git branch using git rev-parse --abbrev-ref HEAD
  2. It compares this with the previously used branch stored in the .env file
  3. If we’ve switched branches, it:
  • Checks if a matching Neon database branch exists
  • Creates a new branch if needed
  • Updates the .env file 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 .env file
  • 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
You can access both features in the Neon Console by selecting your branch and navigating to the SQL Editor and Tables tabs.