Backend API for the Eswatini MSME (Micro, Small, and Medium Enterprises) Platform
# MSME Platform - Backend API
Backend API for the Eswatini MSME (Micro, Small, and Medium Enterprises) Platform.
## Features
- RESTful API for MSME business management
- User authentication and authorization
- Email notifications (registration, password reset, etc.)
- Admin error monitoring and email alerts
- Business categories and service providers management
- Blog and content management
- File upload handling
- Database with MySQL/Sequelize ORM
## Tech Stack
- **Runtime:** Node.js
- **Framework:** Express.js
- **Database:** MySQL
- **ORM:** Sequelize
- **Email:** Nodemailer
- **Authentication:** JWT
## Prerequisites
- Node.js (v14 or higher)
- MySQL (v5.7 or higher)
- npm or yarn
## Installation
1. Clone the repository:
```bash
git clone
cd MSME-Backend
```
2. Install dependencies:
```bash
npm install
```
3. Configure environment variables:
```bash
cp .env.example .env
# Edit .env with your configuration
```
4. Set up the database:
```bash
# Create MySQL database
mysql -u root -p
CREATE DATABASE msme_db;
```
5. Start the server:
```bash
# Development
npm start
# Production
NODE_ENV=production npm start
```
## Environment Variables
See `.env.example` for all required environment variables.
### Key Variables:
- `DB_HOST`, `DB_PORT`, `DB_NAME`, `DB_USER`, `DB_PASSWORD` - Database configuration
- `MAIL_AUTH_USER`, `MAIL_AUTH_PW` - Email SMTP credentials
- `ADMIN_ERROR_EMAILS` - Comma-separated list of admin emails for error notifications
- `PORT` - Server port (default: 3001)
## API Endpoints
### Authentication
- `POST /api/admin/login` - Admin login
- `POST /api/admin/register` - Admin registration
### Business Management
- `GET /api/business-category/list` - List business categories
- `POST /api/business-category/add` - Add business category (admin)
- `GET /api/msme-business/list` - List MSME businesses
### Content
- `GET /api/blog/list` - List blog posts
- `GET /api/faq/list` - List FAQs
- `GET /api/team/list` - List team members
### System …