A serveless application to detect locked Velib stations (Paris' bicycle sharing system). Hosted on AWS Serveless and visible at https://www.velinfo.fr and @Velinfo1
The raw data comes from the Velib official API. Thanks to them!
The DNS records are managed through Route53.
The frontend application is built with Angular, hosted using a S3 bucket and cached through a Cloudfront Distribution.
The backend consist of several TypeScript Lambdas and Dynamo tables processing data fetched from the Velib API. The resulting data is exposed through an AWS API Gateway.
- Languages : Typescript, both for the backend (AWS Lambda) and the frontend (Angular)
- Data storage : AWS DynamoDb
- Infrastructure / Deployment tooling : AWS SAM (superset of AWS CloudFormation dedicated to the serverless applications)
- Main Libraries used :
- aws-sdk for everything AWS
- date-fns for easing the date management without the overhead of moment
- class-transformer to simplify the conversion between Typescript / ES6 types and the Dynamo stored objects.
- twit to use the Twitter API
- axios to easily fetch data from the Velib API
- aws-sam-webpack-plugin to use TypeScript within AWS SAM
- @angular/material to use pre built Angular components
- @agm/core for an easy Google Map / Angular integration
- @swimlane/ngx-charts for nice Angular charts
What do you need ?
- NPM
- The AWS SAM CLI
- The Angular CLI
If you want to self host this application, it's possible. But, the SAM template expect a certain number of parameter, mainly regarding the DNS certificates and the Twitter API keys, that are obviously not included in this repo.
npm run build
sam deploy
The backend code is in the /lambda folder. The infrastructure configuration is defined in template.yml (a SAM template). As TypeScript is not natively supported by SAM, we can't rely on sam build
. Instead the build and preparation of the CloudFormation template is done via a custom build command
cd frontend
ng build --prod
aws s3 rm s3://velinfo-frontend --recursive
aws s3 cp dist/velinfo s3://velinfo-frontend --recursive --cache-control max-age=31536000
The frontend is a standard Angular application which can be built using the Angular CLI. Once built, the content need to be pushed to the S3 bucket hosting the static part of the website.