feat(api): implement user authentication and registration endpoints

- Add main application logic in `api/src/main.rs` to initialize server, database, and services.
- Create authentication routes in `api/src/routes/auth.rs` for login, register, logout, and user info retrieval.
- Implement configuration route in `api/src/routes/config.rs` to expose application settings.
- Define application state management in `api/src/state.rs` to share user service and configuration.
- Set up Docker Compose configuration in `compose.yml` for backend, worker, and database services.
- Establish domain logic in `domain` crate with user entities, repositories, and services.
- Implement SQLite user repository in `infra/src/user_repository.rs` for user data persistence.
- Create database migration handling in `infra/src/db.rs` and session store in `infra/src/session_store.rs`.
- Add necessary dependencies and features in `Cargo.toml` files for both `domain` and `infra` crates.
This commit is contained in:
2026-01-02 13:07:09 +01:00
parent 7dbdf3f00b
commit 1d141c7a97
27 changed files with 208 additions and 130 deletions

138
Cargo.lock generated
View File

@@ -32,6 +32,37 @@ version = "1.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
[[package]]
name = "api"
version = "0.1.0"
dependencies = [
"anyhow",
"async-trait",
"axum",
"axum-login",
"chrono",
"config",
"domain",
"dotenvy",
"infra",
"k-core",
"password-auth",
"serde",
"serde_json",
"sqlx",
"thiserror 2.0.17",
"time",
"tokio",
"tower",
"tower-http",
"tower-sessions",
"tower-sessions-sqlx-store",
"tracing",
"tracing-subscriber",
"uuid",
"validator",
]
[[package]]
name = "argon2"
version = "0.5.3"
@@ -558,6 +589,22 @@ dependencies = [
"const-random",
]
[[package]]
name = "domain"
version = "0.1.0"
dependencies = [
"anyhow",
"async-trait",
"chrono",
"futures-core",
"serde",
"serde_json",
"thiserror 2.0.17",
"tokio",
"tracing",
"uuid",
]
[[package]]
name = "dotenvy"
version = "0.15.7"
@@ -1125,6 +1172,28 @@ dependencies = [
"hashbrown 0.16.1",
]
[[package]]
name = "infra"
version = "0.1.0"
dependencies = [
"async-nats",
"async-trait",
"chrono",
"domain",
"futures-core",
"futures-util",
"k-core",
"serde",
"serde_json",
"sqlx",
"thiserror 2.0.17",
"tokio",
"tower-sessions",
"tower-sessions-sqlx-store",
"tracing",
"uuid",
]
[[package]]
name = "itoa"
version = "1.0.17"
@@ -2401,75 +2470,6 @@ dependencies = [
"syn",
]
[[package]]
name = "template-api"
version = "0.1.0"
dependencies = [
"anyhow",
"async-trait",
"axum",
"axum-login",
"chrono",
"config",
"dotenvy",
"k-core",
"password-auth",
"serde",
"serde_json",
"sqlx",
"template-domain",
"template-infra",
"thiserror 2.0.17",
"time",
"tokio",
"tower",
"tower-http",
"tower-sessions",
"tower-sessions-sqlx-store",
"tracing",
"tracing-subscriber",
"uuid",
"validator",
]
[[package]]
name = "template-domain"
version = "0.1.0"
dependencies = [
"anyhow",
"async-trait",
"chrono",
"futures-core",
"serde",
"serde_json",
"thiserror 2.0.17",
"tokio",
"tracing",
"uuid",
]
[[package]]
name = "template-infra"
version = "0.1.0"
dependencies = [
"async-nats",
"async-trait",
"chrono",
"futures-core",
"futures-util",
"k-core",
"serde",
"serde_json",
"sqlx",
"template-domain",
"thiserror 2.0.17",
"tokio",
"tower-sessions",
"tower-sessions-sqlx-store",
"tracing",
"uuid",
]
[[package]]
name = "thiserror"
version = "1.0.69"