Docs
PostgreSQL

PostgreSQL Integration

Our boilerplate comes with PostgreSQL integration using Neon, a serverless Postgres solution. It makes it easy to set up a database for your e-commerce store with minimal configuration and cost-effective pricing.

In this section, we will guide you through how to integrate Neon PostgreSQL with the boilerplate template.

Note: If you want to use other providers you can do so. For demonstration purposes, we are using Neon PostgreSQL (opens in a new tab)

Getting Started with Neon

  1. First, visit Neon's website (opens in a new tab) and sign up for a free account.

  2. After signing up and logging in, you'll see the project creation form with the following options:

    • Project Name: Choose a name for your project
    • PostgreSQL Version: Select your preferred version
    • Region: Choose between AWS or Azure (AWS is selected by default)
    • For AWS, you can select specific regions like:
      • Asia Pacific (Singapore)
      • US East (N. Virginia)
      • EU West (Ireland)
      • And more...
  3. Click "Create Project" to set up your database.

Getting the Database URL

Once your project is created, you'll be taken to the Neon dashboard:

  1. Look for the "Connect" button in your project dashboard
  2. You'll see your connection string in this format:
postgres://[user]:[password]@[endpoint]/[dbname]
  1. Copy the connection string and add it to your .env file as:
DATABASE_URL=your_connection_string_here

Key Benefits of Using Neon PostgreSQL

  • Serverless Architecture: Neon's serverless architecture automatically scales based on your needs, ensuring optimal performance.
  • Branching: Create database branches for development, testing, and production environments.
  • Cost-effective: Start with the free tier and pay only for what you use beyond the free limits.
  • Data Security: Neon provides enterprise-grade security with encryption at rest and in transit.
  • Advanced Querying: Full support for PostgreSQL features including complex queries, full-text search, and JSON data types.
  • Performance Optimization: Built-in connection pooling and query optimization for better performance.

Pro tip: Use Neon's connection pooling for better performance and resource utilization. The connection string includes a pooled connection option by default.

Environment Setup

After getting your database URL, you need to add it to your environment variables:

  1. Create a .env file in your project root if you haven't already
  2. Add your Neon database URL:
DATABASE_URL=your_neon_connection_string