{"id":31390895,"url":"https://github.com/mostaryjahan/phonehub-backend","last_synced_at":"2026-04-20T19:06:55.295Z","repository":{"id":313593926,"uuid":"1050986007","full_name":"mostaryjahan/PhoneHub-backend","owner":"mostaryjahan","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-07T06:43:16.000Z","size":78,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-07T07:14:27.235Z","etag":null,"topics":["expressjs","jwt","mongoose","typescript"],"latest_commit_sha":null,"homepage":"https://phonehub-server.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/mostaryjahan.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-09-05T09:02:17.000Z","updated_at":"2025-09-07T07:02:14.000Z","dependencies_parsed_at":"2025-09-07T07:14:29.947Z","dependency_job_id":"88db9e39-a405-414f-b34c-3cf97e3edafc","html_url":"https://github.com/mostaryjahan/PhoneHub-backend","commit_stats":null,"previous_names":["mostaryjahan/phonehub-backend"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/mostaryjahan/PhoneHub-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostaryjahan%2FPhoneHub-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostaryjahan%2FPhoneHub-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostaryjahan%2FPhoneHub-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostaryjahan%2FPhoneHub-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mostaryjahan","download_url":"https://codeload.github.com/mostaryjahan/PhoneHub-backend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostaryjahan%2FPhoneHub-backend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277455221,"owners_count":25820678,"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","status":"online","status_checked_at":"2025-09-28T02:00:08.834Z","response_time":79,"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":["expressjs","jwt","mongoose","typescript"],"created_at":"2025-09-29T01:40:26.935Z","updated_at":"2025-09-29T01:40:27.992Z","avatar_url":"https://github.com/mostaryjahan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# phone-hub Server – Backend\n\n#### Live Link: https://phonehub-server.vercel.app\n\n## Overview\n\nThe **phone-hub Server** is a backend API for managing users, car products, cart items, and orders. Built with **Node.js**, **Express**, **TypeScript**, and **MongoDB** using **Mongoose**, it provides a robust and scalable solution for a car shop e-commerce platform with full CRUD operations, secure authentication, and inventory management capabilities.\n\n---\n\n## Features\n\n- **Express.js** for server and RESTful API development  \n- **TypeScript** for strong typing and maintainability  \n- **Mongoose** for seamless MongoDB interaction  \n- **Zod** for schema validation  \n- **JWT (JSON Web Tokens)** for secure authentication  \n---\n\n## API Endpoint\n### User Management\n- `POST /api/users/register`: Register a new user\n- `POST /api/auth/login`: Authenticate a user and return a JWT\n- `GET /api/users/profile`: Get the authenticated user's profile\n- `PUT /api/users/profile`: Update the authenticated user's profile\n- `GET /api/users`: Get a list of all users (admin only)\n- `DELETE /api/users/:id`: Delete a user by ID (admin only)\n### Product Management\n- `POST /api/phones`: Add a new product \n- `GET /api/phones`: Get a list of all phones\n- `GET /api/phones/:id`: Get a product by ID\n- `PUT /api/phones/:id`: Update a product by ID \n- `DELETE /api/phones/:id`: Delete a product by ID \n### Cart Management\n- `POST /api/cart`: Add an item to the cart\n- `GET /api/cart`: Get the authenticated user's cart items\n- `PUT /api/cart/:id`: Update a cart item by ID\n- `DELETE /api/cart/:id`: Remove a cart item by ID\n### Order Management\n- `POST /api/orders`: Create a new order\n- `GET /api/orders`: Get the authenticated user's orders\n- `GET /api/orders/:id`: Get an order by ID\n- `PUT /api/orders/:id`: Update an order by ID \n- `DELETE /api/orders/:id`: Delete an order by ID \n\n\n## Error Handling\n\n- **Validation Errors**: Detailed messages for invalid inputs using Zod and Joi  \n- **404 Not Found**: Graceful handling of non-existent routes, products, or orders  \n- **Generic Errors**: Clear error messages with stack traces in development  \n\n---\n\n## Technologies Used\n\n- **Backend Framework**: Node.js with Express.js  \n- **Database**: MongoDB (via Mongoose)  \n- **Language**: TypeScript  \n- **Validation**: Zod and Joi  \n- **API Architecture**: RESTful  \n\n---\n\n## Project Setup\n\n###  Prerequisites\n\nEnsure you have the following installed:\n\n- Node.js (v14 or above)  \n- npm (v6 or above)  \n- MongoDB (local or cloud-based)  \n\n---\n\n### Installation\n\n1. git clone: https://github.com/mostaryjahan/PhoneHub-backend.git\n2. cd PhoneHub-backend\n3. npm install\n4. create .env file and keep\n  DATABASE_URL=your_mongodb_connection_string\n  PORT=5000\n npm run start:dev\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmostaryjahan%2Fphonehub-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmostaryjahan%2Fphonehub-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmostaryjahan%2Fphonehub-backend/lists"}