v1.0.0 — Hexagonal architecture rewrite
All checks were successful
CI / ci (push) Successful in 7m16s
All checks were successful
CI / ci (push) Successful in 7m16s
Restructure the monolithic 252-line main.rs into a 10-crate workspace with clean hexagonal architecture, swappable adapters, and a production- ready deployment pipeline. Backend architecture: - domain: Canvas, Color/Position/PixelUpdate value objects, port traits (CanvasStore, CanvasPersistence, EventBroadcaster), BroadcastEvent - application: use cases (place_pixel, get_state, save/restore snapshot, connect/disconnect), AppState with Arc snapshot cache - config: AppConfig structs + ConfigSource trait - api-types: shared DTOs, event name constants - adapters: config-env, canvas-file, http-axum (rust-embed), socketio, websocket — all behind port traits, swappable via feature flags - server: composition root with graceful shutdown (SIGTERM/SIGINT) Frontend: - Transport abstraction: Socket.IO and native WebSocket via VITE_TRANSPORT - Canvas zoom/pan with mouse wheel, pinch-to-zoom, and +/- buttons - ImageData rendering (~50x faster than fillRect loop) - Touch support, responsive CSS scaling, mobile-friendly layout - OG/Twitter Card meta tags for rich link previews Production: - Docker: musl static build on scratch — 2.73MB image - CI workflows for Gitea and GitHub Actions (fmt, clippy, test, Docker push) - deploy.sh for private registry - 39 unit tests across domain and application - Zero unwraps, zero unsafe, graceful error handling with tracing - Periodic canvas snapshots with rotation, restored on startup - All config via environment variables with typed defaults
This commit is contained in:
72
Cargo.toml
72
Cargo.toml
@@ -1,22 +1,60 @@
|
||||
[package]
|
||||
name = "painter"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
[workspace]
|
||||
members = [
|
||||
"crates/config",
|
||||
"crates/domain",
|
||||
"crates/application",
|
||||
"crates/api-types",
|
||||
"crates/adapters/canvas-file",
|
||||
"crates/adapters/config-env",
|
||||
"crates/adapters/http-axum",
|
||||
"crates/adapters/socketio",
|
||||
"crates/adapters/websocket",
|
||||
"crates/server",
|
||||
]
|
||||
default-members = [
|
||||
"crates/config",
|
||||
"crates/domain",
|
||||
"crates/application",
|
||||
"crates/api-types",
|
||||
"crates/adapters/canvas-file",
|
||||
"crates/adapters/config-env",
|
||||
"crates/adapters/http-axum",
|
||||
"crates/server",
|
||||
]
|
||||
resolver = "2"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[workspace.package]
|
||||
version = "1.0.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
axum = "0.7.5"
|
||||
bincode = "1.3.3"
|
||||
bytes = "1.6.0"
|
||||
chrono = "0.4.38"
|
||||
[workspace.dependencies]
|
||||
config = { path = "crates/config" }
|
||||
domain = { path = "crates/domain" }
|
||||
application = { path = "crates/application" }
|
||||
api-types = { path = "crates/api-types" }
|
||||
canvas-file = { path = "crates/adapters/canvas-file" }
|
||||
config-env = { path = "crates/adapters/config-env" }
|
||||
http-axum = { path = "crates/adapters/http-axum" }
|
||||
socketio = { path = "crates/adapters/socketio" }
|
||||
websocket = { path = "crates/adapters/websocket" }
|
||||
futures = "0.3"
|
||||
|
||||
axum = "0.8.9"
|
||||
dotenv = "0.15.0"
|
||||
memory-stats = "1.1.0"
|
||||
serde = { version = "1.0.201", features = ["derive"] }
|
||||
serde_json = "1.0.117"
|
||||
socketioxide = "0.13.1"
|
||||
tokio = { version = "1.37.0", features = ["full"] }
|
||||
tower-http = { version = "0.5.2", features = ["cors", "fs"] }
|
||||
tower_governor = "0.4.2"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
socketioxide = "0.18.6"
|
||||
thiserror = "2"
|
||||
tokio = { version = "1.37", features = ["full"] }
|
||||
rust-embed = { version = "8", features = ["interpolate-folder-path", "mime-guess"] }
|
||||
tower-http = { version = "0.7.0", features = ["cors"] }
|
||||
tower_governor = "0.8.0"
|
||||
tracing = "0.1.40"
|
||||
tracing-subscriber = "0.3.18"
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
opt-level = "z"
|
||||
codegen-units = 1
|
||||
panic = "abort"
|
||||
strip = true
|
||||
|
||||
Reference in New Issue
Block a user