This project is an e-commerce application with admin and user roles. Admin users can add, delete, and update products, while regular users can view the list of products and check the details of the products they like.
- ⚙️ Admin users can add,delete,update products.
- 📋 Users can view the list of products.
- 📦 Users can check the details of the products they like.
- 💻 React.js - JS library for crafting user interfaces
- 📦 Vite - Module bundler
- 🎨 Material-UI - Material UI is an open-source React component library
- 📲 Web Push Notifications - Messages that are sent to users who have subscribed to receive updates from a website or web application
- 🚀 Express.js - Web framework for Node.js
- 🌐 Cors - Mechanism for integrating applications
- ⚙️ Dotenv - A zero-dependency module that loads environment variables from a .env file into process.env
- 📂 Multer - A middleware for handling multipart/form-data in Node.js, primarily used for uploading files.
- 🛢️ Prisma - Prisma ORM is an open-source next-generation ORM
- 🐘 PostgreSQL - An advanced, enterprise-class open-source relational database
- 🐳 Docker - A software platform that allows you to build, test, and deploy applications quickly
Prerequisites
- Install Node.js ⚙️
- Docker and Docker Compose 🐳
- Clone the repo 🔄
📦 After cloning the repo install dependecies with
- Install the necessary dependencies:
npm install
- Configure your environment variables. Create a
.env
file and add the necessary variables:
- .env ⚙️
DATABASE_URL="postgresql://user:password@localhost:5432/dbname?schema=public"
VAPID_PUBLIC_KEY="your_public_key"
VAPID_PRIVATE_KEY="your_private_key"
- Start PostgreSQL via Docker 🐳
docker-compose up -d
- If you don't have Docker Compose installed, you can start PostgreSQL with Docker using the following command:
docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres
- This command will start a
PostgreSQL
container namedmy-postgres
with the passwordmysecretpassword
and exposeport 5432
on your localhost.
- Migrate the database with Prisma 🛢️
npx prisma migrate dev --name init
- Docker Compose Configuration 🐳
- Below is the content of the docker-compose.yml file used to run PostgreSQL:
version: '3.1'
services:
db:
image: postgres:latest
restart: always
environment:
POSTGRES_USER: your_username
POSTGRES_PASSWORD: your_password
POSTGRES_DB: your_database
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data:
- Open up two terminal instances and run scripts below in directories
/server
and/client
- Server
npm i && npm run dev
- Client
npm i && npm run dev
after running scripts go to http://localhost:5173
with your browser to use the app. 🌐
- Adding, deleting, and updating products.⚙️
- Viewing the list of products and checking product details.👁️