{"id":20768121,"url":"https://github.com/softwaremill/rust-axum-sqlx-redis-ws-template","last_synced_at":"2025-09-28T01:32:13.718Z","repository":{"id":260055981,"uuid":"880156560","full_name":"softwaremill/rust-axum-sqlx-redis-ws-template","owner":"softwaremill","description":"Rust+Axum+Sqlx+Redis+Postgres Web Service Template","archived":false,"fork":false,"pushed_at":"2025-02-08T15:44:52.000Z","size":21,"stargazers_count":20,"open_issues_count":2,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-09T13:48:00.533Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softwaremill.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-10-29T08:15:21.000Z","updated_at":"2025-04-09T11:55:51.000Z","dependencies_parsed_at":"2025-01-18T06:42:33.667Z","dependency_job_id":"1fb8a0dc-f866-4132-9ecf-9f6ba35b6c30","html_url":"https://github.com/softwaremill/rust-axum-sqlx-redis-ws-template","commit_stats":null,"previous_names":["softwaremill/rust-axum-sqlx-redis-ws-template"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/softwaremill/rust-axum-sqlx-redis-ws-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Frust-axum-sqlx-redis-ws-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Frust-axum-sqlx-redis-ws-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Frust-axum-sqlx-redis-ws-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Frust-axum-sqlx-redis-ws-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softwaremill","download_url":"https://codeload.github.com/softwaremill/rust-axum-sqlx-redis-ws-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Frust-axum-sqlx-redis-ws-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277315119,"owners_count":25797567,"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","status":"online","status_checked_at":"2025-09-27T02:00:08.978Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-17T11:35:45.715Z","updated_at":"2025-09-28T01:32:13.713Z","avatar_url":"https://github.com/softwaremill.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rust-axum-sqlx-redis-ws-template\nRust+Axum+Sqlx+Redis+Postgres Web Service Template\n\n## Installation\n\nStart by cloning the repository and navigating into it:\n```bash\ngit clone https://github.com/softwaremill/rust-axum-sqlx-redis-ws-template\ncd rust-axum-sqlx-redis-ws-template\ncargo run\n```\n\nYou should have a compiling project with the following panic message:\n```\n   Compiling bb8-redis v0.17.0\n   Compiling rust-axum-sqlx-redis-ws-template v0.1.0 (/home/lmx/isima/zz2/projet/exemple)\n    Finished `dev` profile [unoptimized + debuginfo] target(s) in 3m 03s\n     Running `target/debug/rust-axum-sqlx-redis-ws-template`\nthread 'main' panicked at src/config.rs:9:58:\nDATABASE_URL must be set: NotPresent\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n```\n\nYou now need to create a `.env` file using this template:\n```bash\ncat \u003c\u003cEOF \u003e .env\nDATABASE_URL=postgres://myuser:mypassword@localhost/mydb\nCACHE_URL=redis://localhost:6379\nEOF\n```\n\nMake sure to replace `myuser` and `mypassword` with your database credentials. If you do not have a database set up, follow this guide:\n\n### Install Redis (for caching)\n```bash\nsudo pacman -S redis\nsudo systemctl start redis\nsudo systemctl enable redis # Auto-start Redis on boot\nredis-cli ping # Check if Redis is running\n```\n\n### Install PostgreSQL\n```bash\nsudo pacman -S postgresql\nsudo -iu postgres initdb -D /var/lib/postgres/data # Initialize database\nsudo systemctl start postgresql\nsudo systemctl enable postgresql # Auto-start PostgreSQL on boot\n```\n\n### Create a Database and User\n```bash\nsudo -iu postgres psql # Open PostgreSQL as superuser\n```\n\n```sql\nSELECT usename FROM pg_user; -- Show existing users\nCREATE USER myuser WITH PASSWORD 'mypassword'; -- Create a new user\n\n\\l -- List databases\nCREATE DATABASE mydb OWNER myuser; -- Create a database\n\n\\c mydb -- Connect to the database\nSELECT nspname, pg_catalog.pg_get_userbyid(nspowner) FROM pg_catalog.pg_namespace WHERE nspname = 'public'; -- Check database permissions\nALTER SCHEMA public OWNER TO myuser; -- Assign ownership to myuser\n\nALTER USER myuser WITH SUPERUSER; -- Grant superuser privileges (optional)\n\nexit\n```\n\n### Run the Application\nYou can now restart the application:\n```bash\ncargo run\n```\n\nYou should see:\n```\n2025-02-08T13:12:59.819320Z  INFO rust_axum_sqlx_redis_ws_template: Connecting to pg: postgres://myuser:mypassword@localhost/mydb\n2025-02-08T13:12:59.819393Z  INFO rust_axum_sqlx_redis_ws_template: Connecting to cache: redis://localhost:6379\n2025-02-08T13:12:59.938547Z DEBUG rust_axum_sqlx_redis_ws_template: listening on 127.0.0.1:3000\n```\n\n### Test the API\nEt voila ! You can now visit http://127.0.0.1:3000/swagger-ui/ to interact with the API.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftwaremill%2Frust-axum-sqlx-redis-ws-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftwaremill%2Frust-axum-sqlx-redis-ws-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftwaremill%2Frust-axum-sqlx-redis-ws-template/lists"}