{"id":25762006,"url":"https://github.com/przemekhasz/mountain-coaster-system","last_synced_at":"2026-05-07T01:35:08.749Z","repository":{"id":279628745,"uuid":"938165041","full_name":"Przemekhasz/mountain-coaster-system","owner":"Przemekhasz","description":"This application is an API-based system for managing mountain roller coasters, their wagons, and monitoring system capacity. Built using CodeIgniter 4, this system runs in both development and production environments and uses Redis for data storage.","archived":false,"fork":false,"pushed_at":"2025-02-26T14:44:02.000Z","size":3650,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-27T01:38:46.924Z","etag":null,"topics":["codeigniter","ddd","php","redis"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Przemekhasz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-24T14:22:53.000Z","updated_at":"2025-02-26T14:44:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"54ed1b2d-b7e8-464f-99d6-4c93d8af198b","html_url":"https://github.com/Przemekhasz/mountain-coaster-system","commit_stats":null,"previous_names":["przemekhasz/mountain-coaster-system"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Przemekhasz/mountain-coaster-system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Przemekhasz%2Fmountain-coaster-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Przemekhasz%2Fmountain-coaster-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Przemekhasz%2Fmountain-coaster-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Przemekhasz%2Fmountain-coaster-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Przemekhasz","download_url":"https://codeload.github.com/Przemekhasz/mountain-coaster-system/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Przemekhasz%2Fmountain-coaster-system/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264219260,"owners_count":23574872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeigniter","ddd","php","redis"],"created_at":"2025-02-26T19:27:24.880Z","updated_at":"2026-05-07T01:35:08.708Z","avatar_url":"https://github.com/Przemekhasz.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mountain Roller Coaster System 🎢\n\n## Overview\n\nThis application is an API-based system for managing mountain roller coasters, their wagons, and monitoring system capacity. Built using CodeIgniter 4, this system runs in both development and production environments and uses Redis for data storage.\n\n## Architecture\n\nThe project follows clean architecture principles, implementing several design patterns:\n\n- **Domain-Driven Design (DDD)** - Focusing on the core domain models and business logic\n- **Command Query Responsibility Segregation (CQRS)** - Separating read and write operations\n- **Repository Pattern** - For data access abstraction\n- **Dependency Injection** - For loose coupling and testability\n- **Event-Driven Architecture** - For system notifications and monitoring\n- **Value Objects** - For encapsulating domain concepts\n\n## System Features\n\n- Management of roller coasters with operating hours, staff, and capacity metrics\n- Management of wagons with seat capacity and speed attributes \n- Staff requirement calculations and shortage alerts\n- Client capacity analysis and wagon requirement calculations\n- Real-time monitoring through an asynchronous CLI service\n- Separate development and production environments\n\n## Installation\n\n### Requirements\n\n- PHP 8.0 or higher\n- Docker and Docker Compose\n- Composer\n\n### Setup\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/Przemekhasz/mountain-coaster-system.git\ncd mountain-coaster-system\n```\n\n2. Install dependencies:\n\n```bash\ncomposer install\n```\n\n3. Set up environment:\n\n```bash\ncp env .env\n```\n\n4. Start the development environment:\n\n```bash\ncd docker/dev\ndocker-compose up -d\n```\n\n5. For production:\n\n```bash\ncd docker/prod\ndocker-compose up -d\n```\n\n## API Endpoints\n\n### Roller Coasters\n\n- **POST /api/coasters** - Register a new roller coaster\n  ```json\n  {\n    \"liczba_personelu\": 16,\n    \"liczba_klientow\": 60000,\n    \"dl_trasy\": 1800,\n    \"godziny_od\": \"8:00\",\n    \"godziny_do\": \"16:00\"\n  }\n  ```\n\n- **PUT /api/coasters/:coasterId** - Update an existing roller coaster\n  ```json\n  {\n    \"liczba_personelu\": 20,\n    \"liczba_klientow\": 70000,\n    \"godziny_od\": \"9:00\",\n    \"godziny_do\": \"17:00\"\n  }\n  ```\n\n- **GET /api/coasters/:coasterId** - Get details of a roller coaster\n\n- **GET /api/statistics** - Get system-wide statistics\n\n### Wagons\n\n- **POST /api/coasters/:coasterId/wagons** - Add a new wagon to a roller coaster\n  ```json\n  {\n    \"ilosc_miejsc\": 32,\n    \"predkosc_wagonu\": 1.2\n  }\n  ```\n\n- **DELETE /api/coasters/:coasterId/wagons/:wagonId** - Remove a wagon from a roller coaster\n\n## Monitoring Service\n\nThe system includes a real-time asynchronous monitoring service that displays the status of all roller coasters and identifies potential issues.\n\nTo start the monitoring service:\n\n```bash\nphp spark monitor\n```\n\n### Screenshots\n\nHere are some screenshots demonstrating the system in action:\n\n#### API Operations\n\n![Creating a New Roller Coaster](screenshots/create_coasters.png)\n*API Response when creating a new roller coaster with specified parameters*\n\n![Adding Wagons to a Coaster](screenshots/create_wagons.png)\n*Adding new wagons to increase the capacity of a roller coaster*\n\n![Removing a Wagon](screenshots/delete.png)\n*Deleting a wagon from the system when it's no longer needed*\n\n![Getting Coaster Details](screenshots/get_coaster.png)\n*Retrieving detailed information about a specific roller coaster*\n\n![Updating Coaster Parameters](screenshots/update_coaster.png)\n*Modifying an existing roller coaster's operating parameters*\n\n![System Statistics](screenshots/stats.png)\n*Overview of system-wide statistics showing all coasters and resources*\n\n![System Logs](screenshots/logs.png)\n*Log entries showing detected problems and system notifications*\n\n#### CLI Monitoring Tool\n\nThe following screenshots show the CLI monitoring tool in action with real-time updates and status information:\n\n![Monitoring Console View 1](screenshots/spark1.png)\n*Real-time monitoring console showing coaster status and statistics*\n\n![Monitoring Console View 2](screenshots/spark2.png)\n*Monitoring display with detailed capacity and staffing metrics*\n\n![Monitoring Console View 3](screenshots/spark3.png)\n*CLI monitoring showing detected issues and resource allocation*\n\n![Monitoring Console View 4](screenshots/spark4.png)\n*Status overview with multiple coasters and their operating parameters*\n\n![Monitoring Console View 5](screenshots/spark5.png)\n*System performance metrics and capacity analysis in the monitoring console*\nExample console output:\n\n## Technical Design\n\n### Domain Layer\n\nThe domain layer contains the core business logic and entities:\n\n- **Entities**: Coaster, Wagon\n- **Value Objects**: OperatingHours, Speed\n- **Domain Events**: CoasterRegistered, WagonAdded, StaffShortage, ClientCapacityIssue\n\n### Application Layer\n\nThe application layer orchestrates the use cases:\n\n- **Commands**: RegisterCoaster, RegisterWagon, RemoveWagon, UpdateCoaster\n- **Queries**: GetCoasterDetails, GetSystemStatistics\n- **DTOs**: CoasterDTO, WagonDTO\n\n### Infrastructure Layer\n\nThe infrastructure layer handles technical concerns:\n\n- **Repositories**: RedisCoasterRepository, RedisWagonRepository\n- **Services**: EventDispatcher, LoggingService, IdGenerator\n- **CLI**: MonitoringService\n\n### Configuration\n\n- Separate Docker environments for development and production\n- Redis configuration for data persistence\n- Environment-specific logging levels\n\n## Development vs. Production Environments\n\n### Development Environment\n\n- All log levels are recorded\n- Runs on port 8080\n- Data is isolated from production\n- Meant for testing and development\n\n### Production Environment\n\n- Only warning and error logs are recorded\n- Runs on port 80\n- Optimized for performance\n- Isolated data store\n\n## Best Practices Implemented\n\n- **SOLID Principles**\n  - Single Responsibility Principle - Each class has one job\n  - Open/Closed Principle - Entities are extendable without modification\n  - Liskov Substitution Principle - Repositories use interfaces\n  - Interface Segregation - Specific interfaces for specific clients\n  - Dependency Inversion - High-level modules don't depend on low-level modules\n\n- **Clean Code**\n  - Meaningful variable and method names\n  - Small, focused methods\n  - Proper exception handling\n  - Input validation\n  - Comprehensive comments\n\n- **Error Handling**\n  - Domain-specific exceptions\n  - Graceful error responses\n  - Comprehensive logging\n\n- **Testability**\n  - Dependency injection\n  - Mockable interfaces\n  - Unit test structure\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprzemekhasz%2Fmountain-coaster-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprzemekhasz%2Fmountain-coaster-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprzemekhasz%2Fmountain-coaster-system/lists"}