Skip to content

Repository files navigation

oskar barcz / flight-tracker-api

The backend service of MyPreflight platform. Serves the REST API and the live flight event stream that the web app, and the transponder companion run on.

About

MyPreflight is a briefing service and electronic flight board app for your virtual flights, providing you realistic figures, checklists, procedures and data to perform your flight like a real pilots do. You can customize your experience, integrate with SimBrief and other tools. Check out our homepage at mypreflight.io.

This module is the part running on our servers. It owns everything the clients only display:

  • keeps the flight lifecycle — planning, check-in, boarding, off-block, airborne, on-block and closing,
  • computes timesheets and loadsheets, and issues the briefing with the ATIS, METAR and TAF held for the departure,
  • imports flight plans from SimBrief and airport, terminal and gate data curated from OpenStreetMap,
  • receives live position from the transponder companion and republishes it to every subscribed client,
  • delivers announcements and direct messages through the Discord bot.

The web app lives in flight-tracker-app and the desktop companion in flight-tracker-transponder-app.

integrity release license

Built with

TypeScript NestJS Node.js PostgreSQL Prisma Docker

Commands and queries are separated with @nestjs/cqrs, every endpoint is a single action controller, and behaviour is covered end-to-end with Cucumber.

Getting started

Environment

This app uses docker-based virtualization to run. To set up the project, follow these steps:

  1. Clone the project by running:

    git clone git@github.com:oskarbarcz/flight-tracker-api.git
  2. Prepare an environment variable file by copying .env.dist to .env and fill it with your data.

    cd flight-tracker-api
    cp .env.dist .env
  3. Use docker compose to set up the environment

    docker compose up -d --build

    Packages, database schema, seed data will be configured automatically.

  4. Your project should be up and running. Open the browser and go to http://localhost/api to see the api documentation. The seeded API users (all share the password P@$$w0rd) are:

    Name Role Username Notes
    John Doe Admin admin@example.com
    Alice Doe Operations operations@example.com
    Abby Doe Operations abby.doe@example.com SimBrief connected (valid flight plan)
    Claudia Doe Operations claudia.doe@example.com SimBrief connected (plan references unknown aircraft)
    Diana Doe Operations diana.doe@example.com SimBrief connected (plan references unknown alternate)
    Rick Doe Cabin crew cabin-crew@example.com
    Alan Doe Cabin crew alan.doe@example.com
    Michael Doe Cabin crew michael.doe@example.com Discord linked — receives briefing DMs
    Grace Doe Operations grace.doe@example.com Google-only — no password; Discord linked, so it cannot be unlinked either

Websockets

App is using Websockets for dynamic communication in the areas of flight tracking dashboard. Read more about websocket implementation in a dedicated document.

Email

This app sends transactional emails, see more in a dedicated document.

Discord

This app integrates deeply with Discord, read more about it in a dedicated document.

Generating certs

Application has by default configured EC certificates. However, if you want to create custom ones, use the command below:

openssl ecparam -genkey -name prime256v1 -noout -out private.key
openssl ec -in private.key -pubout -out public.key

Build, test and deploy

This project uses semantic versioning.

This project has configured continuous integration and continuous deployment pipelines. It uses GitHub Actions to automatically build, test and deploy the app to the DigitalOcean. You can find the configuration in .github/workflows directory.

Contact

My name is Oskar, an experienced programmer, cybersecurity enthusiast, and conference speaker from Poland. Feel free to contact me via the platforms below:

LinkedIn GitHub Website

License

A public domain under the Unlicense. Do what you want with it. I am an experienced software engineer, but I am not connected anyhow with the airline industry. This project is created for educational purposes only and should not be used for real-world aviation operations.

About

The backend service of MyPreflight platform, serves the REST API and the live flight event stream that the web app, and the transponder companion run on.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages