This project involves the development and deployment of a Serverless and Event-driven Application on AWS using AWS Lambda and the Serverless framework. The application is a TODO application that allows users to create, read, update, and delete TODO items, with the ability to attach images to each item.
This project leverages a wide range of technologies and tools, from development to deployment:
-
Development Technologies and Tools:
- Programming Languages:
- JavaScript
- TypeScript
- Frontend Framework:
- React.js
- Backend Runtime:
- Node.js
- Programming Languages:
-
Serverless Framework and AWS Services:
- Serverless Framework: Used to manage and deploy the serverless application.
- AWS Lambda: Serverless compute service for running the application's backend functions.
- AWS API Gateway: Managed API service for handling the application's API endpoints.
- AWS DynamoDB: NoSQL database service for storing the TODO items.
- AWS S3: Object storage service for storing attachments (e.g., images) associated with TODO items.
- AWS Cognito: User authentication and authorization service for implementing user authentication.
- AWS CloudFormation: Infrastructure as code service for provisioning and managing the required AWS resources.
- AWS IAM: Identity and Access Management service for managing permissions and roles.
- AWS CloudWatch: Logging and monitoring service for the serverless application.
-
Authentication Service:
- Auth0: External authentication service for implementing user authentication and authorization.
-
Development and Testing Tools:
- Code Editor: Your preferred code editor, such as Visual Studio Code, Sublime Text, or IntelliJ IDEA.
- Git: Version control system for tracking code changes and collaborating.
- npm: Package manager for managing Node.js dependencies.
- Jest: Testing framework for unit testing the application's components.
- Cypress: End-to-end testing framework for testing the application's functionality.
-
Deployment and Infrastructure Tools:
- Serverless Framework CLI: Command-line interface for the Serverless framework, used to deploy the application.
- AWS CLI: Command-line interface for interacting with AWS services and managing resources.
- AWS Management Console: Web-based interface for managing and monitoring AWS resources.
The client
folder contains a web application that can interact with the API developed as part of this project. This frontend should work seamlessly with the serverless application.
To implement authentication in the application, you would need to integrate with an identity provider such as Auth0. The Serverless framework can be used to set up and configure the necessary AWS Cognito user pools and identity pools to handle user authentication and authorization.
The core of this project is the implementation of the TODO application using AWS Lambda and the Serverless framework.
The serverless.yml
file is the configuration file used by the Serverless framework to define the infrastructure and settings for a serverless application. This YAML file is the primary means of configuring the various AWS resources and service settings required for the application.
The application will allow users to perform the following operations on TODO items:
- Create TODO items
- Retrieve TODO items
- Update TODO items
- Delete TODO items
- Optionally attach images to TODO items
Each user will have access only to the TODO items they have created.
The application uses an AWS DynamoDB table to store the TODO items.
The Serverless framework is used to manage and deploy the various AWS resources required for the application, including:
- AWS Lambda functions
- AWS API Gateway
- AWS DynamoDB
- AWS S3 (for storing attachments)
- AWS CloudFormation
- AWS IAM
- AWS CloudWatch
The Serverless framework simplifies the process of configuring, packaging, and deploying the serverless application to AWS.
The project should have the following structure:
serverless-todo-app/
├── client/
│ └── ...
├── backend/
│ ├── functions/
│ │ ├── create.js
│ │ ├── delete.js
│ │ ├── get.js
│ │ ├── update.js
│ │ └── upload.js
│ ├── models/
│ │ └── todo-item.js
│ ├── package.json
│ ├── serverless.yml
│ └── utils/
│ └── ...
└── README.md
The client
folder contains the frontend web application, and the backend
folder contains the serverless application code and deployment configuration.
To get started with the project, follow these steps:
- Set up your AWS credentials and configure the Serverless framework.
- Implement the TODO application functionality in the
backend/functions
directory. - Implement the frontend web application in the
client
directory. - Deploy the serverless application using the Serverless framework.
- Test the application and make any necessary updates or improvements.
Refer to the individual directories for more detailed instructions on setting up and developing the application.
To deploy an application run the following commands:
cd backend
npm install
sls deploy -v
To run a client application first edit the client/src/config.ts
file to set correct parameters. And then run the following commands:
cd client
npm install
npm run start
This should start a development server with the React application that will interact with the serverless TODO application.
An alternative way to test your API, you can use the Postman collection that contains sample requests. You can find a Postman collection in this project. To import this collection, do the following.
Click on the import button:
Click on the "Choose Files":
Select a file to import:
Right click on the imported collection to set variables for the collection:
Provide variables for the collection (similarly to how this was done in the course):
This project demonstrates the development and deployment of a Serverless and Event-driven Application on AWS using AWS Lambda and the Serverless framework. The application showcases the use of various AWS services, such as DynamoDB, S3, Cognito, and API Gateway, to create a robust and scalable TODO application.