A comprehensive RESTful API backend for murakoze-api built with Express.js, TypeScript, and MySQL. This API provides complete functionality for business management, user authentication, reviews, recommendations, location services, and analytics.
- Authentication System - JWT-based auth
- Business Management - CRUD operations with advanced filtering
- Reviews & Ratings - review management
- User Management - Profile management
- Recommendations Engine - business recommendations
- Location Services - Nearby search and directions
- Search & Analytics - Universal search with analytics
- Notifications - Real-time notification system
- TypeScript - Full type safety and modern JavaScript features
- Express.js - Fast and minimal web framework
- MySQL - Reliable relational database with Knex.js ORM
- JWT Authentication - Secure token-based authentication
- Swagger Documentation - Interactive API documentation
- Hot Reload - Development server with automatic restart
Before running this project, make sure you have the following installed:
- Node.js (v18 or higher)
- npm or pnpm (package manager)
- MySQL (v8.0 or higher)
- Git (for cloning the repository)
'''bash git clone cd mobile-api '''
Using npm: '''bash npm install '''
Using pnpm: '''bash pnpm install '''
Create a .env file in the root directory and configure the following variables:
'''env
DB_HOST=localhost DB_PORT=3306 DB_USERNAME=your_mysql_username DB_PASSWORD=your_mysql_password DB_NAME=mobileapi_db
JWT_SECRET=your_super_secret_jwt_key_here
PORT=3001 NODE_ENV=development '''
- Create Database: '''sql CREATE DATABASE murakoze; '''
Start the development server with hot reload:
'''bash npm run dev '''
The API will be available at: http://localhost:3001
'''bash npm start '''
Once the server is running, you can access the interactive Swagger documentation at:
''' http://localhost:3001/api-docs '''
| Endpoint Category | Base URL | Description |
|---|---|---|
| Authentication | /api/auth |
User signup, login |
| Businesses | /api/businesses |
Business CRUD operations |
| Reviews | /api/reviews |
Review and rating management |
| Users | /api/users |
User profile management |
| Recommendations | /api/recommendations |
AI-powered recommendations |
| Search | /api/search |
Universal search functionality |
| Locations | /api/locations |
Location and mapping services |
| Notifications | /api/notifications |
Notification management |
| Analytics | /api/analytics |
Platform analytics |
Most endpoints require authentication. Include the JWT token in the Authorization header:
'''bash Authorization: Bearer <your_jwt_token> '''
Get a token by calling the login endpoint: '''bash POST /api/auth/login { "email": "userexample.com", "password": "password123" } '''
''' mobile-api/ ├── src/ │ ├── controllers/ # Request handlers │ │ ├── AuthController.ts │ │ ├── BusinessController.ts │ │ ├── ReviewController.ts │ │ └── ... │ ├── routes/ # API route definitions │ │ ├── auth.ts │ │ ├── businesses.ts │ │ └── ... │ ├── middleware/ # Custom middleware │ │ └── auth.ts │ ├── config/ # Configuration files │ │ └── db.ts │ └── app.ts # Express app setup ├── server.ts # Server entry point ├── package.json ├── tsconfig.server.json # TypeScript config for backend └── README.md '''
npm run dev- Start development server with hot reloadnpm start- Start production server