My idea is to build a HM 'bookstore' where people can trade books within the community. I remember an email chain trend where people would send books to each other and thought it'd be fun to build it for the school.
- My project will require a light front-end where users can click around to peruse books ready to trade, and include images and such. I want to make a simple form for creating books to trade as well.
- For my backend I need to maintain a database have a starting list of books, then have a way for users to SEARCH books by author/title, to CREATE books they want to trade (with authentication), and marks trades as complete by an UPDATE endpoint.
- I want to learn about authentication outside of class to only allow people with an account to create books to trade.
- STRETCH GOAL 1 If I have time, I want to create a small social media part of the app, where you can maybe set up book clubs with people with similar tastes and have read the same books :)
- STRETCH GOAL 2 If I have time, I want to create a recommendation engine for people looking for new books.
- I considered making an Animal Crossing DB but there's not much front end possibilities with that, and I also couldn't find a ready-made database (only JSON and I think it was going to be too tedious to translate it to SQLite).
Credit for original book database from https://github.com/bbrumm/databasestar/tree/main/sample_databases/sample_db_gravity/mysql
- Clone the repo
- Run
npm install
to install dependencies - Run
nodemon index.js
to start the server
localhost:3999/search/author
(GET endpoint)
-- pass in "author" : "YOUR AUTHOR HERE" as a JSON body
localhost:3999/search/book
(GET endpoint)
-- pass in "book" : "YOUR BOOK TITLE HERE" as a JSON body
localhost:3999/user/create
(POST endpoint)
-- example JSON body:
{
"first_name" : "xxx",
"last_name" : "xxx",
"email": "[email protected]"
}
localhost:3999/user/:id/trades
(GET endpoint)
Example Response:
[
{
"lender_id": 3,
"borrower_id": null,
"trade_id": 1,
"status": "pending",
"created_at": "2025-04-02T18:08:23.732Z",
"book_id": 1616
}
]
localhost:3999/trade/create
(POST endpoint)
-- example JSON body:
{
"lender_id" : 1,
"borrower_id" : 2,
"book_id" : 3,
}
-- example JSON response:
[
{
"lender_id": 3,
"borrower_id": null,
"trade_id": 1,
"status": "pending",
"created_at": "2025-04-02T18:08:23.732Z",
"book_id": 1616
}
]
OTHER ENDPOINTS (not made) -- For all these customer-specific endpoints, plan is to have user automatically passed as authentication later
localhost:3999/trade/:tradeid/claim
(PUT endpoint)
-- someone can claim a trade
localhost:3999/trade/:tradeid/cancel
(PUT endpoint)
-- someone can cancel their trade
localhost:3999/trade/:tradeid/deliver
(PUT endpoint)
-- someone can mark a trade as TRADED