{"id":24273185,"url":"https://github.com/kristofkruller/bookingapp","last_synced_at":"2026-04-11T02:44:20.929Z","repository":{"id":207975557,"uuid":"720509444","full_name":"kristofkruller/BookingApp","owner":"kristofkruller","description":"gRPC accommodation booking system model","archived":false,"fork":false,"pushed_at":"2023-12-20T07:58:44.000Z","size":8659,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T07:53:10.483Z","etag":null,"topics":["debian-linux","docker","docker-compose","docker-container","dockerfile","golang","grpc-go","grpc-server","postgresql","seeding","shell-scripting"],"latest_commit_sha":null,"homepage":"","language":"Go","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/kristofkruller.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,"governance":null}},"created_at":"2023-11-18T17:49:27.000Z","updated_at":"2023-12-03T15:24:18.000Z","dependencies_parsed_at":"2023-11-25T11:24:14.328Z","dependency_job_id":"444f95e2-7070-41b1-a728-6437259300c7","html_url":"https://github.com/kristofkruller/BookingApp","commit_stats":null,"previous_names":["kristofkruller/bookingapp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristofkruller%2FBookingApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristofkruller%2FBookingApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristofkruller%2FBookingApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristofkruller%2FBookingApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kristofkruller","download_url":"https://codeload.github.com/kristofkruller/BookingApp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241989857,"owners_count":20053802,"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":["debian-linux","docker","docker-compose","docker-container","dockerfile","golang","grpc-go","grpc-server","postgresql","seeding","shell-scripting"],"created_at":"2025-01-15T19:29:57.885Z","updated_at":"2026-04-11T02:44:20.870Z","avatar_url":"https://github.com/kristofkruller.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BookingApp\nA simple accommodation booking system\n\n## Overview\nThe system is divided into the following microservices:\n\n- `auth-service`: *Manages user authentication.*\n- `check-service`: *Handles hotels and rooms management.*\n- `booking-service`: *Manages booking and cancellation of rooms.*\n\nThe PostgreSQL database is set up with the following tables:\n\n- `users`: *Contains user information.*\n- `properties`: *Contains details about properties like hotels and flats.*\n- `rooms`: *Details about individual rooms linked to properties.*\n- `reserv`: *Reservation handling*\n\n*An initialization script (root/init.sql) is used to create these tables. A db-seeder service seeds the users table with initial data using bcrypt for password hashing more details at ###Seeding below*\n\n## Getting Started\n### Installation\n1. `git clone` [https://github.com/kristofkruller/BookingApp.git]\n2. `cd BookingApp`\n3. start:\n`a)` Just fire the ./start.sh from the project root \n**_OR_** \n`b)` docker-compose up --build and if done go run ./db-seeder/main.go\n**_important_** that either way wait for both\ndocker compose will log to your terminal as access and error log\n```\nAdmin user seeded successfully.\nReservations seeded successfully.\n```\nCLI feedbacks\n\n### Prerequisites\n- Docker compose v3.8\n- go1.21.4 linux/amd64\n- netcat for linux distro\n\n### Ports _links for dev_\n- `auth-service`: [8081](http://127.0.0.1:8081)\n- `check-service`: [8082](http://127.0.0.1:8082)\n- `booking-service`: [8083](http://127.0.0.1:8083)\n- `db` is on default 5432\n\n## API list\n### provided API json at ./utils/ \nIf you post a request set the body type to JSON and include desired content I use [Insomnia API](https://insomnia.rest/)\n_I assume a formatted string from a date picker by date values_\nFor requests with filtering it is possible to use only a \"partly\" filter, but with logical pair i.e.:\n```\n{\n  \"availability_start\": \"2023-01-01\",\n  \"availability_end\": \"2023-01-10\"\n}\n_or_\n{\n  \"price_min\": 60,\n  \"price_max\": 70\n}\n_or_\n{\n  \"creation_date\": \"2023-11-20\"\n}\n_or combined even_\n{\n  \"creation_date\": \"2023-11-20\",\n  \"start_date\": \"2023-02-01\",\n  \"end_date\": \"2023-02-05\"\n}\netc.\n```\n**if you want a filter-free list then post and empty JSON object `{}` with the REQ to get the full array as RES**\nfloat in this case below always a DECIMAL(10,2)\n\n### Auth\n- [:8081/check] GET expects nothing\n_Response text: Auth-service up_\n- [:8081/login] POST expects:\n```\nREQ Body Params (JSON format):\n{\n  \"name\":\"string\",\n  \"password\":\"string\"\n}\n```\n_Response feedback msg, http only cookie with jwt token exp. 1hr_\n- [:8081/logout] POST invalidate by setting cookie to be expired\n_Response feedback msg, cookie data, and empty token val_\n\n### Check\n- [:8081/check] GET expects nothing\n_Response text: Check-service up_\n- [:8082/room/{id}] GET expects an int for ID\n_Response a JSON object with all data of the selected room_\n- [:8082/rooms] POST with **optional** filter params:\n```\nREQ Body Params (JSON format):\n{\n  price_min: float,\n  price_max: float,\n  availability_start: \"YYYY-MM-DD\",\n  availability_end: \"YYYY-MM-DD\"\n}\n```\n_Response a JSON list(array of objects) of rooms matching the filters_\n\n### Booking\n- [:8083/check] GET expects nothing\n_Response text: Booking-service up_\n- [:8083/bookingsof/{uId}] POST with **optional** filter params:\n```\nREQ Body Params (JSON format):\n{\n  \"min_price\": float,\n  \"max_price\": float,\n  \"creation_date\": \"YYYY-MM-DD\",\n  \"start_date\": \"YYYY-MM-DD\",\n  \"end_date\": \"YYYY-MM-DD\"\n}\n```\n_Response a JSON list(array of objects) of bookings matching the filters_\n- [:8083/letsbook] POST with **mandatory** params:\n```\nREQ Body Params (JSON format):\n{\n  \"userId\": int,\n  \"propertyId\": int,\n  \"roomId\": int,\n  \"cost\": float,\n  \"start_date\": \"YYYY-MM-DD\",\n  \"end_date\": \"YYYY-MM-DD\"\n}\n```\n_Response text: Booking created successfully_\n- [:8083/dontbook/{bookingId}] POST to delete a booking by id\n_Response text: Booking canceled successfully_\n\n### Payment\n- [:8084/check] GET expects nothing\n_Response text: Payment-service up_\n- [:8084/pay/{bookingId}] POST to pay booking by id with **mandatory** params:\n```\nREQ Body Params (JSON format):\n{\n  \"bookingId\": int,\n  \"amount\": float,\n  \"currency\": string,\n  \"cardToken\": string\n}\n```\n_Response JSON object about success or failed_\n\n\n## Details, mechanics\n### Seeding\nThe db-seeder service runs automatically during **start.sh** and seeds the users and reserv tables.\nThe admin user is seeded with a bcrypt-hashed password for enhanced security.\nIt is functioning as a go \"script\".\n\n### Env\n**MUST BE CREATED AT PROJECT _ROOT ._**\n_Exposed env content for development_\n*.env is not commited because of best practice*\n```\nDB_PASSWORD=asdf1234\nPOSTGRES_DB=BookingAppDb\nPOSTGRES_USER=admin\nPOSTGRES_PASSWORD=asdf1234\nJWT_SECRET_KEY=Hu7ky4L1f3*\nDB_USER=admin\nDB_HOST=db\nDB_NAME=BookingAppDb\nDB_CONNECTION_SEED=postgres://admin:asdf1234@127.0.0.1/BookingAppDb?sslmode=disable\n```\n\n### Development Env and manual start\nThe project is set up for development with VS Code through WSL Debian. A launch.json file is included for debugging:\n- `Run and Debug - Ctrl+Shift+D` then you can start all services separately without containerized environment.\n- Run `docker-compose -f docker-compose.yml up db` this will set up the db as a separate container but without the other services. You should seed it with `go run ./db-seeder/main.go`\n**there should be a local.env for launch.json, where DB_HOST=127.0.0.1** otherwise the connection will die with timeout.\nThis way of starting produces a brand new fresh binary to the out folder as well optimized for Linux environments.\n\n## Notes on possible improvements\n- Helper functions, types and code for general use must be regorganized to a lib, with functionality like in every `main.go` the program exits gracefully or time handlers. \n- Error handling and logging should be ogranized to a service or lib also health checkers for db, and endpoints\n- Testcases\n- For large datasets, consider indexing the reserv_interval column in the reserv table.\n- Queries should be transferred into postgre as a function\n- Frontend should be one GUI with an nginx reverse proxy channeled to :443","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristofkruller%2Fbookingapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkristofkruller%2Fbookingapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristofkruller%2Fbookingapp/lists"}