{"id":26563649,"url":"https://github.com/ap-dev-github/atithidev-db-api","last_synced_at":"2025-03-22T16:16:40.083Z","repository":{"id":281195297,"uuid":"944454788","full_name":"ap-dev-github/atithidev-db-api","owner":"ap-dev-github","description":"A fully scalable, AWS Lambda-based API . It enables seamless host and review management with serverless deployment, CI/CD automation, and robust security while being highly optimized for AWS cost efficiency.Now enhanced with TypeScript type safety, Jest testing, package pruning.","archived":false,"fork":false,"pushed_at":"2025-03-19T08:56:01.000Z","size":365,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T09:36:39.084Z","etag":null,"topics":["api-gateway","aws","cloud-native","cost-optimization","eslint","jest","lambda","production-ready","pruning","rest-api","scalable-architecture","serverless","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ap-dev-github.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-03-07T11:24:00.000Z","updated_at":"2025-03-19T08:56:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"dcad533d-f0f9-4246-8e6c-6f8eba659333","html_url":"https://github.com/ap-dev-github/atithidev-db-api","commit_stats":null,"previous_names":["ap-dev-github/atithi-test-repo","ap-dev-github/atithidev-db-api"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ap-dev-github%2Fatithidev-db-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ap-dev-github%2Fatithidev-db-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ap-dev-github%2Fatithidev-db-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ap-dev-github%2Fatithidev-db-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ap-dev-github","download_url":"https://codeload.github.com/ap-dev-github/atithidev-db-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244982060,"owners_count":20542301,"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":["api-gateway","aws","cloud-native","cost-optimization","eslint","jest","lambda","production-ready","pruning","rest-api","scalable-architecture","serverless","typescript"],"created_at":"2025-03-22T16:16:39.605Z","updated_at":"2025-03-22T16:16:40.065Z","avatar_url":"https://github.com/ap-dev-github.png","language":"TypeScript","readme":"\n# Overview 🔍\n\n## **Atithidev DB API – Scalable \u0026 Cost-Optimized Serverless Backend**\n\u003e The Atithidev DB API is a scalable, serverless backend solution designed for efficiently managing profiles and reviews. Built using the Serverless Framework and deployed on AWS Lambda, it eliminates infrastructure management while ensuring cost-effective scaling and high availability.\n\n---\n\n## 💰 Cost Efficiency \u0026 Scalability\n- The API scales down to approximately **zero cost** for up to **1 million API requests per month**.\n- If there is no traffic, the infrastructure **automatically scales down** to near-zero cost, inclusive of AWS services like **S3, API Gateway**, and other dependencies.\n- When traffic increases, it **seamlessly scales up** using the AWS API Gateway to handle the load.\n- After exceeding **1 million requests**, costs are incurred based on **AWS Lambda pricing**.\n\n---\n\n## 🚀 Fully Automated \u0026 Cost-Optimized CI/CD Deployment\n1. **Run Code Quality Checks** – ESLint for linting and Jest for API endpoint testing.\n2. **Automated CI/CD Based Testing \u0026 Deployment Optimization**\n   - Installs the testing dependencies, runs tests, and removes them post-testing to reduce package size.\n   - Prunes old versions from the cloud and **reduces dev dependencies** before packaging.\n3. **Deploy to AWS** – Automatically updates the AWS Lambda function and connects with API Gateway.\n4. **Verify and Activate Lambda** – Ensures the function is running seamlessly after deployment.\n\n---\n\n## ✨ Features\n- Fetch reviews, post reviews, and find people (hosts) based on various parameters like state or ID.\n- **Fully serverless** with AWS Lambda ⚡\n- Uses **MongoDB Atlas** as the database 🌴\n- **CI/CD automation** with GitHub Actions 🤖\n- **TypeScript** for type safety 💎\n- Linting Test\n- **Jest** for API endpoint testing ✅\n- **Rate limiting** to prevent abuse ⚖️\n- **Logging and monitoring** with AWS CloudWatch 📊\n---\n\n## 🛠️ Tech Stack\n- **Node.js** (Runtime: 18.x) 💚\n- **TypeScript** (Type-Safe Development) 💎\n- **MongoDB Atlas** (Database) 🌴\n- **AWS Lambda** (Serverless Compute) ⚡\n- **AWS API Gateway**\n- **Serverless Framework**\n---\n\n## 🔐 Security Features\n- ✅ **Rate Limiting** – Prevents abuse and DDoS attacks, ensuring API stability.\n- ✅ **Code Quality Enforcement** – Integrates ESLint into CI/CD to maintain high-quality code.\n- ✅ **Secure Key Management** – Uses GitHub Secrets Manager to protect API keys and environment variables.\n- ✅ **Database Security** – MongoDB Atlas is secured with **IP whitelisting**, restricting unauthorized access.\n---\n\n## 🔧 Setup Instructions\n### 1️⃣ Clone the Repository 🔗\n```sh\ngit clone https://github.com/ap-dev-github/atithidev-db-api.git\n```\n### 2️⃣ Install Dependencies 📦\n```sh\nnpm install\n```\n### 3️⃣ Environment Variables 🔑\n```sh\nMONGO_URI=your-mongodb-connection-string\n```\n### 4️⃣ Run Locally with Serverless Offline 🖥️\n```sh\nnpx serverless offline\n```\n### 5️⃣ Deploy to AWS Lambda 🚀\n```sh\nnpx serverless deploy\n```\n## 🌐 Endpoints\n\n| **Method**| **Endpoint**        | **Description**                          |\n|-----------|----------------------|-----------------------------------------|\n| GET       | `/`                  | Home route, checks if API is running    |\n| GET       | `/fetchHosts`        | Fetch all hosts                         |\n| GET       | `/fetchHosts/:state` | Fetch hosts by state                    |\n| POST      | `/insert_review`     | Insert a new review                     |\n  GET       | `/fetchHost/:id`     | Fetch host detail by id                 |\n\n## 👨‍💻Creator and Maintainer\n## Ayush Pandey\n\n[🔗 Connect on LinkedIn](https://www.linkedin.com/in/linkedap/)  \n📧 **Email:**[ayushpandey.cs@gmail.com](mailto:ayushpandey.cs@gmail.com)  \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fap-dev-github%2Fatithidev-db-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fap-dev-github%2Fatithidev-db-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fap-dev-github%2Fatithidev-db-api/lists"}