PROGRAMMING · TYPESCRIPT · DEVOPS

Space Flight Booking

A space flight booking backend with medical checks, seat control and payments, built into a DevOps workflow with tests, Docker and GitHub Actions.

src/services/BookingService.ts
export class BookingService {
    private bookings: Booking[] = [];

    createBooking(customer: Customer, flight: Flight): Booking {
        if (flight.capacity <= 0) {
            throw new Error("No seats available on this flight.");
        }
        const newBooking = new Booking(
            this.bookings.length + 1, customer, flight, "pending"
        );
        flight.capacity--;
        this.bookings.push(newBooking);
        return newBooking;
    }
}
Program
Computer Programmer program · Lambton College
Year
2024
Role
Backend and DevOps developer
Stack
TypeScript · Jest · Docker · GitHub Actions

// 01 · THE MISSION

The mission

Space Flight Booking is the backend for an agency that sells flights to Mars. Before confirming a booking, the system checks that the passenger is an adult with a medical certificate; if there are seats, it creates the booking, takes the seat and records the payment. The project had a second, equally important goal: applying DevOps practices, with automated tests, a Docker image and a GitHub Actions pipeline that installs, tests, builds and publishes the application. Developed within the Computer Programmer program at Lambton College in Ontario, Canada, following professional standards for development, documentation and version control.

// WHAT WAS BUILT

Business logic

  • Medical check: over 18 with a certificate
  • Bookings with seat control
  • Cancellations that free the seat
  • Payments recorded per booking
  • States defined with enums: confirmed, pending and cancelled

Quality

  • Jest tests for bookings, payments and medical checks
  • Event logging with date and time
  • Separate entities and services

DevOps

  • Dockerfile that compiles TypeScript and starts the app
  • GitHub Actions pipeline on the develop branch
  • Install, test and build on every push
  • Image published to Docker Hub with credentials in secrets

// CHALLENGES AND SOLUTIONS

Structuring the pipeline

Defining the workflow steps in YAML was the first challenge. I solved it by studying the GitHub Actions documentation and practical examples until installation, testing and building were automated.

Docker on an incompatible machine

My computer could not run Docker. Since the project was versioned on GitHub, I cloned it on another machine and kept working without losing progress, until the image was built and published to the registry.

Cloud deployment

For continuous deployment I explored AWS and Azure. Both required subscriptions and advanced configuration, so the delivery went up to publishing the image on Docker Hub, leaving cloud deployment as the next stage.

// TESTS

All seven tests passing

npm test
$ npm test

 PASS  tests/PaymentService.test.ts
 PASS  tests/BookingService.test.ts
 PASS  tests/MedicalService.test.ts

Tests:       7 passed, 7 total

// PROCESS

How I did it

  1. 01

    Push

    A change lands on the develop branch.

  2. 02

    Tests

    npm ci and Jest.

  3. 03

    Build

    TypeScript compiled.

  4. 04

    Docker

    The image is built.

  5. 05

    Docker Hub

    The image is published.

MISSION ACCOMPLISHED

Results and impact

Need a booking or payment system?

I build custom backends, tested and ready to deploy with DevOps practices.