How wildclown/ebury-challenge works
Project type and purpose
• This is primarily a single‐service “Flight Management” application (written in Kotlin/Spring Boot) that offers two interfaces:
a) A command-line interface (CLI) to load a CSV of flight routes, accept “ORIGIN-DEST” queries, and print the cheapest path.
b) A REST API (two endpoints) to register new routes (persisting back to the CSV) and query the best route.
• In addition, there is a small standalone “csv-to-json-converter” front-end utility: a static HTML+JS page that fetches the OpenAPI spec (Ebury.openapi.json) and a CSV file, converts the CSV flight data into JSON, and displays it in the browser.
File structure
Top-level:
• ebury-challenge/ → the Kotlin/Spring Boot application
• src/main/kotlin/br/com/ebury/config → application configuration
• controller → REST controller class with two endpoints
• service → business logic interfaces and implementations
• repository → data access interfaces and custom impl that read/write the CSV file
• model/dto/exceptions/validations → domain models, API DTOs, validation & error handlers
• resources → application.yaml and dev-specific YAML (no external DB; uses CSV file)
• test → unit tests for controller, service, validation layers
• docker-compose.yml and Gradle wrapper → containerization and build scripts
• .env.example → environment placeholders for CSV path, etc.
• csv-to-json-converter/ → static front-end
• index.html, csvConverter.js, openApiGetter.js → loads OpenAPI, fetches CSV, converts and displays JSON
• Ebury.openapi.json → OpenAPI specification for the REST API
• input-example.csv → sample flight routes input
README
• Describes the problem: find cheapest route ignoring number of hops
• CLI invocation: mysolution input-routes.csv
• Two REST interfaces:
• POST /routes – register new route (append to CSV)
• GET /routes/{from}/{to} – return best route and cost
• Recommendations: containerize, write unit tests, document API & design decisions
What
• Client – two types of consumers:
· CLI Client (console)
· REST Client (e.g., Postman, Front-end)
• Flight Management Service (Spring Boot application) comprising:
· Controller layer (REST endpoints)
· CLI‐runner component (logic that boots on application start to read args)
· Service layer (FlightManagementService)
· Repository layer (CustomFlightRouteRepository / FlightRouteRepository)
• Persistence – CSV file (input-routes.csv) as primary datastore
• csv-to-json-converter app (static web page + JS)
• OpenAPI specification (Ebury.openapi.json) as contract
• CLI Client → Service start-up → Repository reads CSV → service computes queries → CLI prints output
• REST Client → Controller endpoints → Service layer → Repository reads/appends CSV → Controller returns JSON response
• Converter front-end → openApiGetter.js fetches Ebury.openapi.json → csvConverter.js fetches input-routes.csv (or via API) → displays JSON
c. Architectural patterns & principles:
• Layered architecture (Controller → Service → Repository)
• Single responsibility: each layer only handles its own concern
• CSV file as a simple persistence mechanism (no external DB)
• Exception handling centralized in GlobalExceptionHandler
• Validation logic separated into controller/service validation classes
• Containerized deployment with Docker Compose
d. Key technologies/frameworks:
• Kotlin + Spring Boot Web
• Gradle + Docker Compose
• Static HTML/JavaScript for converter
• OpenAPI (Swagger) specification