A Node.js + Express.js backend API for a Watch Store E-commerce application, built using MongoDB. It handles authentication, product management, orders, and user roles. This project is scalable, beginner-friendly, and easy to integrate with frontend frameworks like React, Vue, or Angular.
Keywords: Node.js backend, Express API, MongoDB e-commerce backend, Watch Store API, REST API, JWT authentication
Watch Store Backend provides REST APIs required for running an e-commerce watch store. It focuses on clean structure, modular code, and common backend best practices.
This backend can be used by:
- Frontend developers building an e-commerce UI
- Learners understanding backend architecture
- Recruiters reviewing full‑stack or backend skills
Backend Technologies & Tools
- Node.js – JavaScript runtime
- Express.js – Web framework for APIs
- MongoDB – NoSQL database
- Mongoose – MongoDB object modeling
- JWT – Authentication & authorization
- bcrypt – Password hashing
- dotenv – Environment variable management
Core Backend Features
- 🔐 User authentication (JWT based)
- 👤 User roles & access control
- ⌚ Watch product management (CRUD)
- 🛒 Order handling
- 📦 Structured REST APIs
- ⚙️ Environment‑based configuration
watch-store-backend/
│
├── controllers/ # Request handling logic
├── models/ # Mongoose schemas
├── routes/ # API routes
├── middleware/ # Auth & custom middleware
├── config/ # Database & app config
├── utils/ # Helper functions
├── .env # Environment variables
├── server.js # App entry point
└── package.json # Dependencies & scripts
Follow these steps to run the project locally.
git clone https://github.com/Rajat-22/watch-store-backend.git
cd watch-store-backendnpm installCreate a .env file in the root directory:
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
⚠️ Do not commit.envto GitHub
npm startor (for development)
npm run devServer will run at:
http://localhost:5000
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register | Register user |
| POST | /api/auth/login | Login user |
| GET | /api/watches | Get all watches |
| POST | /api/watches | Add new watch |
| PUT | /api/watches/:id | Update watch |
| DELETE | /api/watches/:id | Delete watch |
Full API details can be expanded further.
You can test APIs using:
- Postman
- Thunder Client (VS Code)
- REST Client
This backend is frontend‑agnostic and can be easily connected with:
- React
- Vue
- Angular
- Mobile apps
Make sure to handle:
- JWT tokens in headers
- Protected routes
Contributions are welcome!
- Fork the repo
- Create a new branch (
feature/your-feature) - Commit changes
- Open a Pull Request
This repository is open-source and suitable for learning, portfolio projects, and production-ready extensions.
This project is licensed under the MIT License.
Rajat Sharma GitHub: @Rajat-22
⭐ If you find this project helpful, don’t forget to star the repository!