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.
- 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.
- Node.js installed (v14.x or higher)
- PostgreSQL database
- Clone the repository:
git clone https://github.com/yogendrarana/node-postgres-boilerplate.git cd node-postgres-boilerplate
- Install dependencies
yarn or yarn install
- Setup environment variables
PORT=8000 ACCESS_TOKEN_SECRET=accesstokensecret REFRESH_TOKEN_SECRET=refreshtokensecret DB_URL=postgresql://postgres:password@localhost:5432/mydatabase
- 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
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.
This project is licensed under the MIT License.