A simple and scalable CRUD REST API built using Node.js, Express.js, and PostgreSQL.
This project demonstrates how to create REST APIs for performing Create, Read, Update, and Delete (CRUD) operations with PostgreSQL as the database.
- Node.js
- Express.js
- PostgreSQL
- Postman
Before running this project, make sure the following tools are installed:
- Node.js
- PostgreSQL
- npm
You can either:
- Install PostgreSQL directly on your machine, or
- Run PostgreSQL using Docker
Run the following SQL command inside PostgreSQL:
CREATE USER express WITH ENCRYPTED PASSWORD 'postgres';Create a new database and assign ownership to the created user:
CREATE DATABASE express_js OWNER express;Navigate to the project root directory and install dependencies:
npm installRun the development server using the following command:
npm run devOnce the server starts successfully, the API will be available locally.
A Postman collection is included in the project for testing APIs.
Import the following collection into Postman:
./postman/Express_Postgres_CRUD.postman_collection.json
The collection contains sample APIs for:
- Create records
- Fetch records
- Update records
- Delete records
- RESTful CRUD APIs
- PostgreSQL integration
- Express middleware support
- Easy local setup
- Postman collection included
- Beginner-friendly project structure
express-postgres-crud-api/
├── postman/
│ └── Express_Postgres_CRUD.postman_collection.json
├── src/
│ ├── configs/
│ ├── controllers/
│ ├── data/
│ ├── middlewares/
│ ├── models/
│ ├── routes/
│ └── index.js
├── package-lock.json
├── package.json
└── README.md
npm installnpm run devnpm startThis project is designed to help developers understand:
- How to build REST APIs using Express.js
- How to connect Node.js with PostgreSQL
- How CRUD operations work in backend applications
- How to structure a scalable Express project
- How to test APIs using Postman