This is a full-stack e-commerce web application built using Node.js, Express, MongoDB, and React. The app features user authentication (signup, login), product management, and JWT-based secure sessions.
Check out the live demo of the application: https://ecom-8ix0.onrender.com
- User authentication using JWT (JSON Web Token)
- Secure password storage with bcrypt
- Product listing and management
- REST API for managing users and products
- Token-based sessions without storing tokens on the frontend (for better security in production)
- Frontend built with React and Chakra UI for styling
- Frontend: React, Chakra UI
- Backend: Node.js, Express.js
- Database: MongoDB with Mongoose ODM
- Authentication: JWT, bcrypt
- Hosting: Render
-
Clone the repository:
git clone https://github.com/ajay-cs-tech/ecom.git cd ecom
-
Install backend dependencies:
npm install
-
Navigate to the frontend directory and install dependencies:
cd frontend npm install cd ..
-
Create a
.env
file in the root directory and add the following:NODE_ENV=development PORT=5000 MONGO_URI=your_mongo_uri JWT_SECRET=your_jwt_secret
To run the app in development mode with hot reloading for the backend:
npm run dev
The app will be available at http://localhost:5000
.
To build the frontend and start the backend in production mode:
npm run build
npm start
- POST
/api/auth/signup
- Register a new user - POST
/api/auth/login
- Log in as a user (returns JWT token)
- GET
/api/products
- Get all products - POST
/api/products
- Create a new product (protected)
The app is deployed on Render. The live version can be accessed at https://ecom-8ix0.onrender.com. Make sure to configure your environment variables (MONGO_URI
, JWT_SECRET
) in the Render dashboard.
Contributions are welcome! Please feel free to submit a Pull Request.