{"id":20317447,"url":"https://github.com/thimc/hotel-backend","last_synced_at":"2025-05-08T00:30:28.764Z","repository":{"id":171435356,"uuid":"647932863","full_name":"thimc/hotel-backend","owner":"thimc","description":"a hotel backend server written in go","archived":false,"fork":false,"pushed_at":"2023-06-11T20:01:00.000Z","size":60,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-19T13:44:06.519Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thimc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-31T20:55:00.000Z","updated_at":"2023-06-03T18:19:33.000Z","dependencies_parsed_at":"2024-06-19T13:30:46.764Z","dependency_job_id":"54baec0f-93d7-4195-a174-40c7626d1d3c","html_url":"https://github.com/thimc/hotel-backend","commit_stats":null,"previous_names":["thimc/hotel-backend"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thimc%2Fhotel-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thimc%2Fhotel-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thimc%2Fhotel-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thimc%2Fhotel-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thimc","download_url":"https://codeload.github.com/thimc/hotel-backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224673083,"owners_count":17350866,"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":[],"created_at":"2024-11-14T18:32:08.585Z","updated_at":"2024-11-14T18:32:09.466Z","avatar_url":"https://github.com/thimc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hotel backend\n\nThis repo contains a demo hotel backend written in go and is powered by\n[fiber](https://gofiber.io/) and uses [MongoDB](https://www.mongodb.com/) as\nits database. Authentication is done via JWT.\n\nThe backend is designed with portability in mind, should the user ever need to\nswitch to another type of database such as PostgreSQL, SQLite, MariaDB or MySQL\n(it could be literally any way of storing actually) all that would be needed\nfor the switch is to implement the functions needed for the interfaces in the\n`db` folder.\n\nHead on over to the [API Documentation](DOCUMENTATION.md) for a complete map\nof all available routes.\n\n## Environment variables\n\nConfigure the `.env` file:\n```\nHTTP_LISTEN_ADDRESS=:3000\nJWT_SECRET=abcdefghijklmnopqrstuvwxyz\nMONGODB_DB_NAME=hotel-reservation\nMONGODB_DB_URI=mongodb://1.2.3.4:27017\nMONGODB_TEST_DB_URI=mongodb://1.2.3.4:27017\n```\n\n## Installing the dependencies\n\nIn order to set the environment variables via the `.env` file, the gotdotenv\npackage is needed:\n\n```\ngo get github.com/joho/godotenv\n```\n\nIn order to get this repo up and running you will need to grab the MongoDB\nand fiber libraries and install docker.\n```\ngo get go.mongodb.org/mongo-driver/mongo\ngo get github.com/gofiber/fiber/v2\n```\n\nThe following snippet will spin up a MongoDB instance:\n```\ndocker run -d -p 27017:27017 --name mongodb mongo:latest\n```\n\nWhen everything is installed and the docker containers are running,\nrun the following command:\n\n```\nmake run\n```\n\nIn order to set up a test environment which will seed the database with\nfake data, run:\n```\nmake seed\n```\n\n## Mongo Express Web UI (Optional)\nIf you want to interact directly with the database, the Mongo Express web\nuser interface is excellent, installation is done with the following command:\n```\ndocker run -it -p 8081:8081 \\\n        -e ME_CONFIG_MONGODB_URL=\"mongodb://mongodb:27017\" \\\n        -e ME_CONFIG_BASICAUTH_USERNAME=\"\" \\\n        -e ME_CONFIG_BASICAUTH_PASSWORD=\"\" \\\n        -e ME_CONFIG_OPTIONS_EDITORTHEME=\"default\" \\\n        -e ME_CONFIG_SITE_COOKIESECRET=\"cookiesecret\" \\\n        -e ME_CONFIG_SITE_SESSIONSECRET=\"sessionsecret\" \\\n        -e ME_CONFIG_SITE_SSL_ENABLED=\"false\" \\\n        -e ME_CONFIG_SITE_CRT_PATH=\"\" \\\n        -e ME_CONFIG_SITE_KEY_PATH=\"\" \\\n        -e ME_CONFIG_MONGODB_ENABLE_ADMIN=true \\\n        mongo-express\n```\n\nThe web interface should now be up and running on:\n```\nhttp://localhost:8081\n```\n\n## Deploying\nThe Makefile has a `docker` target to it so all that is needed to spin it up\nis to run the following command:\n```\nmake docker\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthimc%2Fhotel-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthimc%2Fhotel-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthimc%2Fhotel-backend/lists"}