{"id":29551621,"url":"https://github.com/marinspira/hostelapp-express","last_synced_at":"2026-05-04T13:34:39.382Z","repository":{"id":302903598,"uuid":"906477073","full_name":"marinspira/hostelapp-express","owner":"marinspira","description":"Backend for a hostel app, built with Express.js and MongoDB. Includes authentication, real-time chat, REST APIs, file uploads, and structured logging.","archived":false,"fork":false,"pushed_at":"2025-07-12T13:28:56.000Z","size":7738,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-12T15:27:23.269Z","etag":null,"topics":["azure-app-service","expressjs","mongodb","morgan","multer-storage","socket-io","stripe","winston-logger"],"latest_commit_sha":null,"homepage":"https://hostelapp-heemdbgqgkdnb7ce.northeurope-01.azurewebsites.net/api-docs","language":"JavaScript","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/marinspira.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}},"created_at":"2024-12-21T02:37:24.000Z","updated_at":"2025-07-12T13:28:59.000Z","dependencies_parsed_at":"2025-07-04T17:56:01.102Z","dependency_job_id":null,"html_url":"https://github.com/marinspira/hostelapp-express","commit_stats":null,"previous_names":["marinspira/hostelapp-express"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marinspira/hostelapp-express","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinspira%2Fhostelapp-express","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinspira%2Fhostelapp-express/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinspira%2Fhostelapp-express/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinspira%2Fhostelapp-express/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marinspira","download_url":"https://codeload.github.com/marinspira/hostelapp-express/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinspira%2Fhostelapp-express/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265701486,"owners_count":23813752,"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":["azure-app-service","expressjs","mongodb","morgan","multer-storage","socket-io","stripe","winston-logger"],"created_at":"2025-07-18T04:38:25.510Z","updated_at":"2025-10-07T08:08:16.710Z","avatar_url":"https://github.com/marinspira.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HostelApp backend with Express.js and MongoDB\nREST API backend for managing hostels, rooms, messaging and payments—built with Express, MongoDB, Socket.IO \u0026 Stripe.\n\n## Tech Stack\n\n- **Node.js** \u0026 **Express**  \n- **MongoDB** (Mongoose ODM)  \n- **Socket.IO** for real‑time messaging  \n- **Stripe** for payments  \n- **Winston** + **Morgan** for logging  \n- **dotenv** for environment configuration  \n- **Multer** for file uploads  \n\n\n## API Documentation (Swagger)\n\nYou can explore and test all available endpoints using the **Swagger UI**:\n\n![Swagger UI Screenshot](./assets/swagger-ui.png)\n\n\u003e **Live API Docs:** [https://hostelapp-heemdbgqgkdnb7ce.northeurope-01.azurewebsites.net/api-docs]\n\n\u003e _Note: Hosted on Azure App Service. It may take a few seconds to respond initially, as the server spins up on first request._\n\n### Authentication Required\nTo use the protected endpoints:\n\n1. First call `POST /api/auth/login` with valid credentials.\n2. A `JWT` cookie will be set automatically.\n3. After that, you'll be able to access protected routes using your browser session.\n\nIt will automatically include the cookie in subsequent requests if you're using the same browser session.  \n⚠️ **Notes:** \n- The API is protected with a **rate limit of 20 requests per 15 minutes per IP**.\n- This project also uses my own lib [api-traffic-analyzer](https://github.com/marinspira/api-traffic-analyzer) to log access activity via cookies for analytics purposes. \n\n## Features\n\n**Authentication \u0026 Authorization**  \n  - JWT sign‑up / login  \n  - Protected routes via `auth` middleware  \n\n**Resource CRUD**  \n  - Guests, Hostels, Rooms, Reservations, Events  \n\n**Payments**  \n  - Stripe integration (create payment intents, webhooks)  \n\n**Real‑time Chat**  \n  - Socket.IO: join rooms, send/receive messages  \n\n**File Uploads**  \n  - Multer storage under `/uploads/{users,hostels,…}`  \n\n**Logging \u0026 Monitoring**  \n  - Morgan HTTP logs → Winston file logger  \n\n**Security \u0026 Headers**  \n- CORS (configurable via `CLIENT_URL`)  \n- **Helmet** for secure HTTP headers  \n- **Rate Limiting**: blocks excessive requests (20 per 15 min/IP)  \n- **User-Agent Filtering**: basic bot detection middleware  \n- Cookie-based JWT session management   \n\n\n## File Uploads \u0026 Static Serving\nMulter is configured to store uploads under /uploads/users (and other model-specific folders).\n\nUploaded files are served statically from `/uploads:`\n`GET /uploads/\u003cfolder\u003e/\u003cfilename\u003e`\n\n\n## WebSocket Chat\nConnect to the same Express server via Socket.IO client.\nDefault origin is `http://localhost:3000` (configurable via CLIENT_URL).\n\n### Events:\n- join_room → join a chat room\n- send_message → broadcast a new chat message\n- receive_message → listen for incoming messages\n\n\n## Logging\nWinston centralizes application logs (info \u0026 error) to `logs/hostelapp.log`.\nMorgan pipes HTTP request logs into Winston, so all are in one place.\n\n![Logs file Screenshot](./assets/logs.jpeg)\n\n\n## License\nThis project is licensed under the ISC License. See the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarinspira%2Fhostelapp-express","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarinspira%2Fhostelapp-express","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarinspira%2Fhostelapp-express/lists"}