REST API built as the final project for the Academlo bootcamp.
It follows an MVC-based structure using Node.js, Express, Sequelize, PostgreSQL, JWT authentication, Cloudinary image handling, and automated tests with Supertest.
The API supports the core flow of a simple e-commerce backend: user management, authentication, product management, cart handling, purchases, and purchase history.
- Features
- Tech Stack
- Project Structure
- How to Run
- Environment Variables
- Usage
- API Endpoints
- Screenshots or Evidence
- Notes
- Limitations
- Status
- Author
- License
- User CRUD operations
- User authentication with JWT
- Category CRUD operations
- Product CRUD operations
- Product image upload and hosting through Cloudinary
- Cart management
- Purchase creation
- Purchase history retrieval
- Automated API testing with Supertest
Backend
- Node.js
- Express.js
Database
- PostgreSQL
- Sequelize
Libraries / Services
- JWT
- Cloudinary
- Supertest
Tools
- Nodemon
- Postman
src/controllers: business logic and request handlingsrc/models: Sequelize models and database relationshipssrc/routes: API endpoints and route definitionssrc/tests: automated testssrc/utils: error handling, database connection, JWT utilities, and Cloudinary configurationsrc/app.jsandsrc/server.js: Express app setup, environment loading, Sequelize initialization, and server startup
- Node.js installed
- PostgreSQL installed
- Access to pgAdmin or PostgreSQL through terminal
- A Cloudinary account
git clone [REPOSITORY_URL]
cd Ecommerce-APInpm installYou may see vulnerability warnings during installation. This project was originally built with older dependency versions, some of which now report known vulnerabilities. In its current state, this repository should be considered a portfolio / educational project, not a production-ready deployment.
Create a PostgreSQL database manually using pgAdmin or the terminal.
Example using psql:
psql -U postgres
CREATE DATABASE ecommerce_db;Create a .env file based on .env.example and fill in the required values.
npm run testnpm run devOnce the server is running, you can test the API using Postman or another API client.
Published Postman documentation: Postman Collection
# Database configuration
DATABASE=ecommerce_db
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=your_postgres_password
# Server configuration
PORT=8080
# Authentication
# Random secret used to sign JWT tokens
# Generate with: node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
TOKEN_SECRET=replace_with_a_secure_random_hex_secret
# Cloudinary configuration
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret- Create a user or log in with an existing account.
- Use the JWT token to access protected endpoints if required.
- Create and manage products, including image uploads handled through Cloudinary.
- Add products to the cart.
- Create a purchase from the cart.
- Retrieve previous purchase records through the purchase history endpoints.
This API can also be consumed by a frontend client. Related frontend repository: ecommerce-react.
| Method | Endpoint | Description |
|---|---|---|
| POST | /users |
Create a new user |
| POST | /users/login |
Authenticate a user and return a JWT |
| GET / POST / PUT / DELETE | /products |
Manage products |
| POST / GET / PUT / DELETE | /cart |
Manage shopping cart contents |
| POST | /purchases |
Create a purchase |
| GET | /purchases |
Retrieve purchase history |
For the complete and exact endpoint list, see the published Postman documentation.
- API documentation: Postman Collection
- Related frontend repository:
ecommerce-react
- This project was developed as the final project for the Academlo bootcamp.
- The repository has been preserved and documented as part of my professional portfolio.
- Some dependencies are legacy and may show security warnings in modern environments.
- The setup process described above was reviewed and updated during repository maintenance.
- No payment gateway or real payment processing is implemented.
- Some dependencies are outdated and may require future maintenance for production-level use.
- The project was not originally designed for current production hardening standards.
Completed bootcamp final project, currently maintained as a portfolio repository.
Miguel Garavito
- Portfolio: miguelgaravito.netlify.app
- LinkedIn: linkedin.com/in/miguel-ángel-garavito-camargo
This project is shared for educational and portfolio purposes.