This project is a Serverless API developed to manage customers, sales, and products using AWS Lambda, AWS API Gateway, and DynamoDB. Deployment is done with AWS Chalice, simplifying the implementation and management of Lambda functions.
The API follows this structure:
Illustrative image showing the API services and endpoints.
✅ Customer registration (Individual and Business)
✅ Sales registration (Physical and Online)
✅ Product stock management
✅ CRUD methods (Create, Read, Update, Delete) for each entity
✅ Simplified deployment with AWS Chalice
- AWS Lambda - Serverless computing
- AWS API Gateway - REST endpoint exposure
- AWS DynamoDB - NoSQL database
- Python - Backend language
- Boto3 - AWS SDK for Python
- AWS Chalice - Framework for creating and managing Serverless APIs
- Postman - API testing
| Method | URL | Description |
|---|---|---|
POST |
/consumers/person |
Create individual customer |
POST |
/consumers/company |
Create business customer |
GET |
/consumers/persons |
List individual customers |
GET |
/consumers/companies |
List business customers |
GET |
/consumers/person/{id} |
Get individual customer by ID |
GET |
/consumers/companies/{id} |
Get business customer by ID |
PUT |
/consumers/person |
Update individual customer |
PUT |
/consumers/company |
Update business customer |
DELETE |
/consumers/person |
Remove individual customer |
DELETE |
/consumers/company |
Remove business customer |
| Method | URL | Description |
|---|---|---|
POST |
/sales/offline |
Create physical sale |
POST |
/sales/online |
Create online sale |
GET |
/sales/offlines |
List physical sales |
GET |
/sales/onlines |
List online sales |
GET |
/sales/offline/{id} |
Get physical sale by ID |
GET |
/sales/online/{id} |
Get online sale by ID |
PUT |
/sales/offline |
Update physical sale |
PUT |
/sales/online |
Update online sale |
DELETE |
/sales/offline |
Remove physical sale |
DELETE |
/sales/online |
Remove online sale |
| Method | URL | Description |
|---|---|---|
POST |
/products |
Add product |
GET |
/products/{id} |
Get product |
PUT |
/products |
Update product |
DELETE |
/products |
Remove product |
- AWS CLI configured
- Python 3.x installed
- AWS Chalice installed:
pip install chalice
Clone the repository and install dependencies:
git clone git@github.com:guiipedroso/serverless-api-lambda.git
cd serverless-api-lambda
pip install -r requirements.txtTo deploy to AWS using Chalice:
chalice deployThis will automatically create the Lambda functions, API Gateway, and necessary configurations.
To test the API locally:
chalice local --port 8090The API will be available at http://localhost:8090
To run unit tests:
pytestTo test with Postman, import the endpoint collection (link to be added later).
Here are some examples of tests performed on the API endpoints using Postman:
The image above demonstrates requests and responses from tests performed on the API endpoints, validating their functionality.
Feel free to contribute! Just follow these steps:
- Fork the repository
- Create a new branch:
git checkout -b my-feature
- Commit your changes:
git commit -m "feat: my new feature" - Push to the branch:
git push origin my-feature
- Open a Pull Request
This project is under the MIT license.
