{"id":14977556,"url":"https://github.com/hiejulia/flight-booking","last_synced_at":"2025-10-28T04:31:38.465Z","repository":{"id":37069893,"uuid":"131208974","full_name":"hiejulia/flight-booking","owner":"hiejulia","description":"Flight booking services","archived":false,"fork":false,"pushed_at":"2025-01-21T02:25:56.000Z","size":421,"stargazers_count":20,"open_issues_count":4,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-01T11:25:11.735Z","etag":null,"topics":["databases","distributedsystems","docker","microservice","neo4j","python","spring-cloud","spring-framework","sql"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hiejulia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-26T20:48:04.000Z","updated_at":"2025-01-21T02:26:01.000Z","dependencies_parsed_at":"2023-01-20T13:31:43.506Z","dependency_job_id":null,"html_url":"https://github.com/hiejulia/flight-booking","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiejulia%2Fflight-booking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiejulia%2Fflight-booking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiejulia%2Fflight-booking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiejulia%2Fflight-booking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hiejulia","download_url":"https://codeload.github.com/hiejulia/flight-booking/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238597386,"owners_count":19498396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["databases","distributedsystems","docker","microservice","neo4j","python","spring-cloud","spring-framework","sql"],"created_at":"2024-09-24T13:55:54.330Z","updated_at":"2025-10-28T04:31:36.918Z","avatar_url":"https://github.com/hiejulia.png","language":"Java","funding_links":["https://www.buymeacoffee.com/hientech"],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://www.buymeacoffee.com/hientech\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/-buy_me_a%C2%A0coffee-gray?logo=buy-me-a-coffee\" alt=\"Buy Me A Coffee\"\u003e\u003c/a\u003e\n  \u003cbr\u003e\n# flight-booking\n### This is not production level code. I am no longer maintain for this project. \nOnline flight reservation system \n+ User service : operations on User service \n    + Database : Neo4J\n+ Booking service : Flight service and User service to perform operations on booking. It will use flight search and its associated table\n    + Database :\n+ Flight service : operations and searching based on criteria, providing association between Flight and flight trip \n    + Database : MySQL\n    + Distributed Caching layer : Hazelcast\n    + Flight search : ElasticSearch `localhost:9200/flights/external/_bulk`\n    `localhost:9200/flights/_search?q=*\u0026pretty`\n+ Billing service : operations on billing \n    + Database : MongoDB\n    + Messaging : RabbitMQ (queue: billingQueue)\n+ Passenger service \n    + Database : Cassandra \n+ Organisation service \n    + Database : \n\n+ Account service \n    + Database : Cassandra \n\n+ Cash flow service\n    + Database : PostgreSQL\n    + Caching - Message queue : Redis\n+ Bid service \n    + Database : PostgreSQL \n    + Caching : Redis \n    + Index tool : ElasticSearch \n\n+ Back up service : Back up microservice database Schedule distributed \n    + \n+ Booking-client \n    \n+ Auth-server : User / Passenger need to register/ login - authorized \n+ Twitter Service : read twitter streams(from Airline branch twitter) and persist them on MongoDB and served them as a REST API(HATEOAS) to other service\n    + Database : MongoDB \n+ Search twitter service : Read tweets from twitter service and push it on ElasticSearch as a search engine and produce userful search for these tweet\n    + Database : \n    + Index engine : Solr\n+ social-network-service : send flights and passengers data to Agency social network \n    + Database : Neo4J\n\n+ Booking Request Service : passenger will confirm the flight booking request or cancel request \n    + Caching : Redis \n    + Database : Neo4J(BookingRequest node, Passenger node)\n\n### Stack \n+ Applied to the principles of the 12 Factor App\n+ Microservice architecture : Spring cloud, Netflix Eureka, Ribbon, Zuul, Hystrix, Service discovery, Load Balancing, API gateway, Circuit breaker (Hystrix)\n+ Spring framework : Spring Boot, Spring cloud, Spring data, Spring Stream , Spring Reactor\n+ CQRS - Event sourcing \n+ Database : PostgreSQL, MongoDB, Cassandra, MySQL - MariaDB, Neo4J , MySQL\n+ Caching : Redis\n+ Messaging system : RabbitMQ , Kafka(Zookeeper)\n+ Batch process \n+ Apache Avro\n+ ElasticSearch - Logstash - Kibana \n    + ES GUI plugin \n    + Install Logstash \n        + Config logstash \n    + Install Kibana \n        + localhost:5601\n    + Docker image ELK stack from Docker hub \n        + Docker UI : Rancher - manage docker container by UI \n            + Install Rancher : `sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server`\n            + Goto : `http://ip:8080`\n            + Custom (EC2 - Azure, AWS )- connect server with rancher server \n+ Container: Docker  - Docker compose \n    + In each service - Docker image is built to production deploy - Docker maven plugin is added to pom.xml \n    + Update Spring profile with Docker\n    + Config Docker-maven-plugin \n+ REST API testing using Postman\n+ Testing : JUnit, E2E test with Cucumber\n    + JUnit, Mockito, WireMock \n    + Unit test\n    + Integration testing \n        + Docker - Fail safe plugin \n+ Event - driven system \n+ Security : OAuth/ JWT \n+ Log analysis : ELK stack - Logstash - ElasticSearch - Kibana to index logs \n    + ElasticSearch : distributed, JSON based search and analytics engine designed for horizontal scalability, maximum reliability , easy management \n    + Logstash : dynamic data collection pipeline with an extension plugin ecosystem and strong elasticsearch synergy\n    + Kibana : visualization of data though UI \n    + ELK stack architecture \n        + ELK stack in Docker containers - RabbitMQ server has Logstash pipeline \n        + User view logs from Kibana which is the user interface of elasticsearch cluster -\u003e logstash will listen the application logs and transform those to json format and send to elasticsearch \n    + Distributed tracing and centralized log management\n        + Spring Cloud sleuth \u0026 Zipkin \n        + Config Kibanan and view the logs \n+ API documentation : Swagger - Curl -\n+ API UI testing: Postman \n+ Service Logging / Monitoring \n\n+ Correlation ID for service call for all services \n    + REST call \n    + Zipkin and Sleuth\n\n\n\n### Endpoint documentation \n+ Flight service\n    + GET `v1/flights/id` : get one flight by id / info \n    + GET `v1/flights` : retrieve all the flights that matches the value of query param \n    + POST `v1/flights` : create new flight \n    + GET `v1/airports` : get a list of airports\n    + GET `v1/airports/{airport-name}` : list of flights from this airport \n    + Search flight by name\n    + Search flight by code \n        + POST `v1/airports/flights/code`\n\n+ Booking service : User can book a flight ticket and fill the personal information - billing information \n    + POST `v1/flights/{flight-id}/booking ` : \n    + Get booking details \n\n+ Billing service : User can pay the flight order \n    + GET `v1/flights/{flight-id}/payment`\n    + Make payment(handle payment errors: payment authorization timeout and invalid credit card info )\n\n+ User can unsubscribe to the flight ticket info\n    + GET `v1/flights/{flight-id}/payment/ubsubscribed`\n\n+ Passenger service \n    + GET `v1/passengers`\n    + GET `v1/passengers/id`\n    + POST `v1/passengers`: create one passenger\n    + GET `v1/passengers/organisations/id` : find passengers by organisation \n+ Organisation service \n\n\n\n### Run the project \n\n+ Run everything : \n\n\n\n+ `docker-compose up` : RabbitMQ port set up (in the docker folder) : it will start the RabbitMQ and MongoDB instance \n\njava -jar eureka-server/target/eureka-server.jar  : Start Eureke server  -  Eureka server port set up\njava -jar dashboard-server/target/dashboard-server.jar : Start Hystrix dashboard - Hystrix port set up \njava -jar turbine-server/target/turbine-server.jar \n\njava -jar flight-service/target/restaurant-service.jar \njava -jar user-service/target/user-service.jar \njava -jar booking-service/target/booking-service.jar \njava -jar api-service/target/api-service.jar\n\n+ Before start Zuul service, make sure that all of the services are up in the Eureka dashboad : `localhost:8761`\njava -jar zuul-server/target/zuul-server.jar \n\n\n\n+ How to double check all components are setting up \n1. Browser : Eureka server \n`http://localhost:8761/`\nService instances are register with Eureka \n\n\n2. Browser : Hystrix monitor : `http://localhost:7979/ ` - Hystrix dashboard \n+ Substitude : [http://hostname:port/turbine/turbine.stream] to\n                    URL:  http://localhost:9001/hystrix.stream\n         --\u003e Monitor Stream\n\n3. Browser : RabbitMQ management : `http://localhost:15672/` (guest- guest )\n\n\n\n+ Install and run \n    + MongoDB : `docker run --name mongo -p 27017:27017 -d mongo`\n    + Redis : `dockewr run --name redis -p 6379:6379 -d redis`\n\n### Microservice architecture \n+ Service discovery and registration - Eureka \n    + Run multiple instances of the same microservices\n    + Look up the host name and the port number by checking discovery service \n    + Eureka server : `http://localhost:8761/`\n    + Advanced discovery client config \n    + Enable secure communication between client and server\n    + Config failover and peer - to - peer replication mechanism \n    + Register instances of client - side application in different zones \n    + Cluster env : zone mechanism - enable zone handling \n    + Replication and high availability - cluster mechanism - peer to peer replication model - replication mechanism \n    + Run instances of Eureka \n    + Enable secure communication between client and server \n        + Register a secure service \n        + Enable SSL by generating a self - signed certificate \n        + SSL is enabled for edge-service only \n\n+ Config service   \n    + Application configuration to all the other microservices \n    + Port number, context paths \n    + Configuration - using GIT \n    + Vault - cmd - add new values to the server - run from docker container \n\n+ Edge or proxy server (API gateway) - Zuul - Gateway service \n    + Gateway service Zuul \n    + Proxy all calls to the target microservice \n    + Solve CORS request - Enable CORS headers on the proxy only\n    + Zuul integrates with Eureka (discovery-service)\n    + Gateway service that provides dynamic routing, monitor, resiliency, security \n+ Load balancing : Ribbon is used for load balancing . It is integrated with the Zuul and Eureka services to provide load balancing for both internal and external calls \n    + Server side load balancing : Zuul server as edge server \n    + Client side load balancing : Ribbon - FeignClient \n+ Circuit breaker : Netflix hystrix \n+ Distributed tracing : Zipkin, Spring Cloud Sleuth - distributed tracing via logs - distributed tracing system with request visualization \n    + tracing mechanism \n    + trace and span ID \n    + record time - latency analysis - statistics = zipkin = query and visualize data \n    + stream = producer of message sent to message broker \n+ Monitoring : Netflix Turbine  - and Dashboard \n    + Hystrix provides a dashboard UI `locahost:7979`\n    + Turbine stream `http://localhost:8989/turbine.stream`\n    + Hystrix uses RabbitMQ to send metrics data feed to Turbine \n    + Config and collect metrics and tracing from all services\n+ UUA servvice \n    + User account \u0026 Authentication - security of the application \n    + /token endpoint to retrieve a token \n    + /user endpoint to validate a token and retrieve the user and its roles\n    + Token in this case are long-lived \n\n+ Integration\n+ Batch processing \n+ Security service \n    + Secure microservices architecture \n    + SSL enabled \n\n+ Dependency management : Maven \n+ Data Lake \n+ Testing microservices\n    + Deploy all of them and test them in an end-to-end fashion \n    + Mock external dependencies in unit/integration test \n    \n+ Event sourcing \n+ HTTP listener \n+ Containers / Virtual Machines \n+ Cluster Control and Provisioning \n\n+ Admin server \n\n+ Spring cloud DataFlow server \n    + `dataflow-service` is a Spring Boot app that loads the local DataFlow server. Port 9393\n    + To interact with the dataflow server, you can donw \n\n\n+ Microservice service design : contract design and protocol selection \n    + Contract design \n        + Simplicity - consumer \n        + KISS \n        + Consumer driven contract \n    + Protocol selection \n        + HTTP/ SOAP \n        + Messaging \n    + Message oriented service \n        + JMS / AMQP protocol - JSON \n        + Messaging over HTTP \n        + Async REST \n    + HTTP and REST endpoint \n        + Protocol handling \n        + Traffic routing \n        + Load balancing \n        + Security systems \n        + HATEOAS\n    + Optimize communication protocol - for communication between service \n        + Avro \n        + Protocol Buffers \n        + Apache Thrift \n        + Custom binary protocol \n        + RPC \n+ API documentation : Swagger, RAML, API blueprint \n+ API versioning \n    + URL segment\n    + Accept header \n    + Custom Header \n+ Authentication - Authorization \n    + 2 legged authentication\n    + Basic HTTP authentication\n    + 3 legged authentication\n+ ELK stack \n    + ELK config - Use Docker container to run the ELK stack \n    1. Run this command on Docker terminal `docker run -d -it --name es -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS=\"-Xms1g -Xmx1g\" -m 1500m elasticsearch` : start ElasticSearch container on 9200/9300 port \n    2. `docker run -d -it --name kibanak --link es:elasticsearch -p 5601:5601 kibana` : start Kibana on 5601 port and it will also link it with ElasticSearch container \n    3. `docker run -d -it --name logstash -p 5000:5000 logstash -e 'input { tcp { port =\u003e 5000 codec =\u003e \"json\" } } output { elasticsearch { hosts =\u003e [\"192.168.99.100\"] index =\u003e \"micro-%{serviceName}\"} }'` : start Logstash container on 5000 port and also create an index with name micro-*\n    4. Checking with `docker ps` command, all the container should be running \n    + Default port used for docker container is 192.168.99.100 \n\n    + Kibana : check logs on Kibana \n        + With `Log.info` statement and `logback.xml` configuration we can index and view log from Kibana \n        + Query with Kibana \n            + Key-value search \n            + Boolean operator - type:radar AND status:500\n            + Request UUID tracking \n                + Query for a request ID header \n                + dynamic log verbosity \n+ Grafana - Graphite - StatsD \n+ Alert and Monitor tools : \n\n\n+ Zipkin server \n    + Check the log traces on zipkin server `localhost:9411`\n    + Contain Spring Zipkin Stream server \n\n+ Docker \n    + Docker containers in this microservice group - Mongo - RabbitMQ - Config-service - Discovery - service , Gateway- service, Command-service, Query-service \n    + Using docker- compose, run : `docker-compose -f docker-compose.yml up`\n    + To see the running containers `docker ps`\n\n    + Run MongoDB and RabbitMQ \n        + `docker-compose up -d mongodb rabbitmq`\n\n\n\n\n\n+ Jenkins \n    + Continuous deploy using Jenkins Pipeline \n        + Create docker image to have CD \n            + Image contains : build project, create docker images, deploy on AWS using ECS container\n            + Using Jenkinsfile - config Job on Jenkins using Pipeline plugin and paste the content of Jenkins file in the Pipeline script box \n\n\n+ Deploy on AWS\n    + Create credentials on AWS \n    + Create cluster on AWS \n    + Build deploy container \n    + Access Jenkins panel \n    + Create a pipeline job \n    + Run the job \n\n\n+ Scaling \n    + NGINX will be configured for browser caching of the static content and load balancer - scale App Gateway and update manually the ports in default.conf - upstream config section \n\n\n\n\n\n\n\n### Project architecture\n+ Flight service    \n    + Database : MongoDB \n    + User search for flight based on search query \n+ Catalog service \n\n+ User service - Account service \n    + User/ Customer register account\n    + Database : MySQL \n+ Account service \n+ Booking service \n    + Database : MongoDB \n    + User book the flight and fill needed information for the flight \n+ Billing service \n    + Dabase : RDBMS \n    + User pay for flight ticket \n\n+ Subscription service \n    + Use\n+ Route service \n    + User search for flight by flight route and flight city\n+ Notification service \n    + Notification is send to user when user book a flight \n+ Ticker order service : before book for ticker, user can choose to order (reserve the flight ticker in a certain of time )\n+ Payment service : After sending bill to user(customer), payment service is used for pay the fee of the flight ticket \n+ third party payment service \n\n+ Credit risk engine :  \n    + Service to test for the validity of the bank account \n    \n\n\n\n\n\n\n\n\n\n\n### Other \n#### How to deploy in AWS \n+ Create folder for each microservice(except flightsearchclient) project in AWS AMI root folder(e.g \"eureka\")\n+ Copy the corresponding jar and the dockerfile in that folder (e.g \"eurekaserver-0.0.1-SNAPSHOT.jar\" and \"Dockerfile\" )\n+ Go to that directory from root and run docker build command to create docker image(\"cd eureka\",\"sudo docker build -t eureka .\")\n+ Go to root directory and run docker compose command(\"sudo docker-compose up\")\n+ To stop run \"sudo docker-compose down\"\n\n\n\n\n\n\n### Microservices architecture \n#### Debug tools \n+ Curl and jq\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiejulia%2Fflight-booking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhiejulia%2Fflight-booking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiejulia%2Fflight-booking/lists"}