Skip to content

Kickstart your Node.js projects with this boilerplate featuring Express, PostgreSQL, Drizzle ORM, and Vitest.

License

Notifications You must be signed in to change notification settings

yogendrarana/node-postgres-boilerplate

Repository files navigation

Node.js Boilerplate with Express, PostgreSQL, Drizzle ORM, and Vitest

This is a boilerplate project for building a Node.js application using Express, PostgreSQL, Drizzle ORM, and Vitest for testing. It provides a basic structure to get you started quickly with these technologies.

Features

  • Node.js: JavaScript runtime built on Chrome's V8 JavaScript engine.
  • Express: Fast, unopinionated, minimalist web framework for Node.js.
  • PostgreSQL: Powerful, open-source object-relational database system.
  • Drizzle ORM: Lightweight, TypeScript-first ORM for SQL databases.
  • Vitest: Fast unit test framework powered by Vite.
  • ESLint: A linting utility for JavaScript/TypeScript code style and quality.
  • Swagger: API documentation tool.
  • Morgan: Request logging middleware.

Getting Started

Prerequisites

  • Node.js installed (v14.x or higher)
  • PostgreSQL database

Installation

  1. Clone the repository:
    git clone https://github.com/yogendrarana/node-postgres-boilerplate.git
    cd node-postgres-boilerplate
    
  2. Install dependencies
    yarn or yarn install
    
  3. Setup environment variables
    PORT=8000
    ACCESS_TOKEN_SECRET=accesstokensecret
    REFRESH_TOKEN_SECRET=refreshtokensecret
    DB_URL=postgresql://postgres:password@localhost:5432/mydatabase
    
  4. Database and ORM
    # Generate migration files
    yarn db:generate
    
    # Push migrations to the database
    yarn db:push
    
    # Access the database studio in your browser
    yarn db:studio
    

Contributing

Feel free to submit issues, fork the repository, and send pull requests. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License.

About

Kickstart your Node.js projects with this boilerplate featuring Express, PostgreSQL, Drizzle ORM, and Vitest.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published