dog-core
Core traits and utilities for the DogRS ecosystem - a modular Rust framework for building scalable applications
dog-core provides the foundational abstractions that power the DogRS framework: services, hooks, tenant contexts, and storage contracts. It's designed to keep your core logic clean and portable across different adapters and environments.
Features
- Framework-agnostic core - No coupling to specific web frameworks or databases
- Multi-tenant services - Built-in tenant context for SaaS applications
- Service hooks - Before/after/around/error pipelines for cross-cutting concerns
- Storage contracts - Pluggable storage backends without vendor lock-in
- Async-first design - Built for modern async Rust applications
Quick Start
Add to your Cargo.toml:
[]
= "0.1.0"
Basic Service Example
use ;
use async_trait;
use ;
;
Core Concepts
Services
Services implement your business logic through the DogService trait:
Tenant Context
Multi-tenant applications get built-in tenant isolation:
let tenant = new
.with_actor
.with_trace_id;
let result = service.create.await?;
Storage Adapters
Pluggable storage without vendor lock-in:
use ;
Architecture
dog-core follows a clean separation of concerns:
┌─────────────────┐
│ Your App │ ← Business logic
├─────────────────┤
│ dog-axum │ ← HTTP adapter
│ dog-typedb │ ← Database adapter
│ dog-blob │ ← Storage adapter
├─────────────────┤
│ dog-core │ ← Core abstractions
└─────────────────┘
Ecosystem
dog-core works with these adapters:
- dog-axum - Axum web framework integration
- dog-typedb - TypeDB database adapter
- dog-blob - Blob storage infrastructure
- dog-schema - Schema validation utilities
Examples
See the dog-examples/ directory for complete applications:
- music-blobs - Media streaming service
- blog-axum - REST API with CRUD operations
- social-typedb - Social network with TypeDB
- fleet-queue - Fleet management with background jobs
License
MIT OR Apache-2.0
Made by Jitpomi