Comprehensive resource management system built with Ballerina
A modular backend system for managing organizational resources including assets, meals, maintenance, users, and reporting with role-based access control and comprehensive analytics.
- Features
- Architecture
- Quick Start
- API Documentation
- Modules
- Configuration
- Development
- Deployment
- Contributing
- Asset Management - Complete asset lifecycle and allocation tracking
- User Management - Role-based user accounts and authentication
- Meal Services - Comprehensive meal planning and request system
- Maintenance - Facility maintenance request and tracking system
- Notifications - Real-time notification system for pending requests
- Organizations - Multi-tenant organization management
- Dashboard Analytics - Real-time system monitoring and reporting
- JWT Authentication - Secure token-based authentication
- Role-Based Access Control - Admin, SuperAdmin, User, Manager roles
- CORS Support - Cross-origin resource sharing configuration
- Data Privacy - Secure data handling and user privacy protection
- Automated Reports - Scheduled PDF report generation
- Email Distribution - Automatic report delivery
- Multi-Module Analytics - Comprehensive system insights
- Real-time Dashboards - Live system metrics and KPIs
graph TB
A[Frontend Applications] --> B[ResourceHub Backend]
B --> C[Authentication Module]
B --> D[Asset Module]
B --> E[User Module]
B --> F[Meal Module]
B --> G[Maintenance Module]
B --> H[Dashboard Module]
B --> I[Notification Module]
B --> J[Report Module]
B --> K[Organization Module]
B --> L[Common Module]
C --> M[Database Module]
D --> M
E --> M
F --> M
G --> M
H --> M
I --> M
J --> M
K --> M
L --> M
M --> N[MySQL Database]
J --> O[Report Service :9091]
H --> P[Dashboard Service :9092]
I --> Q[Notification Service :9093]
C --> R[Auth Service :9094]
M --> S[Main Services :9090]
- Independent Modules - Each feature as a separate module
- Shared Dependencies - Common utilities and database access
- Scalable Architecture - Easy to extend and maintain
- RESTful APIs - Standard HTTP REST endpoints
- Ballerina 2201.8.x or later
- MySQL 8.0 or later
- Java 17 or later
git clone https://github.com/FiveStackDev/Resource_Hub-Backend-.git
cd Resource_Hub-Backend-/Ballerina-- Create database
CREATE DATABASE resourcehub;
-- Run SQL scripts
mysql -u username -p resourcehub < resources/sql/create_tables.sql
mysql -u username -p resourcehub < resources/sql/add_accounts.sql
mysql -u username -p resourcehub < resources/sql/add_assets.sqlCreate Config.toml file:
[resourcehub]
USER = "your_db_user"
PASSWORD = "your_db_password"
HOST = "localhost"
PORT = 3306
DATABASE = "resourcehub"
SMTP_HOST = "smtp.gmail.com"
SMTP_USER = "your_email@gmail.com"
SMTP_PASSWORD = "your_app_password"
PDFSHIFT_API_KEY = "your_pdfshift_api_key"bal runThe services will be available at:
- Main Services:
http://localhost:9090 - Report Services:
http://localhost:9091 - Dashboard Services:
http://localhost:9092 - Notification Services:
http://localhost:9093 - Auth Services:
http://localhost:9094
| Service | Base URL | Port | Description |
|---|---|---|---|
| π Authentication | /auth |
9094 | User login and token management |
| π₯ User Management | /user |
9090 | User CRUD operations |
| π’ Asset Management | /asset |
9090 | Asset inventory and tracking |
| π Asset Requests | /assetrequest |
9090 | Asset allocation requests |
| π½οΈ Meal Types | /mealtype |
9090 | Meal type management |
| β° Meal Times | /mealtime |
9090 | Meal time slots |
| π Meal Calendar | /calendar |
9090 | Meal planning and requests |
| π§ Maintenance | /maintenance |
9090 | Maintenance request system |
| οΏ½ Notifications | /notification |
9093 | Real-time notification system |
| οΏ½π Admin Dashboard | /admin |
9092 | Administrative analytics |
| π€ User Dashboard | /user |
9092 | User-specific dashboard |
| π’ Organizations | /orgsettings |
9090 | Organization management |
| π Reports | /report |
9091 | Report generation |
| π Report Data | /schedulereports |
9091 | Report data endpoints |
All protected endpoints require JWT token in the Authorization header:
Authorization: Bearer <your-jwt-token>
- π€ User - Basic access to own data and resources
- π‘οΈ Admin - Administrative access to most system functions
- π SuperAdmin - Full system access and configuration
- π Manager - Enhanced user access with some admin capabilities
| Module | Description | Key Features |
|---|---|---|
| π’ Asset | Asset management and requests | CRUD operations, allocation tracking |
| π Auth | Authentication and authorization | JWT tokens, role-based access |
| π₯ User | User management and profiles | Account management, settings |
| π½οΈ Meal | Meal planning and services | Calendar, types, time slots |
| π§ Maintenance | Maintenance request system | Priority levels, status tracking |
| οΏ½ Notification | Real-time notifications | Pending request alerts, system notifications |
| οΏ½π Dashboard | Analytics and monitoring | Real-time stats, visualizations |
| π’ Organizations | Organization settings | Multi-tenant management |
| π Report | Report generation | Automated PDF reports |
| ποΈ Database | Database connectivity | MySQL client, HTTP listeners |
| π οΈ Common | Shared utilities | JWT validation, email service |
[resourcehub]
USER = "username" # Database username
PASSWORD = "password" # Database password
HOST = "localhost" # Database host
PORT = 3306 # Database port
DATABASE = "resourcehub" # Database nameSMTP_HOST = "smtp.gmail.com" # SMTP server
SMTP_USER = "email@domain.com" # Email username
SMTP_PASSWORD = "app_password" # Email passwordPDFSHIFT_API_KEY = "your_api_key" # PDF generation servicePlace SSL certificates in resources/certificates/:
certificate.crt- Public certificatecertificate.key- Private keycertificate.csr- Certificate signing request
# Build the project
bal build
# Run with hot reload
bal run --observability-included
# Generate documentation
bal doc
# Run tests
bal testResourceHub-Backend/
βββ π Ballerina.toml # Project configuration
βββ π Config.toml # Runtime configuration
βββ π Dependencies.toml # Dependency management
βββ π main.bal # Application entry point
βββ π modules/ # Feature modules
β βββ π asset/ # Asset management
β βββ π auth/ # Authentication
β βββ π user/ # User management
β βββ π meal/ # Meal services
β βββ π maintenance/ # Maintenance system
β βββ π notification/ # Notification system
β βββ π dashboard/ # Analytics dashboard
β βββ π organizations/ # Organization management
β βββ π report/ # Report generation
β βββ π database/ # Database connectivity
β βββ π common/ # Shared utilities
βββ π resources/ # Static resources
β βββ π certificates/ # SSL certificates
β βββ π sql/ # Database scripts
βββ π target/ # Build artifacts
- Create new module in
modules/directory - Define service endpoints and data models
- Implement business logic
- Add authentication and authorization
- Update main.bal to include new service
- Write comprehensive tests
- Update documentation
FROM ballerina/ballerina:2201.8.0
COPY . /app
WORKDIR /app
RUN bal build
CMD ["bal", "run", "target/bin/ResourceHub.jar"]
EXPOSE 9090 9091 9092 9093 9094-
Environment Variables
export RESOURCEHUB_USER="prod_user" export RESOURCEHUB_PASSWORD="secure_password" export RESOURCEHUB_HOST="db.production.com"
-
SSL Configuration
- Use production SSL certificates
- Configure HTTPS listeners
- Enable security headers
-
Database
- Use production MySQL instance
- Configure connection pooling
- Set up database backups
-
Monitoring
- Enable Ballerina observability
- Configure logging levels
- Set up health checks
- Fork the repository
- Create a feature branch
- Follow coding standards
- Write comprehensive tests
- Update documentation
- Submit a pull request
- Follow Ballerina best practices
- Use meaningful variable names
- Write comprehensive comments
- Include error handling
- Maintain consistent formatting
# Run all tests
bal test
# Run specific module tests
bal test modules/asset
# Generate test coverage
bal test --code-coverageThis project is licensed under the MIT License - see the LICENSE file for details.
FiveStackDev - Development Team
- GitHub: @FiveStackDev
- Minul Chathumal - @Minulck
- Theekshana Udara - @th33k
- Piumini Tishani - @PiuminiTishani
- Nethminiwelgama - @nethminiwelgama
- Sineth Nimhan - @SinethNimhan
For support and questions:
- π§ Email: resourcehub.contact.info@gmail.com
- π Documentation: Project Wiki
- π Issues: GitHub Issues
β Star this repo if you find it helpful! β
Made with β€οΈ by FiveStackDev