A backend application built in Rust to hold logic for the Boiler Book Club library. This was previously done purely through a google sheet, but we would like more accessible methods to be built. Currently, only basic features such as adding, borrowing, and returning are being prioritized. The project will hopefully encompass all the functions that a real library has, such as holds and renewals, in the future.
To run the application with the club library you must have access to the [email protected] account. Otherwise, you will have to modify the spreadsheet ID used in
src/db/sheet.rs
and supply your own. You can find a template for the spreadsheet here.
- Install Rust through rustup
- Clone this repository
- Create a
credentials.json
file in the top levelclub-library/
directory. You can obtain the ID and secret from the google API console. Populate it with something like the following:
{
"installed": {
"client_id": "your id",
"client_secret": "your secret",
"project_id": "your project id",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"redirect_uris": ["urn:ietf:wg:oauth:2.0:oob", "http://localhost"]
}
}
- Run the program with
cargo run
Please also note that the program requests the API token for you and caches it. As a result, the first time you run it you will have to manually approve it by copy pasting a link. These tokens do expire, so this will need to be repeated every so often.
Once deployed, updating the sheet is easy. We have:
/books
: A GET request to /books will return all books currently in the library./books
: A POST request to /books will add a new book and require a title, author, genre, name, and email./borrowing
: A POST request to /borrowing will require an id, name, and email/borrowing
: A GET request to /borrowing with a name and email will get a list of book that user is borrowing./returning
: A POST request to /returning will require an id, name, and email.
For example, you could do:
localhost:3000/books?title=Siege and Storm&author=Leigh Bardugo&genre=YA Fantasy&name=Kai Tinkess&[email protected]
These do not have tracking issues or PRs yet, but are good places to take the project.
- Make status codes and errors more accurate
- Add tracing through tower
- Hard due dates
- Renewals
- Holds
- Email Reminders
- Removing books
- Rename the project
- Kai Tinkess