{"id":24074222,"url":"https://github.com/codehass/sales-analysis-tool-back-end","last_synced_at":"2026-04-13T02:41:51.489Z","repository":{"id":267289685,"uuid":"897476567","full_name":"codehass/sales-analysis-tool-back-end","owner":"codehass","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-14T21:47:09.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-27T11:06:17.880Z","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/codehass.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}},"created_at":"2024-12-02T17:40:05.000Z","updated_at":"2024-12-14T21:47:12.000Z","dependencies_parsed_at":"2024-12-09T14:38:03.698Z","dependency_job_id":"abe836e9-f99c-4340-a45f-bde93ff4ad8f","html_url":"https://github.com/codehass/sales-analysis-tool-back-end","commit_stats":null,"previous_names":["codehass/sales-analysis-tool-back-end"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codehass/sales-analysis-tool-back-end","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codehass%2Fsales-analysis-tool-back-end","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codehass%2Fsales-analysis-tool-back-end/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codehass%2Fsales-analysis-tool-back-end/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codehass%2Fsales-analysis-tool-back-end/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codehass","download_url":"https://codeload.github.com/codehass/sales-analysis-tool-back-end/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codehass%2Fsales-analysis-tool-back-end/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31737849,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-12T22:19:12.206Z","status":"online","status_checked_at":"2026-04-13T02:00:06.623Z","response_time":93,"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":"2025-01-09T18:08:55.373Z","updated_at":"2026-04-13T02:41:51.471Z","avatar_url":"https://github.com/codehass.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sales Analysis Tool\n\n## Overview\nThe Sales Analysis Tool is a comprehensive solution to visualize and analyze sales data. It consists of two main components:\n\n1. **Frontend**: Built with modern web technologies, the frontend provides an interactive dashboard and detailed product views.\n   - [Access the Frontend](https://sales-analysis-tool-front-end.vercel.app/)\n\n2. **Backend**: A robust API to serve sales data, built to handle analytics queries.\n   - [Access the Backend](https://sales-analysis-tool-back-end.onrender.com/)\n\n---\n\n## Frontend\n\n### Routes\n\n#### `/` - Home (Dashboard)\n- Displays the following:\n  - Total sales.\n  - Top-selling products.\n  - Sales percentage by category.\n  - Sales distribution charts (bar and pie charts).\n\n#### `/products` - Products\n- Displays a table of all products, including:\n  - Product name.\n  - Category.\n  - First sale date.\n  - Price.\n  - Total sales.\n- Includes a pagination feature with customizable items per page.\n\n### Features\n- Responsive and user-friendly interface.\n- Dropdown to filter analytics by time period (e.g., 7 days, 30 days, 12 months).\n- Interactive charts for sales distribution.\n- Built with **Vue.js** and styled using **TailwindCSS**.\n\n---\n\n## Backend\n\n### Endpoints\n\nThe backend provides the following API endpoints to fetch sales data:\n\n#### `GET /api/v1/analytics/total_sales`\n- **Description**: Retrieves the total sales amount.\n- **Response**:\n  ```json\n  {\n    \"totalSales\": 150000\n  }\n  ```\n\n#### `GET /api/v1/analytics/trending_products?limit=2`\n- **Description**: Fetches the top-selling products.\n- **Parameters**:\n  - `limit` (optional): Specifies the number of top products to return.\n- **Response**:\n  ```json\n  [\n    {\n        \"productID\": 53,\n        \"productName\": \"Keyboard\",\n        \"quantitySold\": 16902,\n        \"totalSales\": 4287789.02\n    },\n    {\n        \"productID\": 23,\n        \"productName\": \"History Book\",\n        \"quantitySold\": 16804,\n        \"totalSales\": 4325239.71\n    },\n  ]\n  ```\n\n#### `GET /api/v1/analytics/category_sales`\n- **Description**: Returns sales percentage by category.\n- **Parameters**:\n  - `period` (optional): Filters category sales by time period.\n- **Response**:\n  ```json\n  [\n    {\n        \"category\": \"Electronics\",\n        \"salesCount\": 58275,\n        \"totalSales\": 81519782.15,\n        \"percentage\": \"20.05\"\n    },\n    {\n        \"category\": \"Sports \u0026 Outdoors\",\n        \"salesCount\": 58100,\n        \"totalSales\": 81271979.35,\n        \"percentage\": \"19.99\"\n    },\n  ]\n  ```\n\n#### `GET /api/v1/analytics/products`\n- **Description**: Retrieves a list of all products with detailed information.\n- **Response**:\n  ```json\n  [\n    {\n      \"ProductID\": \"1\",\n      \"ProductName\": \"Product A\",\n      \"Category\": \"Electronics\",\n      \"firstSaleDate\": \"2023-01-01\",\n      \"Price\": 100,\n      \"totalSales\": 5000\n    },\n    {\n      \"ProductID\": \"2\",\n      \"ProductName\": \"Product B\",\n      \"Category\": \"Clothing\",\n      \"firstSaleDate\": \"2023-02-01\",\n      \"Price\": 50,\n      \"totalSales\": 3000\n    }\n  ]\n  ```\n\n### Backend Technologies\n- **Node.js**: Backend runtime environment.\n- **Express**: Web framework for API development.\n- **Database**: Data persistence for analytics.\n\n---\n\n## How to Run Locally\n\n### Frontend\n1. Clone the repository.\n2. Navigate to the frontend directory.\n3. Install dependencies:\n   ```bash\n   npm install\n   ```\n4. Start the development server:\n   ```bash\n   npm run dev\n   ```\n5. Open the app at `http://localhost:5173/`.\n\n### Backend\n1. Clone the repository.\n2. Navigate to the backend directory.\n3. Install dependencies:\n   ```bash\n   npm install\n   ```\n4. Set up environment variables in a `.env` file.\n    - PORT = 5000\n    - MONGO_URI = mongodb://localhost:27017/salesDatabase\n5. Start the server:\n   ```bash\n   npm run dev\n   ```\n6. The backend will be available at `http://localhost:5000/`.\n\n---\n\n## Deployment\n- **Frontend**: Deployed on **Vercel**.\n- **Backend**: Deployed on **Render**.\n\n\n## License\nThis project is licensed under the MIT License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodehass%2Fsales-analysis-tool-back-end","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodehass%2Fsales-analysis-tool-back-end","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodehass%2Fsales-analysis-tool-back-end/lists"}