An open API service indexing awesome lists of open source software.

https://github.com/ap-dev-github/atithidev-db-api

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.
https://github.com/ap-dev-github/atithidev-db-api

api-gateway aws cloud-native cost-optimization eslint jest lambda production-ready pruning rest-api scalable-architecture serverless typescript

Last synced: about 1 year ago
JSON representation

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.

Awesome Lists containing this project

README

          

# Overview πŸ”

## **Atithidev DB API – Scalable & Cost-Optimized Serverless Backend**
> 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.

---

## πŸ’° Cost Efficiency & Scalability
- The API scales down to approximately **zero cost** for up to **1 million API requests per month**.
- 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.
- When traffic increases, it **seamlessly scales up** using the AWS API Gateway to handle the load.
- After exceeding **1 million requests**, costs are incurred based on **AWS Lambda pricing**.

---

## πŸš€ Fully Automated & Cost-Optimized CI/CD Deployment
1. **Run Code Quality Checks** – ESLint for linting and Jest for API endpoint testing.
2. **Automated CI/CD Based Testing & Deployment Optimization**
- Installs the testing dependencies, runs tests, and removes them post-testing to reduce package size.
- Prunes old versions from the cloud and **reduces dev dependencies** before packaging.
3. **Deploy to AWS** – Automatically updates the AWS Lambda function and connects with API Gateway.
4. **Verify and Activate Lambda** – Ensures the function is running seamlessly after deployment.

---

## ✨ Features
- Fetch reviews, post reviews, and find people (hosts) based on various parameters like state or ID.
- **Fully serverless** with AWS Lambda ⚑
- Uses **MongoDB Atlas** as the database 🌴
- **CI/CD automation** with GitHub Actions πŸ€–
- **TypeScript** for type safety πŸ’Ž
- Linting Test
- **Jest** for API endpoint testing βœ…
- **Rate limiting** to prevent abuse βš–οΈ
- **Logging and monitoring** with AWS CloudWatch πŸ“Š
---

## πŸ› οΈ Tech Stack
- **Node.js** (Runtime: 18.x) πŸ’š
- **TypeScript** (Type-Safe Development) πŸ’Ž
- **MongoDB Atlas** (Database) 🌴
- **AWS Lambda** (Serverless Compute) ⚑
- **AWS API Gateway**
- **Serverless Framework**
---

## πŸ” Security Features
- βœ… **Rate Limiting** – Prevents abuse and DDoS attacks, ensuring API stability.
- βœ… **Code Quality Enforcement** – Integrates ESLint into CI/CD to maintain high-quality code.
- βœ… **Secure Key Management** – Uses GitHub Secrets Manager to protect API keys and environment variables.
- βœ… **Database Security** – MongoDB Atlas is secured with **IP whitelisting**, restricting unauthorized access.
---

## πŸ”§ Setup Instructions
### 1️⃣ Clone the Repository πŸ”—
```sh
git clone https://github.com/ap-dev-github/atithidev-db-api.git
```
### 2️⃣ Install Dependencies πŸ“¦
```sh
npm install
```
### 3️⃣ Environment Variables πŸ”‘
```sh
MONGO_URI=your-mongodb-connection-string
```
### 4️⃣ Run Locally with Serverless Offline πŸ–₯️
```sh
npx serverless offline
```
### 5️⃣ Deploy to AWS Lambda πŸš€
```sh
npx serverless deploy
```
## 🌐 Endpoints

| **Method**| **Endpoint** | **Description** |
|-----------|----------------------|-----------------------------------------|
| GET | `/` | Home route, checks if API is running |
| GET | `/fetchHosts` | Fetch all hosts |
| GET | `/fetchHosts/:state` | Fetch hosts by state |
| POST | `/insert_review` | Insert a new review |
GET | `/fetchHost/:id` | Fetch host detail by id |

## πŸ‘¨β€πŸ’»Creator and Maintainer
## Ayush Pandey

[πŸ”— Connect on LinkedIn](https://www.linkedin.com/in/linkedap/)
πŸ“§ **Email:**[ayushpandey.cs@gmail.com](mailto:ayushpandey.cs@gmail.com)