Skip to content

Latest commit

Β 

History

History
67 lines (50 loc) Β· 1.51 KB

File metadata and controls

67 lines (50 loc) Β· 1.51 KB

Shop API πŸ›οΈ

A production-ready REST API for an e-commerce boutique built with Node.js, Express, PostgreSQL, JWT Authentication and Stripe payments. Deployed on a VPS with a custom domain and HTTPS.

Live URL 🌐

https://zakmt.dev

Technologies πŸ› οΈ

  • Node.js
  • Express.js
  • PostgreSQL
  • JWT Authentication
  • Bcrypt
  • Stripe

Architecture πŸ—οΈ

MVC (Model, View, Controller)

Routes πŸ”—

Auth

  • POST /auth/register β†’ Create an account
  • POST /auth/login β†’ Login and get a token πŸ”‘

Products

  • GET /products β†’ Get all products
  • GET /products/:id β†’ Get a product by id
  • POST /products β†’ Create a product (admin only) πŸ”’
  • PUT /products/:id β†’ Update a product (admin only) πŸ”’
  • DELETE /products/:id β†’ Delete a product (admin only) πŸ”’

Orders

  • POST /orders β†’ Place an order πŸ›’
  • GET /orders β†’ Get all your orders
  • GET /orders/:id β†’ Get an order by id
  • POST /orders/:id/pay β†’ Pay with Stripe πŸ’³

Installation βš™οΈ

  1. Clone the repository
  2. Run npm install
  3. Create a .env file with your credentials
  4. Run node server.js

Environment Variables πŸ”

DB_HOST=localhost
DB_USER=postgres
DB_PASSWORD=yourpassword
DB_NAME=yourdbname
DB_PORT=5432
JWT_SECRET=yoursecret
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
CLIENT_URL=https://yourdomaine.dev

Deployment πŸš€

Deployed on DigitalOcean VPS with :

  • Nginx β†’ reverse proxy
  • PM2 β†’ process manager
  • Let's Encrypt β†’ SSL certificate