#atom

Subtitle:

Serverless PostgreSQL database with branching capabilities and separation of storage and compute


Core Idea:

NeonDB is a cloud-native, serverless PostgreSQL service that scales automatically, supports database branching for development workflows, and uses a distributed storage architecture that separates compute from storage.


Key Principles:

  1. Serverless Architecture:
    • Scales compute resources automatically from zero to needed capacity without manual provisioning.
  2. Database Branching:
    • Creates instant, isolated copies of databases for testing and development without duplicating data.
  3. Storage-Compute Separation:
    • Uses a distributed storage layer to decouple storage from compute nodes, enabling greater flexibility.

Why It Matters:


How to Implement:

  1. Create NeonDB Project:
    • Sign up and initialize a new project through the web console.
  2. Connect Application:
    • Use standard PostgreSQL connection strings with SSL to connect your application.
  3. Implement Branching:
    • Create branches for development or testing environments through API or console.

Example:

// .env file
DATABASE_URL="postgres://user:password@ep-example-id.us-east-2.aws.neon.tech/dbname?sslmode=require"

// prisma/schema.prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

// Connection in application
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()

async function main() {
const users = await prisma.user.findMany()
console.log(users)
}
```


Connections:


References:

  1. Primary Source:
    • NeonDB's official documentation and technical blog
  2. Additional Resources:
    • Community guides on using NeonDB with various frameworks

Tags:

#database #postgresql #serverless #cloud #branching #data-persistence #backend


Connections:


Sources: