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 databaseCREATEDATABASEresourcehub;
-- 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 = 3306DATABASE = "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 usernamePASSWORD = "password"# Database password HOST = "localhost"# Database hostPORT = 3306# Database portDATABASE = "resourcehub"# Database nameSMTP_HOST = "smtp.gmail.com"# SMTP serverSMTP_USER = "email@domain.com"# Email usernameSMTP_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 9094Environment 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