{"id":26814785,"url":"https://github.com/goodguygregory/vinyl-swarm","last_synced_at":"2025-03-30T02:17:03.083Z","repository":{"id":275902458,"uuid":"927556340","full_name":"GoodGuyGregory/vinyl-swarm","owner":"GoodGuyGregory","description":"Axum backend for vinyl-swarm application, leveraged SQLX with postgresql for storage","archived":false,"fork":false,"pushed_at":"2025-03-18T15:34:03.000Z","size":1131353,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T16:40:05.930Z","etag":null,"topics":["axum","rust","sqlx-postgres","vinyl-records"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoodGuyGregory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-05T06:37:37.000Z","updated_at":"2025-03-18T15:35:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"4b90c6f2-f25c-4af2-82c9-925b3864aff9","html_url":"https://github.com/GoodGuyGregory/vinyl-swarm","commit_stats":null,"previous_names":["goodguygregory/vinyl-swarm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodGuyGregory%2Fvinyl-swarm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodGuyGregory%2Fvinyl-swarm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodGuyGregory%2Fvinyl-swarm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodGuyGregory%2Fvinyl-swarm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoodGuyGregory","download_url":"https://codeload.github.com/GoodGuyGregory/vinyl-swarm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246266204,"owners_count":20749754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["axum","rust","sqlx-postgres","vinyl-records"],"created_at":"2025-03-30T02:17:02.610Z","updated_at":"2025-03-30T02:17:03.065Z","avatar_url":"https://github.com/GoodGuyGregory.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vinyl Swarm\n\nCollecting vinyl is a journey, but with so much out there, finding everything you want can be overwhelming. It's challenging too! As your collection grows, so does the difficulty of keeping track of knowing what you want and already own. I want to collect as many vinyl treasures as possible, and reduce the stress of keeping track of all my records. I also got tired of lossing lists of records I plan on purchasing at a later time. That’s why I built this project. \n\nScavenging for records isn't just about what you already own. it’s about discovering new places, supporting local spots, and building a community of fellow collectors who can recommend new artists to you. Vinyl Swarm also offers the ability to, search for friends, share collections, and track down hidden gems together. \n\nThis backend Axum application, written in Rust, helps categorize and search your collection, so instead of racking your brain for what’s missing, you can let the system do the work. No more lost lists, it keeps everything you want and have in one database hosted on your system.\n\nMy hope is that this API makes finding vinyl-collecting friends easier, helps you keep track of your collection, and, most importantly, helps you finally snag those rarities you’ve been after. 🎶 \n\nHappy Collecting \n\n### Features\n\n* **User Collections:** Store your personal record collection details with the world and show off your rare finds. This also helps friends determine what records they might want to take off your hands. Collections can be viewed by others and they make great conversation starters.\n\n* **Records:** Records are representations of actual vinyl releases. The Records collection will be stored in the database for anyone to look at and add to their collection. This is a running list of all records for every user. It's community driven.\n\n* **Record Stores:** What app wouldn't be complete without the best havens for searching for the your next favorite artist's LP. The API allows for accessing Record Stores throughout the US, offering a description of the store and it's city state, as well as the website to browse stock.\n\n## API Documentation\n\n[Vinyl Swarm API](https://documenter.getpostman.com/view/5839344/2sAYk7SizX) Keep in mind the documentation won't operate correctly unless the project is build and running. click the `Run in Postman` button if you're not familiar with `Curl Commands`\n\n\n------  \n\n# Getting Started\n\n\n## Ensure PostgreSQL is Installed\n\nif you have not done so [install postgresql](https://www.postgresql.org/download/) the database backend is configured to work with postgres through `SQLX`. This is leveraged to interface with postgres through the Rust API backend.\n\n**What is SQLX?**\n\n\u003e   SQLX is a Rust library that provides a type-safe SQL library for Rust applications. It takes the static query strings and returns the entire SQL result set as a Rust type. It's a pure Rust library that is used for asynchronous database   handling in Rust.  \n\n[SQLX Project](https://sqlx.dev/article/A_Beginners_Guide_to_SQLX_Getting_Started.html)\n\n## Clone the Repo\n\nclone this repo somewhere safe and access the code locally.\n\n## Cargo Build\n\nafter cloning `change directory` into the project then build the project using the following dependencies with these features \n\n```bash\n# change directory to the project\ncd vinyl-swarm/vinyl-swarm\n\n# build the project \ncargo build\n```\n\n**Dependencies Required**\n\n```toml\n[dependencies]\naxum = \"0.8.1\"\nbcrypt = \"0.17.0\"\nbigdecimal = { version = \"0.4\", features = [\"serde\"] }\nchrono = { version = \"0.4.40\", features = [\"serde\"] }\ndotenv = \"0.15.0\"\nserde = { version = \"1.0.218\", features = [\"derive\"] }\nserde_json = \"1.0.140\"\nsqlx = { version = \"0.8.3\", features = [\"runtime-async-std-native-tls\", \"postgres\", \"chrono\", \"uuid\", \"bigdecimal\"] }\ntokio = { version = \"1.43.0\", features = [\"full\"] }\ntower-http = { version = \"0.6.2\", features = [\"cors\"] }\nuuid = { version = \"1.15.1\", features = [\"serde\", \"v4\"] }\n```\n\n## Initialize Database\n\nAfter building the project you're ready to add the initial database files to start adding your personal collection. from inside the `vinyl-swarm` directory. \n\n**Create Database Configuration**\n\npoint the project to your newly created database and supply the connection string inside of a `.env` file at the `root` of the project. *ie inside the `vinyl-swarm` directory of this repo*\n\n**Project Structure Below**\n\nplace the `.env` in the same location. This is the Vinyl-Swarm Project contents.\n\n```tree\n├── Cargo.lock\n├── Cargo.toml\n├── migrations\n│   ├── 20250308183724_init.down.sql\n│   └── 20250308183724_init.up.sql\n├── src\n│   ├── handlers\n│   │   ├── mod.rs\n│   │   ├── record_stores.rs\n│   │   ├── records.rs\n│   │   └── users.rs\n│   ├── main.rs\n│   ├── models\n│   │   ├── mod.rs\n│   │   ├── record.rs\n│   │   ├── store.rs\n│   │   └── user.rs\n│   └── routes\n│       ├── mod.rs\n│       └── router.rs\n├── .env\n```\n\n**Contents of ENV**\n\nif you haven't already done so create a `vinyl_swarm` database with a `user` and `password` for this database then add the configuration details to your `.env` exposure of your database in postgres might be on a different port other than `localhost:5432` check your configurations within your database for trouble shooting.\n\n```\nDATABASE_URL=postgresql://\u003cdatabase_username\u003e:\u003cdatabase_user_password\u003e@localhost:5432/vinyl_swarm\n```\n\n**Install the SQLX CLI**\n\nthis will be used to begin using the API\n\n```bash\n# used to run the initial migration\ncargo install sqlx-cli\n```\n\n**Run Initial Migration**\n\nonce the `sqlx-cli` process is installed. ensure you're inside of the project code. execute the following commands in the correct locations while your connected postgres instance is running. \n\n\n```bash\n# check directory ensure `\u003ccwd\u003e/vinyl-swarm/vinyl-swarm\npwd\n\n# once you've confirmed your inside the project\n# run the initial migration with sqlx cli\nsqlx migrate run\n```\n\nthe `sqlx migrate run` will install all of your initial database tables, and collections used for the project. if you want to check out the relational database configuration checkout the [initial migration script](./vinyl-swarm/migrations/20250308183724_init.up.sql)\n\n## Run the Project\n\nfrom the terminal start up the application, but ensure the current working directory still points to `vinyl-swarm/vinyl-swarm` \n\n```bash\ncargo run   \n```\n\n## Challenges\n\nat first learning the style of module support for Rust was difficult. I often placed directories and modules in the wrong location or forgot to bring them inside of the project file that explicitly needed them. the Rust compiler was sharp and eager to tell me of my failed imports which made error tracking much easier to solve. I grew more fond of the structure as I progressed building the application breaking down functionality between files to separate component concerns for each model. **User**, **Records**, **RecordStores**. Then adding unique routes and handlers for these models to interact with the database and properly influence the user backend. After having students attempt to build the project I modified the wording and instructions. I also learned how to manage `git filter-repo` by reducing the size and removing documentation resources I used as references on how to start building a project of this scale in Axum and Rust. I hope you enjoy the concept and reach out to me if you have any questions or concerns.\n\n## Documentation\n\nReference materials for getting started and working with the project, Axum is new for me so I hope if you're interested in learning it you check out the other technologies I leveraged to build this API. \n\n#### Axum \n\n[Axum](https://docs.rs/axum/latest/axum/)\n\n[Getting Started With Axum](https://codevoweb.com/rust-crud-api-example-with-axum-and-postgresql/)\n\n#### Migrations with SQLX\n\n[SQLX](https://docs.rs/sqlx/latest/sqlx/)\n\n[SQLX Basics](https://www.youtube.com/watch?v=TCERYbgvbq0\u0026t=32s)\n\n#### Serde\n\n[Serde](https://docs.rs/serde/latest/serde/)\n\n#### Reqwest\n\n[Making Reqwests with Rust](https://blog.logrocket.com/making-http-requests-rust-reqwest/)\n\n#### Tokio \n\n[Tokio](https://tokio.rs/tokio/tutorial)\n\n\n\n## Contact\n\nGoodGuyGregory 🚲  \n[greg@goodguygregory.com](mailto:greg@goodguygregory.com)\n\n\n### License \n\nCopyright (c) 2011-2026 GitHub Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodguygregory%2Fvinyl-swarm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoodguygregory%2Fvinyl-swarm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodguygregory%2Fvinyl-swarm/lists"}