{"id":34526648,"url":"https://github.com/wahedpro/level2-assignment-02","last_synced_at":"2026-04-11T17:02:38.904Z","repository":{"id":327699693,"uuid":"1109966646","full_name":"wahedpro/Level2-Assignment-02","owner":"wahedpro","description":"A complete backend system for managing vehicle rentals, bookings, customers, and admin operations. Built with Node.js, TypeScript, Express, PostgreSQL, and fully secured using JWT authentication.","archived":false,"fork":false,"pushed_at":"2025-12-07T15:26:17.000Z","size":79,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-08T14:25:55.988Z","etag":null,"topics":["express","jwt","node","postgresql","typescript"],"latest_commit_sha":null,"homepage":"https://vehicle-rental-system-rho.vercel.app","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/wahedpro.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-12-04T14:28:22.000Z","updated_at":"2025-12-07T15:27:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/wahedpro/Level2-Assignment-02","commit_stats":null,"previous_names":["wahedpro/level2-assignment-02"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/wahedpro/Level2-Assignment-02","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wahedpro%2FLevel2-Assignment-02","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wahedpro%2FLevel2-Assignment-02/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wahedpro%2FLevel2-Assignment-02/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wahedpro%2FLevel2-Assignment-02/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wahedpro","download_url":"https://codeload.github.com/wahedpro/Level2-Assignment-02/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wahedpro%2FLevel2-Assignment-02/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31687882,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T13:07:20.380Z","status":"ssl_error","status_checked_at":"2026-04-11T13:06:47.903Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["express","jwt","node","postgresql","typescript"],"created_at":"2025-12-24T05:22:47.934Z","updated_at":"2026-04-11T17:02:38.892Z","avatar_url":"https://github.com/wahedpro.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚗 Vehicle Rental System – Backend API  \nA complete backend system for managing vehicle rentals, bookings, customers, and admin operations.  \nBuilt with **Node.js, TypeScript, Express, PostgreSQL**, and fully secured using **JWT authentication**.\n\n---\n\n## 🌐 Live API URL  \n👉 https://vehicle-rental-system-rho.vercel.app\n\n---\n\n# ⭐ Project Features\n\n## 🔐 Authentication \u0026 Authorization\n- User Registration \u0026 Login (JWT-based)\n- Role-based Access Control:\n  - **Admin** → full system access  \n  - **Customer** → limited access (own profile, own bookings)\n\n---\n\n## 🚘 Vehicle Management (Admin Only)\n- Create Vehicle  \n- Get All Vehicles  \n- Get Vehicle by ID  \n- Update Vehicle  \n- Delete Vehicle  \n- Automatic availability updates based on booking status\n\n---\n\n## 👤 User Management\n- Admin → Get all users  \n- Admin → Update any user  \n- User → Update own profile  \n- Admin → Delete user (only if no active bookings)\n\n---\n\n## 📅 Booking Management\n- Customer/Admin → Create booking  \n- Auto price calculation:\n  ```\n  total_price = daily_rent_price × number_of_days\n  ```\n- Customer → Cancel own booking  \n- Admin → Mark booking as returned  \n- Vehicle availability auto-update  \n- Role-based booking retrieval:\n  - Admin → all bookings  \n  - Customer → only own bookings  \n\n---\n\n## 🔄 Auto Return System (Cron Job)\nA scheduled background job that:\n\n- Automatically checks for expired bookings  \n- Marks them as `\"returned\"`  \n- Sets the vehicle status back to `\"available\"`  \n\nRuns every **1 minute** using `node-cron`.\n\n---\n\n# 🛠️ Technology Stack\n\n| Category | Technology |\n|----------|------------|\n| Language | TypeScript |\n| Runtime | Node.js |\n| Framework | Express.js |\n| Database | PostgreSQL |\n| Auth | JWT + bcrypt |\n| Scheduler | node-cron |\n| Hosting | Vercel |\n\n---\n\n# 📁 Project Structure\n\n```\nsrc/\n ├─ app.ts\n ├─ server.ts\n ├─ database/\n │    └─ db.ts\n ├─ middlewares/\n │    └─ auth.middleware.ts\n ├─ modules/\n │    ├─ auth/\n │    ├─ users/\n │    ├─ vehicles/\n │    ├─ bookings/\n │    └─ autoReturn/\n └─ utils/\n      └─ response.ts\n```\n\n---\n\n# ⚙️ Setup \u0026 Installation Guide\n\n## 1️⃣ Clone the repository\n```\ngit clone https://github.com/wahedpro/Level2-Assignment-02.git\ncd vehicle-rental-system\n```\n\n## 2️⃣ Install dependencies\n```\nnpm install\n```\n\n## 3️⃣ Configure Environment Variables  \nCreate a `.env` file:\n\n```\nPORT=5000\nDATABASE_URL=your_postgres_url\nJWT_SECRET=your_secret_key\n```\n\n## 4️⃣ Run the project (development)\n```\nnpm run dev\n```\n\n## 5️⃣ Build \u0026 run production build\n```\nnpm run build\nnpm start\n```\n\n---\n\n# 🧪 API Endpoints Overview\n\n## 🔐 Auth\n- `POST /api/v1/auth/signup`  \n- `POST /api/v1/auth/signin`  \n\n## 🚘 Vehicles\n- `POST /api/v1/vehicles`  \n- `GET /api/v1/vehicles`  \n- `GET /api/v1/vehicles/:id`  \n- `PUT /api/v1/vehicles/:id`  \n- `DELETE /api/v1/vehicles/:id`  \n\n## 👤 Users\n- `GET /api/v1/users`  \n- `PUT /api/v1/users/:id`  \n- `DELETE /api/v1/users/:id`  \n\n## 📅 Bookings\n- `POST /api/v1/bookings`  \n- `GET /api/v1/bookings`  \n- `PUT /api/v1/bookings/:id`  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwahedpro%2Flevel2-assignment-02","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwahedpro%2Flevel2-assignment-02","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwahedpro%2Flevel2-assignment-02/lists"}