Administrative service management platform for Urban Assist
Getting Started β’ Installation β’ Configuration β’ API β’ Docker β’ Kubernetes β’ Contributing
This microservice handles administrative functions within the Urban Assist platform. Built with Node.js and Express, it provides robust integration with MySQL for data persistence and includes comprehensive service management capabilities.
β¨ Key Features
- Service Management - Complete CRUD operations for platform services
- JWT Authentication - Secure endpoints with token-based authentication
- Role-Based Authorization - Granular access control for administrators
- MySQL Integration - Sequelize ORM with MySQL
- Kubernetes Ready - Containerized deployment with full K8s support
- High Availability - Support for horizontal scaling
- Configuration Management - Externalized configuration via ConfigMaps and Secrets
Before you begin, ensure you have met the following requirements:
- Node.js (v20 or higher)
- npm (latest version)
- Git for version control
- Docker for containerization
- Kubernetes for orchestration
- MySQL database
-
Clone the repository:
git clone <repository-url>
-
Navigate to the admin service directory:
cd urban-assist/admin -
Install dependencies:
npm install
The service uses Kubernetes secrets and configmaps for configuration. Key variables:
PORT=8086
CORS_ORIGIN=*
JWT_SECRET=e7b03c0c0329ed5a8bbac042d38c6d93f7344516ac51203552476cf58f07b62c
DATABASE_NAME=admin
DATABASE_USER=root
DATABASE_PASSWORD=admindevelopers
DATABASE_HOST=mysql-service
Choose your preferred deployment method:
| Command | Description |
|---|---|
npm start |
Run in development mode with nodemon |
node src/index.js |
Run the application directly |
Build and run the service using Docker:
# Build the image
docker build -t handyshare/admin:latest .
# Run the container
docker run -p 8086:8086 handyshare/admin:latestDeploy the service to Kubernetes:
# Apply all configurations
kubectl apply -f k8s/
# Verify deployment
kubectl get deployments
kubectl get services
kubectl get pods| Feature | Description | Impact |
|---|---|---|
| Deployment Strategy | Rolling update | Zero-downtime deployments |
| Service Exposure | Internal cluster communication | Secure service mesh integration |
| Config Management | ConfigMaps and Secrets | Secure and flexible configuration |
| Resource Management | CPU/Memory limits | Optimal resource utilization |
Authentication Note: Include JWT token in Authorization header:
Authorization: Bearer <your-jwt-token>
| Endpoint | Method | Description | Role Required |
|---|---|---|---|
/admin/addService |
POST | Create new service | admin |
/admin/getServices |
GET | List all services | admin, provider, user |
π Request/Response Examples
POST /admin/addService
Authorization: Bearer <your-jwt-token>
Content-Type: application/json
Request:
{
"serviceName": "Plumbing",
"description": "Professional plumbing services",
"image": "plumbing.jpg"
}
Response:
{
"statusCode": 201,
"data": {
"serviceName": "Plumbing",
"description": "Professional plumbing services",
"image": "plumbing.jpg"
},
"message": "Service Plumbing created successfully"
}GET /admin/getServices
Authorization: Bearer <your-jwt-token>
Response:
{
"statusCode": 200,
"data": [
{
"id": 1,
"serviceName": "Plumbing",
"description": "Professional plumbing services",
"image": "plumbing.jpg"
}
],
"message": "Services fetched successfully"
}| Feature | Description | Business Impact |
|---|---|---|
| JWT Authentication | Secure endpoint access | Enhanced API security |
| Role-Based Auth | Granular access control | Improved security management |
| Data Persistence | Sequelize with MySQL | Reliable data storage |
| API Documentation | Clear endpoint documentation | Easier integration |
| Environment Isolation | Kubernetes namespace separation | Secure multi-environment setup |
| Scalability | Horizontal pod scaling | Handles increased load |
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Urban Assist Platform β’ Built with β€οΈ by the Urban Assist Team