The current project is a solution implementation in response of the Millennium Falcon Challenge. The details of the mission are described here.
Actually, there are several ways to get them. Let's discover that together!
To take up the challenge, the following stack has been chosen:
- Backend called the Millennium Falcon based on NestJS
- Frontend called c3po implemented in Angular
- Command line interface called r2d2 using Nest Commander
If you would like to explore the project, you would need at least Node LTS 18.12.1 and NPM 8.19.2.
Eventually you might need Docker with Docker Compose.
A first way to compute the odd is to use a developed web application which has been deployed : falcon.rlaurent.fr.
The UI consists in a basic computer screen where you can upload the empire JSON file by clicking on the icon :
which is responsive :
A second way to get the odds for a mission is to use the provided CLI, released in the project.
You can get the odds by launching a signed 'give-me-the-odds' executable. You must select the executable base on your platform, which is reflected in the folder name of the CLI package delivered. The platforms available are :
- Windows x64
- Linux x64
- MacOS x64
- MacOS arm64
For instance the syntax on an Archlinux distribution is :
./give-me-the-odds <path to the millennium-falcon json file> <path to the empire json file>
Note : The paths can be relative or absolute.
Example :
The CLI should guide you in your travel :
- No arguments provided :
- Too many arguments :
- Any time you can consult the help with :
give-me-the-odds -h
You can get the odds by running the web application on your computer. All you need is Docker and Docker Compose.
Once the project is released the CI/CD pipeline pushes Docker images to DockerHub :
So you can use docker-compose to deploy it locally. From the root of the project :
cd deployment && docker-compose up -d
Eventually the last way to get the odds is to use Swagger.
Along with the deliveries a Swagger doc of the API is deployed here : falcon-swagger.rlaurent.fr/swagger
You can then upload you empire json file and get the odds.
An example :
It's not the main goal of Swagger, of course! :)
However, you can discover the exposed API: Falcon mission odds' API :
If you would like to contribute to the project, you would need first to git clone the project :
git clone [email protected]:rlcDev/millennium-falcon-challenge.git
- To start the backend, you should run :
npm start
And to watch the changes :
npm run start:dev
And you can target the api on port 3000.
Note : Swagger will be available at http://localhost:3000/swagger
- To run the unit tests :
npm run test
- To run the e2e tests :
npm run test:e2e
- To check the test coverage
npm run test:cov
Also, there is a script to generate the cli:
npm run cli:build-prod
In order to be able to run it, you need have cp command.
Note : The generated CLI might work on your machine. But if you want to distribute it, you need to sign it. You can do it with ldid or codesign.
At the end all you need is its package.json.
- To start the frontend.
npm start
Note : The application will be available on port 4200 http://localhost:4200
- To run the unit tests :
npm run test
Same idea, you could refer to the package.json for other commands.
Whenever your code is ready, you can make sure that:
- Code guidelines are applied
- Your changes are tested with new tests
- The older ones passed
And you can submit a pull request to the develop branch and wait for reviews and approvals.
Thanks for reading :)!