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
PROGRAMMING · TYPESCRIPT · DEVOPS
A space flight booking backend with medical checks, seat control and payments, built into a DevOps workflow with tests, Docker and GitHub Actions.
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;
}
}// 01 · 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
// CHALLENGES AND SOLUTIONS
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.
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.
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
$ npm test PASS tests/PaymentService.test.ts PASS tests/BookingService.test.ts PASS tests/MedicalService.test.ts Tests: 7 passed, 7 total
// GALLERY
Tap an image to see it full screen.
// PROCESS
A change lands on the develop branch.
npm ci and Jest.
TypeScript compiled.
The image is built.
The image is published.
MISSION ACCOMPLISHED
Need a booking or payment system?
I build custom backends, tested and ready to deploy with DevOps practices.