A scalable and high-performance e-commerce API built with NestJS, TypeScript, and PostgreSQL. Designed for modularity, security, and efficiency, featuring JWT authentication and Prisma ORM.
- Product & category management
- User authentication & role-based access (JWT, OAuth)
- Shopping cart & checkout (multi-payment support)
- Order tracking & real-time notifications
- Inventory management & webhook integrations
- NestJS: A progressive Node.js framework for building efficient and scalable server-side applications.
- TypeScript: A statically typed superset of JavaScript.
- PostgreSQL: A powerful, open-source object-relational database system.
- Prisma ORM: Next-generation ORM for Node.js and TypeScript.
- JWT: JSON Web Tokens for secure authentication.
- Docker: Containerization platform for consistent development and deployment environments.
Ensure you have the following installed:
-
Clone the repository:
git clone https://github.com/Kledenai/ecommerce-api.git cd ecommerce-api
-
Install dependencies:
Using npm:
npm install
Or using yarn:
yarn install
The application requires a PostgreSQL database. You can set it up in two ways:
-
Using Docker (Recommended):
Utilize the docker-postgres repository to quickly set up a PostgreSQL instance using Docker.
-
Clone the docker-postgres repository:
git clone https://github.com/Kledenai/docker-postgres.git cd docker-postgres
-
Start the PostgreSQL container:
docker-compose up -d
This will set up a PostgreSQL database accessible at
localhost:5432
. -
-
Manual Setup:
Alternatively, install PostgreSQL manually on your system and create a new database.
Create a .env
file in the root directory of the project and add the following environment variables:
DATABASE_URL="postgresql://<username>:<password>@localhost:5432/<database_name>?schema=public"
JWT_SECRET="<your_jwt_secret>"
APP_URL="http://localhost:3000"
Replace <username>
, <password>
, and <database_name>
with your PostgreSQL credentials and desired database name.
-
Generate Prisma client:
npx prisma generate
-
Apply database migrations:
npx prisma migrate deploy
-
Start the application:
Using npm:
npm run start:dev
Or using yarn:
yarn start:dev
The API will be running at
http://localhost:3000
.
To execute the test suite:
Using npm:
npm run test
Or using yarn:
yarn test
This project is licensed under the MIT License. See the LICENSE file for details.