Skip to content

Urban-Assist/admin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‘¨β€πŸ’Ό Admin Management Microservice

Version Node.js Express License PRs Welcome

Admin Management Service Logo

Administrative service management platform for Urban Assist

Getting Started β€’ Installation β€’ Configuration β€’ API β€’ Docker β€’ Kubernetes β€’ Contributing


πŸ“š Overview

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

πŸš€ Getting Started

Prerequisites

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

πŸ“¦ Installation

  1. Clone the repository:

    git clone <repository-url>
  2. Navigate to the admin service directory:

    cd urban-assist/admin
  3. Install dependencies:

    npm install

βš™οΈ Configuration

Environment Variables

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

πŸƒβ€β™‚οΈ Running the Service

Choose your preferred deployment method:

Command Description
npm start Run in development mode with nodemon
node src/index.js Run the application directly

🐳 Docker

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:latest

☸️ Kubernetes

Deploy the service to Kubernetes:

# Apply all configurations
kubectl apply -f k8s/

# Verify deployment
kubectl get deployments
kubectl get services
kubectl get pods

Kubernetes Features

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

πŸ“‘ API Endpoints

Authentication Note: Include JWT token in Authorization header:

Authorization: Bearer <your-jwt-token>

Service Management

Endpoint Method Description Role Required
/admin/addService POST Create new service admin
/admin/getServices GET List all services admin, provider, user
πŸ“‹ Request/Response Examples

Create Service

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"
}

List Services

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"
}

πŸ›  Technologies

Node.js Express MySQL Docker Kubernetes


🚒 Deployment Impact Features

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

πŸ‘₯ Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Urban Assist Platform β€’ Built with ❀️ by the Urban Assist Team

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •