{"id":22307782,"url":"https://github.com/albertllousas/table-reservation-microservice","last_synced_at":"2025-03-26T01:24:33.937Z","repository":{"id":53198600,"uuid":"521309233","full_name":"albertllousas/table-reservation-microservice","owner":"albertllousas","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-19T14:51:37.000Z","size":1703,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T22:48:28.225Z","etag":null,"topics":["ddd","event-driven-architecture","giraffe","hexagonal-architecture","kafka","microservice","optimistic-locking","postgresql","transactional-outbox"],"latest_commit_sha":null,"homepage":"","language":"F#","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/albertllousas.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":"2022-08-04T14:59:01.000Z","updated_at":"2024-06-06T09:39:09.000Z","dependencies_parsed_at":"2023-01-18T14:30:34.534Z","dependency_job_id":null,"html_url":"https://github.com/albertllousas/table-reservation-microservice","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/albertllousas%2Ftable-reservation-microservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertllousas%2Ftable-reservation-microservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertllousas%2Ftable-reservation-microservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertllousas%2Ftable-reservation-microservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albertllousas","download_url":"https://codeload.github.com/albertllousas/table-reservation-microservice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245569640,"owners_count":20637013,"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":["ddd","event-driven-architecture","giraffe","hexagonal-architecture","kafka","microservice","optimistic-locking","postgresql","transactional-outbox"],"created_at":"2024-12-03T20:11:36.701Z","updated_at":"2025-03-26T01:24:33.903Z","avatar_url":"https://github.com/albertllousas.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Table reservation microservice with FSharp\n\n## Description\n\nThis project is an exercise to practice and see how it fits Domain-Driven Design, Hexagonal Architecture, Functional programming and TDD in F# and dotnet ecosystem.\n\nIn addition to that, it brings a full tested and production ready microservice (I hope) that could be used as a blueprint to develop services in this amazing FP language.\n\nKeywords: `DDD`, `microservice`, `FSharp`, `Giraffe`, `Hexagonal-Architecture`, `SOLID`, `Domain-Driven Design`, `functional-programming`,\n`Testing`, `Event-Driven Architecture`, `Domain-Events`, `Kafka`, `PostgreSQL`, `Transactional-outbox`, `optimistic-locking`\n\n**NOTE:** I apologise in advance, I am a beginner in FSharp with a functional background in some langs (kotlin, scala, haskell) and development experience in JVM environments.\n\n## The problem to solve\n\nTo drive all the project, we need a problem to solve, in this case we will need to create a Restaurant Reservation System.\n\nThe system should **let customers** to reserve a table in a restaurant:\n\n- The customer should be able to see the available tables in a restaurant for a given date.\n- The customer will choose an available timeslot to make a reservation\n- Number of people should fit in the table\n- If the reservation is successful, the customer will get a reservation code/ref\n- The solution should cover only the Back-end part, no UI at all\n- The communication protocol will be REST\n- We will need to inform other systems when a reservation is done\n- Custom searching, restaurants management or other concerns would be handled by other bounded contexts, this one is about reservations.\n\n## Endpoints\n\n- Get available tables in a restaurant for a given date:\n```\nGET /tables/available?restaurant-id=530a3998-81ee-4112-8080-54332f4025ee\u0026date=2022-10-11\n```\nResponse:\n```json\n[\n  {\n    \"tableId\": \"6de09dfb-1bd5-4263-af68-aa60e54968d4\",\n    \"capacity\": 4,\n    \"availableSlots\": [\"12:00\", \"21:00\"]\n  }\n]\n```\n\n- Reserve a table:\n```\nPOST /tables/6de09dfb-1bd5-4263-af68-aa60e54968d4/reservations \n```\nBody:\n```json\n{\n  \"date\":\"2022-10-11\", \n  \"persons\": 3, \n  \"customerId\": \"27cc6b6e-5761-4ba2-b523-63630d2935ab\", \n  \"timeSlot\": \"21:00\" \n}\n```\nResponse:\n```json\n{\n  \"ref\":\"x342\", \n  \"tableId\":\"6de09dfb-1bd5-4263-af68-aa60e54968d4\"\n}\n```\n\n### Table Aggregate\n\nTo ensure the integrity annd consistency of the different invariants, the aggregate will be a table of a restaurant, partitioned by day.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"70%\" src=\"./img/agg.png\"\u003e\n\u003c/p\u003e\n\n[Aggregate code](./src/Reservation/Domain.Model.fs#L39)\n\n## In progress\n\n- Add outbox pattern\n- Add kafka to publish events\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertllousas%2Ftable-reservation-microservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbertllousas%2Ftable-reservation-microservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertllousas%2Ftable-reservation-microservice/lists"}