chore: initial project scaffold
Set up Mangalord with a Rust/axum backend, SvelteKit frontend, Postgres, and Docker Compose deployment. Establishes the architecture and TDD patterns the project will extend: - Hexagonal-ish backend layering (domain / repo / storage / api) with a pluggable Storage trait (LocalStorage today, S3 as a future impl). - Initial migration: users, mangas, chapters, bookmarks. - Vertical slice for mangas (list, search, create, get) with #[sqlx::test] integration coverage and storage unit tests. - SvelteKit frontend using Svelte 5 runes, typed API client, Vitest unit tests and Playwright e2e with route mocking. - CLAUDE.md documenting layering, TDD/git/SemVer workflow rules, and extension points (tags, fulltext search, OCR, S3, auth). - Project-scoped .claude/settings.json with permission allowlist for the toolchain (git, cargo, npm/vite, docker, psql, gh, doc fetches). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
31
backend/src/storage/mod.rs
Normal file
31
backend/src/storage/mod.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
//! Pluggable blob storage.
|
||||
//!
|
||||
//! Handlers depend on the `Storage` trait, never on a concrete backend.
|
||||
//! Add new backends (S3, GCS, …) as new impls in this module and wire
|
||||
//! them up in `app::build` based on config.
|
||||
|
||||
mod local;
|
||||
|
||||
use std::io;
|
||||
|
||||
use async_trait::async_trait;
|
||||
|
||||
pub use local::LocalStorage;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum StorageError {
|
||||
#[error(transparent)]
|
||||
Io(#[from] io::Error),
|
||||
#[error("not found")]
|
||||
NotFound,
|
||||
#[error("invalid storage key")]
|
||||
BadKey,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
pub trait Storage: Send + Sync {
|
||||
async fn put(&self, key: &str, bytes: &[u8]) -> Result<(), StorageError>;
|
||||
async fn get(&self, key: &str) -> Result<Vec<u8>, StorageError>;
|
||||
async fn delete(&self, key: &str) -> Result<(), StorageError>;
|
||||
async fn exists(&self, key: &str) -> Result<bool, StorageError>;
|
||||
}
|
||||
Reference in New Issue
Block a user