This repository contains simple serverless todo app. Serverless allows you to run application without thinking or managing servers.
Backend is written using Express.js and Frontend is written using vue.js.
The backend is built using AWS Lambda and Amazon API Gateway. For the database it uses Amazon DynamoDB, a NoSQL Key-Value database. For hosting the frontend it uses AWS Amplify.
To deploy the app we utilise Serverless Framework as Infrastructe as Code (IaC).
The app has been tested using following softwares or services.
- AWS CLI v2.82
- Serverless Framework v3.22
- Node.js v16
- GitHub account
It is recommended to fork this repo to your account.
git clone [email protected]:rioastamal-examples/express-serverless-todo.git
cd express-serverless-todo
Install dependencies for the backend.
cd api/
sh build.sh --build
Serverless Framework uses the same configuration as AWS CLI such as AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
. So make sure to setup those first.
In addition to AWS CLI config, you need to provide GitHub Personal Access Token via environment variable.
export GITHUB_PERSONAL_TOKEN=_YOUR_OWN_GITHUB_PERSONAL_TOKEN_
Then you can start to deploy.
sh build.sh --deploy
Command above will provision all AWS resources needed to run the app including backend and frontend.
After first deployment you need to go to AWS Amplify Console and do following:
- Click the frontend app in this case serverless-todo-frontend-development
- If you see Migrate to our GitHub App dialog just click Start migration
- To begin first build click Run build
Next time if you want to deploy the frontend you just need to push commit to GitHub and AWS Amplify automatically trigger the build.
URL of Application can be found at the main page or on Domain settings page. Example of the URL.
https://BRANCH_NAME.RANDOM_VALUE.amplifyapp.com
Remember to remove the application if you don't need it to prevent recurring cost.
Make sure you're on api/
directory.
cd api/
Run following Serverless Framework command to destroy all resources created from the deployment.
serverless remove
This application is written by Rio Astamal.
This project is licensed under MIT. See LICENSE.md for details.