feat: Add initial project structure and dependencies

This commit introduces the foundational elements of the project:
- `.gitignore` file to exclude build artifacts and environment
  variables.
- `Cargo.lock` and `Cargo.toml` defining project dependencies and
  metadata.
- `diesel.toml` for Diesel CLI configuration.
- Initial migration files (`down.sql`, `up.sql`) for database schema
  setup.
- `rustfmt.toml` for code formatting.
- Basic module structure for database, routes, schema, state, and types.
- `src/main.rs` with basic Axum server setup and dotenv loading.
- `src/routes/system_router.rs` for basic API endpoint.
- `src/state.rs` for managing application state and database connection
  pool.
- Type definitions for Subsonic API responses and extensions.
This commit is contained in:
vaibhav
2026-02-11 04:21:56 +05:30
parent a0c3f5b502
commit 9bf9a2296e
20 changed files with 1424 additions and 0 deletions

27
src/main.rs Normal file
View File

@@ -0,0 +1,27 @@
mod db;
mod routes;
mod schema;
mod state;
mod types;
use std::env;
use axum::Router;
use dotenvy::dotenv;
use crate::routes::system_router::system_routers;
use crate::state::AppState;
#[tokio::main]
async fn main() {
dotenv().ok();
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let state = AppState::new(&database_url)
.unwrap_or_else(|_| panic!("Error creating pool for {}", database_url));
tracing_subscriber::fmt::init();
let app = Router::new()
.nest("/rest", system_routers())
.with_state(state);
let listener = tokio::net::TcpListener::bind("0.0.0.0:3311").await.unwrap();
let _ = axum::serve(listener, app).await;
}