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.
- Host: GitHub
- URL: https://github.com/ap-dev-github/atithidev-db-api
- Owner: ap-dev-github
- License: other
- Created: 2025-03-07T11:24:00.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-19T08:56:01.000Z (about 1 year ago)
- Last Synced: 2025-03-19T09:36:39.084Z (about 1 year ago)
- Topics: api-gateway, aws, cloud-native, cost-optimization, eslint, jest, lambda, production-ready, pruning, rest-api, scalable-architecture, serverless, typescript
- Language: TypeScript
- Homepage:
- Size: 356 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)