{"id":49510617,"url":"https://github.com/williamw-dev/travel-hub","last_synced_at":"2026-05-01T19:01:26.671Z","repository":{"id":315760530,"uuid":"1003607624","full_name":"williamw-dev/travel-hub","owner":"williamw-dev","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-20T10:49:36.000Z","size":984,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-20T15:54:11.490Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/williamw-dev.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-17T11:59:06.000Z","updated_at":"2025-06-20T12:12:20.000Z","dependencies_parsed_at":"2025-09-20T15:54:13.588Z","dependency_job_id":"b8d9e14e-324f-45a2-b5d5-6f01ef00d0fd","html_url":"https://github.com/williamw-dev/travel-hub","commit_stats":null,"previous_names":["williamw-dev/travel-hub"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/williamw-dev/travel-hub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamw-dev%2Ftravel-hub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamw-dev%2Ftravel-hub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamw-dev%2Ftravel-hub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamw-dev%2Ftravel-hub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/williamw-dev","download_url":"https://codeload.github.com/williamw-dev/travel-hub/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamw-dev%2Ftravel-hub/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32508912,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2026-05-01T19:01:25.287Z","updated_at":"2026-05-01T19:01:26.663Z","avatar_url":"https://github.com/williamw-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🛬 Travel Hub\n\n\u003e A travel booking API with caching, real-time notifications, and recommendations.\n\n![Archi](docs/archi.png)\n\n## 🚀 Start Stack\n\n- Use `docker-compose up` to start all services:\n\n```bash\ncd apps/server \u0026\u0026 pnpm i\ncd ../client \u0026\u0026 pnpm i\n\ncd ../.. \u0026\u0026 chmod +x docker/entrypoint.sh\ncp .env.example .env\ndocker-compose up -d\n```\n\n## 📦 Setup \u0026 Environment\n\n- Set up project with your chosen framework (FastAPI, Express, Spring Boot, etc.)\n- Add support for environment variables\n- Configure Docker and `docker-compose` to run:\n  - API service\n  - Redis\n  - MongoDB\n  - Neo4j\n\n---\n\n### ⚠️ Warnings\n\n- Ensure you don't have redis or mongo running on your host machine, as the containers will use the same ports.\n\n\u003e MacOS\n\n```sh\nbrew services stop redis\nbrew services stop mongodb-community\n```\n\n- On prometheus container, it's possible to have chmod permissions issues with the `entrypoint.sh` file. If you encounter this, run the following command to fix it:\n\n```bash\nchmod +x docker/entrypoint.sh\n```\n\n### 🗄️ Data Sources\n\n- **MongoDB**: Store flight offers, hotels, and activities\n\n```ts\nuse travelhub;\n\ndb.offers.insertMany([\n  {\n    from: \"PAR\",\n    to: \"TYO\",\n    departDate: ISODate(\"2025-07-10T08:00:00Z\"),\n    returnDate: ISODate(\"2025-07-20T18:00:00Z\"),\n    provider: \"AirZen\",\n    price: 750.0,\n    currency: \"EUR\",\n    legs: [\n      { flightNum: \"AZ123\", dep: \"CDG\", arr: \"HND\", duration: \"12h45\" }\n    ],\n    hotel: { name: \"Tokyo Central Hotel\", nights: 10, price: 400.0 },\n    activity: { title: \"Mt. Fuji Day Tour\", price: 120.0 }\n  },\n  {\n    from: \"NYC\",\n    to: \"PAR\",\n    departDate: ISODate(\"2025-07-15T12:00:00Z\"),\n    returnDate: ISODate(\"2025-07-25T19:00:00Z\"),\n    provider: \"SkyWorld\",\n    price: 540.0,\n    currency: \"USD\",\n    legs: [\n      { flightNum: \"SW456\", dep: \"JFK\", arr: \"CDG\", duration: \"7h10\" }\n    ],\n    hotel: null,\n    activity: null\n  },\n  {\n    from: \"NYC\",\n    to: \"BER\",\n    departDate: ISODate(\"2025-07-10T08:00:00Z\"),\n    returnDate: ISODate(\"2025-07-20T18:00:00Z\"),\n    provider: \"SkyWorld\",\n    price: 500,\n    currency: \"USD\",\n    legs: [{ flightNum: \"SW100\", dep: \"JFK\", arr: \"BER\", duration: \"8h00\" }],\n    hotel: null,\n    activity: null\n  }\n])\n```\n\n- Neo4j cities and relationships:\n  \n```cypher\nCREATE (par:City { code: \"PAR\", name: \"Paris\", country: \"FR\" });\nCREATE (tyo:City { code: \"TYO\", name: \"Tokyo\", country: \"JP\" });\nCREATE (nyc:City { code: \"NYC\", name: \"New York\", country: \"US\" });\nCREATE (lon:City { code: \"LON\", name: \"London\", country: \"UK\" });\n\nMATCH (par:City {code: \"PAR\"}), (lon:City {code: \"LON\"})\nCREATE (par)-[:NEAR { weight: 0.9 }]-\u003e(lon);\n\nMATCH (par:City {code: \"PAR\"}), (nyc:City {code: \"NYC\"})\nCREATE (par)-[:NEAR { weight: 0.7 }]-\u003e(nyc);\n\nMATCH (nyc:City {code: \"NYC\"}), (par:City {code: \"PAR\"})\nCREATE (nyc)-[:NEAR { weight: 0.85 }]-\u003e(par);\n\nMATCH (tyo:City {code: \"TYO\"}), (par:City {code: \"PAR\"})\nCREATE (tyo)-[:NEAR { weight: 0.6 }]-\u003e(par);\n```\n\n---\n\n### 🔌 Core Features\n\n#### 1. `GET /offers`\n\n- Implement Redis caching with TTL 60s: `offers:\u003cfrom\u003e:\u003cto\u003e`\n- On cache miss, query MongoDB (`from`, `to`, sort by `price` ascending)\n- Store compressed JSON back into Redis\n- Return array of offers with fields:\n  - `id`, `provider`, `price`, `currency`, `legs[]`, `hotel?`, `activity?`\n\n#### 2. `GET /offers/{id}`\n\n- Read from Redis cache (`offers:\u003cid\u003e`, TTL 300s), fallback to MongoDB\n- Return full offer details and `relatedOffers` (3 related IDs from Neo4j)\n\n#### 3. `GET /reco`\n\n- Accept query params: `city`, `k`\n- Execute Cypher query in Neo4j:\n\n  ```cypher\n  MATCH (c:City {code:$city})-[:NEAR]-\u003e(n:City)\n  RETURN n.code AS city\n  ORDER BY n.weight DESC\n  LIMIT $k\n  ```\n\n- Return list of city codes with scores\n\n#### 4. `POST /login`\n\n- Accept payload: `{ \"userId\": \"u42\" }`\n- Generate UUID v4, store as `session:\u003cuuid\u003e → userId` (EX 900s)\n- Return: `{ \"token\": \"\u003cuuid\u003e\", \"expires_in\": 900 }`\n\n---\n\n### 🔔 Real-Time Notifications\n\n- Publish new offer notifications to Redis Pub/Sub channel `offers:new`\n- Payload format:\n\n  ```json\n  {\n    \"offerId\": \"abc123\",\n    \"from\": \"PAR\",\n    \"to\": \"TYO\"\n  }\n  ```\n\n---\n\n### 📊 Indexes \u0026 Data Modeling\n\n#### MongoDB\n\n- Ensure `offers` collection schema:\n  - Fields: `_id`, `from`, `to`, `departDate`, `returnDate`, `provider`, `price`, `currency`, `legs`, `hotel`, `activity`\n- Create indexes:\n  - `{ from: 1, to: 1, price: 1 }`\n  - Full-text index on `provider`\n\n#### Neo4j\n\n- Model nodes: `(c:City {code, name, country})`\n- Model relationships: `(c1)-[:NEAR {weight}]-\u003e(c2)`\n\n---\n\n### 🚀 Non-functional Requirements\n\n- Average latency for `/offers` should be 200ms (cache hit), 700ms max (cache miss)\n- All responses should be `application/json; charset=utf-8`\n- Log request durations and HTTP error codes\n\n---\n\n### ✨ Optional Features\n\n- Text search support via `q=hotel` param using MongoDB text index\n- `/stats/top-destinations` route using MongoDB aggregation + Redis caching\n- `/metrics` route compatible with Prometheus (avg time, cache hit rate)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamw-dev%2Ftravel-hub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilliamw-dev%2Ftravel-hub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamw-dev%2Ftravel-hub/lists"}