A lightweight Node.js / Express backend for an e-commerce-style application supporting sellers, buyers, products, rentals, and orders. This repository provides routes, controllers, and models wired to a PostgreSQL database via Sequelize and image upload via Cloudinary.
- RESTful endpoints for products, orders, users (sellers/buyers), rentals, and admin actions
- Image upload and storage using Cloudinary
- Input validation and authentication middleware (JWT)
- Database models defined with Sequelize for PostgreSQL
- Node.js (v14+ recommended)
- PostgreSQL
- Environment variables for database, JWT, and Cloudinary credentials
- Clone the repository
- Install dependencies:
npm install-
Create a
.envfile at the project root and set required environment variables (examples below). -
Start the app in development:
npm run devOr run in production mode:
npm startThe config folder contains setup helpers:
config/database.js— Sequelize / Postgres setupconfig/cloudinary.js— Cloudinary configurationconfig/upload.js— Multer / storage settings
Typical environment variables used by the app:
PORT— server port (e.g. 5000)DB_HOST,DB_PORT,DB_NAME,DB_USER,DB_PASS— Postgres connectionJWT_SECRET,JWT_EXPIRES_IN— JWT settingsBCRYPT_SALT_ROUNDS— password hashing roundsSMTP_HOST,SMTP_PORT,SMTP_USER,SMTP_PASS— email / SMTP settings used byutils/mailer.jsCLOUD_NAME,CLOUD_KEY,CLOUD_SECRET— Cloudinary credentials (orCLOUDINARY_URL)
routes/— Express route definitionscontrollers/— Request handlers and business logicmodel/— Sequelize modelsconfig/— External service and DB configurationmiddlewares/— Auth and validatorsservices/— Reusable service-layer codetest/— Tests and integration checks
There are sample tests under the test/ folder.
- The server entry point is
server.js. - See
package.jsonfor available npm scripts (start,dev). - Update environment variables and database migrations before first run.
- In progress: core API, models, and upload flows are implemented.
- Planned: integrate Chapa payment gateway for checkout and payments.