| title | Aura RS Backend |
|---|---|
| emoji | 🦀 |
| colorFrom | red |
| colorTo | gray |
| sdk | docker |
| app_port | 7860 |
| pinned | false |
Zenplay Backend is the Rust API service for the Aura-rs application. It provides authentication, playlist-label management, and YouTube library operations for the React frontend.
The service is built with Axum and Tokio, uses PostgreSQL via sqlx, and is designed to run against a Neon database. It stores user accounts, saved YouTube items, favorite status, and playlist labels inferred from item rows.
- Registers users with
first name,email,username, andpassword - Authenticates users with
email or username + password - Issues JWT-based sessions through an HTTP-only cookie
- Stores YouTube items with:
- original YouTube URL
- normalized YouTube video ID
- custom title
- single playlist label
- favorite flag
- Returns playlist labels by grouping saved items
- Supports playlist label rename by bulk-updating matching rows
- Enforces one saved video per
(user, label, video_id)combination
POST /api/auth/signupPOST /api/auth/loginPOST /api/auth/logoutGET /api/auth/me
GET /api/labelsGET /api/items?view=allGET /api/items?view=favoritesGET /api/items?label=:labelPOST /api/itemsPATCH /api/items/:item_idDELETE /api/items/:item_idPATCH /api/labels/:label/rename
GET /health
idfirst_nameemailusernamepassword_hashcreated_atupdated_at
iduser_idyoutube_urlyoutube_video_idtitlelabelis_favoritecreated_atupdated_at
Playlist labels are not stored in a separate table. A playlist exists only when at least one item is assigned to that label.
- Passwords are hashed with
argon2 - Sessions are signed with JWT and stored in an HTTP-only cookie
- CORS is restricted to the configured frontend origin
- Supported YouTube URL formats are validated and normalized before persistence
- Authenticated routes load the current user from the signed cookie
See .env.example.
Required configuration:
DATABASE_URLJWT_SECRETFRONTEND_ORIGIN
Common runtime configuration:
HOSTPORTRUST_LOGAPP_ENVCOOKIE_SECURE
- Copy
.env.exampleto.env - Set a valid
DATABASE_URL - Start the server:
cargo runOn startup the service:
- loads environment variables
- connects to PostgreSQL
- runs SQL migrations from
migrations/ - starts the HTTP server
-
This backend is intended to be deployed separately from the frontend
-
It is currently designed for private user libraries only
-
Playlist grouping is label-based rather than using a separate playlist table
-
Command for deploying to Hugging Face Spaces:
git push hf master:main