# Winsward Backend API
A high-performance, secure, and scalable RESTful API built with Express.js, Socket.io, and MongoDB. This API serves a mobile-friendly web application targeted at users with limited digital literacy, enabling simple registration (name, phone, PIN), secure login, and password (PIN) recovery via OTP sent to their phones.
## Features
- User Authentication (Phone + PIN)
- OTP-based PIN Recovery
- Real-time Notifications
- Role-based Access Control
- Multilingual Support
- Forum Discussions
- Product Listings
- Learning Modules
## Prerequisites
- Node.js (v14 or higher)
- MongoDB (v4.4 or higher)
- npm or yarn
## Setup
1. Clone the repository:
```bash
git clone
cd winsward
```
2. Install dependencies:
```bash
npm install
```
3. Create a `.env` file in the root directory with the following variables:
```
NODE_ENV=development
PORT=5000
MONGODB_URI=mongodb://localhost:27017/winsward
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
CLIENT_URL=
localhost
```
4. Start the development server:
```bash
npm run dev
```
## API Endpoints
### Authentication
- POST /api/auth/register - Register a new user
- POST /api/auth/login - Log in a user
- GET /api/auth/me - Get current user profile
- POST /api/auth/request-otp - Request OTP for PIN reset
- POST /api/auth/verify-otp - Verify OTP
- POST /api/auth/reset-pin - Reset PIN with OTP
### User Management
- GET /api/users/:id - Get user by ID
- PUT /api/users/:id - Update user profile
- DELETE /api/users/:id - Delete user
- GET /api/users/role/:role - Get users by role
- GET /api/users - Get all users
### Learning Modules
- GET /api/lessons - Get all learning modules
- GET /api/lessons/:id - Get single lesson
- POST /api/lessons - Create a new lesson
- PUT /api/lessons/:id - Update a lesson
- DELETE /api/lessons/:id - Delete a lesson
### Product Listings
- GET /api/products - Get all products
- GET /api/products/:id - Get single product
- POST /api/products - Create a product l …