Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lmammino/fm.loige.co
The Rusty serverless API that powers fm.loige.co. Developed with AWS Lambda, Rust and SAM.
https://github.com/lmammino/fm.loige.co
api aws lambda last-fm lastfm lastfm-api music rust
Last synced: about 6 hours ago
JSON representation
The Rusty serverless API that powers fm.loige.co. Developed with AWS Lambda, Rust and SAM.
- Host: GitHub
- URL: https://github.com/lmammino/fm.loige.co
- Owner: lmammino
- License: mit
- Created: 2024-01-26T18:49:11.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-02-09T08:26:39.000Z (8 months ago)
- Last Synced: 2024-05-02T06:09:37.142Z (5 months ago)
- Topics: api, aws, lambda, last-fm, lastfm, lastfm-api, music, rust
- Language: Rust
- Homepage: https://loige.co
- Size: 28.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fm.loige.co
[![Rust](https://github.com/lmammino/fm.loige.co/actions/workflows/rust.yml/badge.svg)](https://github.com/lmammino/fm.loige.co/actions/workflows/rust.yml)
[![Sam](https://github.com/lmammino/fm.loige.co/actions/workflows/sam.yml/badge.svg)](https://github.com/lmammino/fm.loige.co/actions/workflows/sam.yml)The _Rusty_ serverless API that powers [fm.loige.co](https://fm.loige.co/playing). Developed with [AWS Lambda](https://aws.amazon.com/lambda/), [Rust](https://www.rust-lang.org/) and [SAM](https://aws.amazon.com/serverless/sam/).
If you want to build something like this for yourself, you can use this repo as a reference and follow the instructions below.
## Requirements
It requires a [Last.fm](https://www.last.fm/) account and a [Last.fm API key](https://www.last.fm/api/account/create).
If you want to deploy it on AWS you need an AWS account and the [AWS CLI](https://aws.amazon.com/cli/) installed and configured.
You'll also need the Rust toolchain, [cargo-lambda](https://www.cargo-lambda.info/), [Docker](https://www.docker.com/), and SAM installed on your machine.
## Usage
First of all, grab an API key and make sure to populate the `LASTFM_API_KEY` environment variable with it.
### Running locally
To run the Lambda locally you can use `cargo lambda`:
```bash
$ cargo lambda watch
```This will spin up a development server to which you can send requests. For example:
```bash
$ cargo lambda invoke --data-file events/example-apigw-request.json
```If you want to run this as a local API, you can do that with SAM:
```bash
$ sam local start-api
```Then you can send requests to `http://localhost:3000/playing`.
## Deploying on AWS
Before deploying to AWS you most likely want to customise the [`template.yaml`](/template.yaml).
In particular, you will want to change all the various parameters. I am also using a custom domain name, so you'll want to change that as well.
Domain name requires validation, so when the first deployment starts, it will stay in a _pending_ state until you create the necessary DNS records to validate the TLS certificate. This can be done manually or by logging in the AWS console and going to the Certificate Manager service.
> **Note**: This is only necessary for the first deployment
Once you are happy with the configuration, you can deploy the stack with:
```bash
$ sam deploy --guided
```And follow the guided procedure.
## Contributing
Everyone is very welcome to contribute to this project.
You can contribute just by submitting bugs or suggesting improvements by
[opening an issue on GitHub](https://github.com/lmammino/fm.loige.co/issues).## License
Licensed under [MIT License](LICENSE). © Luciano Mammino.