A full-stack web application built using the MERN (MongoDB, Express.js, React.js, Node.js) stack that implements CRUD operations for product management with light/dark mode support.
- Create, Read, Update, and Delete products
- Responsive design for all screen sizes
- Light and Dark mode theme switching
- Real-time updates using React state management with Zustand
- RESTful API backend
- MongoDB database integration
-
Frontend:
- React.js
- Zustand (State Management)
- Chakra UI (Styling)
-
Backend:
- Node.js
- Express.js
- MongoDB with Mongoose
Before you begin, ensure you have the following installed:
- Node.js (v16.20.1 or higher)
- MongoDB
- npm (Node Package Manager)
Create a .env
file in the root directory and add:
MONGODB_URI=your_mongodb_connection_string
PORT=5000
- Clone the repository:
git clone https://github.com/anujkkarmakar/MERN_Basics
cd mern-stack-basics
- Install server dependencies:
npm install
- Install client dependencies:
cd frontend
npm install
In the project directory, you can run:
npm run dev
Runs the backend server in development mode using nodemon.
npm start
Runs the backend server in production mode.
npm run build
Installs all dependencies and builds the frontend application.
GET /api/products
- Get all productsGET /api/products/:id
- Get a specific productPOST /api/products
- Create a new productPUT /api/products/:id
- Update a productDELETE /api/products/:id
- Delete a product
mern-stack-basics/
├── backend/
│ ├── config/
│ │ └── db.js
│ ├── controllers/
│ │ └── product.controller.js
│ ├── models/
│ │ └── product.model.js
│ ├── routes/
│ │ └── products.route.js
│ └── server.js
├── frontend/
│ ├── public/
│ │ └── vite.svg
│ ├── src/
│ │ ├── components/
│ │ │ ├── Navbar.jsx
│ │ │ └── ProductCard.jsx
│ │ ├── pages/
│ │ │ ├── CreatePage.jsx
│ │ │ └── HomePage.jsx
│ │ ├── store/
│ │ │ └── product.js
│ │ ├── App.jsx
│ │ └── main.jsx
│ ├── .env
│ ├── .gitignore
│ ├── eslint.config.js
│ ├── index.html
│ ├── package.json
│ ├── package-lock.json
│ ├── README.md
│ └── vite.config.js
├── .env
├── .gitignore
├── LICENSE
├── package.json
├── package-lock.json
└── README.md
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the ISC LICENSE - see the package.json file for details.