Intergalactic Fleet Manager is a comprehensive application designed to manage fleets, contracts, and space travel. It is built using NestJS, TypeORM, and MySQL 8, running on Node.js 20.14
This project provides a comprehensive solution for managing the transport fleet of goods across four planets in the galaxy. The system allows for efficient management of pilots, ships, transport contracts, and cargo, facilitating smooth interplanetary trade and travel.
- Pilot and Ship Management
- Add pilots and their ships to the system, including details such as pilot certification, name, age, credits, location, ship fuel capacity, fuel level, and weight capacity.
- Contract Management
- Publish and list transport contracts detailing the description, payload, origin, destination, and value.
- Accept contracts and manage their lifecycle until fulfillment.
- Interplanetary Travel
- Enable pilots to travel between planets, considering ship limitations and blocked routes.
- Validate travel routes and update database records accordingly.
- Fuel Management
- Register fuel refills when ships are on any planet, with each unit of fuel costing 7 credits.
- Credits and Transactions
- Grant credits to pilots upon contract fulfillment.
- Maintain a transaction ledger of all activities, sorted by date.
- Reporting
- Generate reports on the total weight of resources sent and received by each planet.
- Calculate the percentage of resource types transported by each pilot.
- Maintain an intergalactic transaction ledger.
- Different routes have varying distances and fuel costs.
- Certain routes are blocked due to obstacles like asteroid belts or scrapyards.
- The system ensures all travel routes are valid before execution.
- Pilot: Contains certification, name, age, credits, and location.
- Ship: Includes fuel capacity, fuel level, and weight capacity.
- Contract: Describes the transport contract, payload, origin, destination, and value.
- Resource: Lists resources (minerals, water, food) and their weights.
- Proper programming and architecture techniques.
- Persistence using a database.
- Comprehensive API documentation and usage instructions.
- Mandatory unit and acceptance tests, with at least one end-to-end integration test.
- Simple application setup, preferably with Docker.
Ensure the documentation includes:
- Detailed API endpoints or schema.
- Instructions for setting up and running the application.
- Test coverage and examples of usage.
- Docker
- Docker Compose
- TypeScript
- NestJS
- TypeORM
- MySQL 8
- Node.js 20.14
To get started with the application, follow these steps:
Ensure you have Docker and Docker Compose installed on your machine.
-
Start the application:
docker-compose up --build
This command will build and start the application along with its dependencies, including MySQL.
-
Run the database migrations:
docker-compose exec app npm run typeorm:migration:run
This command will execute all pending database migrations to set up the schema.
-
Access the application:
Open your browser and go to http://localhost:3333. You will find the Swagger documentation for the API.
-
Test the application:
docker-compose exec app npm run test
docker-compose exec app npm run test:e2e
Use Swagger interface to manage ships, pilots, contracts, and travel.
Follow the steps below to use the API:
- Create Ship
- Create Pilot
- Add Credits to Pilot
- Add fuel to Ship
- Create Contract
- Accept Contract
- Create Travel
- Generate Reports