A Starter Template for Admin Panel Based on Rust and Amis.js/React
English | ็ฎไฝไธญๆ
- Provide a quick starting point for building admin systems
- Use a modern Rust + Amis.js/React technology stack
- Follow Domain-Driven Design (DDD) and Clean Architecture principles
Since the free plan of
Render
is used, access may be slow. The instance will freeze after 15 minutes of inactivity, and subsequent access will go throughRender
โs interstitial page. Please be aware.
https://oxide-admin.onrender.com/_
Please do not modify the password.
- Account:
admin
- Password:
123456
- DDD: Separation of adapter (presentation), application services, domain models, and infrastructure layers.
- CQRS: Lightweight CQRS built-in, supporting read/write separation.
- PostgreSQL: Integrated
PostgreSQL
, based onsqlx
. - Event Bus: Built-in event system to decouple business logic via domain events.
- Dependency Injection: Supported by
nject
. - Code Generation: One-click generation of module code such as
CRUD
,CommandHandler
,QueryHandler
, etc. - Timezone Config: Configurable for database and scheduled jobs.
- Comprehensive coverage: complete unit test/integration test;
- API Docs: Generated using
utoipa
, available at/scalar
, configurable to disable. - Authentication: JWT-based with
refresh_token
andaccess_token
issuance, validation, and refresh. - Authorization: Built-in RBAC for flexible menu and API permission control.
- DB Auto Migration: No manual migrations required during deployment.
- Rate Limiting Middleware: Route-level rate limiting.
- Captcha: Prevent brute force and malicious requests.
- Logging & Tracing: Multiple logging options, supports
OpenTelemetry
. - Built-in
single_flight
macro: Reduce DB load. - File Upload & Access Signature: APIs for single file, image, and chunked upload; supports
local FS
andS3-compatible
storage. - KV Cache: With TTL support, via
redis
ormoka
. - Background Tasks: Single-node via
sqlite
, distributed viapostgres
. - Scheduled Task: Supports embedded execution or separate execution.
- Graceful Shutdown: Properly terminates services and releases resources.
- Multi-Source Config: Supports env vars,
.env
, and CLI args. - Feature Flags: Supports
flipt
. - I18n: Supports
i18n
usingfluent
. both frontend and backend are supported. - Github CI: Auto build for
x86_64-unknown-linux-gnu
. - Docker Image: Provides a
Dockerfile
for containerized deployment.
Feature | Name | Notes | Enabled by Default |
---|---|---|---|
Postgres tls | postgres_tls | Enable tls | |
KV Storage (choose one only) | kv_redb | Use redb as kv/cache, suitable for monolithic projects | โ |
kv_redis | Use redis as kv/cache, suitable for distributed projects | ||
kv_redis_tls | Use redis as kv/cache with TLS enabled | ||
Background Tasks (choose one only) | bg_sqlite | Use sqlite for background tasks, suitable for monolithic projects | |
bg_postgres | Use postgres for background tasks, suitable for distributed projects | โ | |
Cache (choose one only) | cache_moka | Use moka for cache, suitable for monolithic projects | โ |
cache_redis | Use redis for cache, suitable for distributed projects | ||
Scheduled Tasks | serve_with_sched | Embed scheduled tasks in web server process (single-node). When disabled, can run separately via `server sched` (distributed). | โ |
Object Storage (choose one only) | object_storage_fs | Use local filesystem | โ |
object_storage_s3 | Use S3-compatible service as object storage | ||
object_storage_s3_tls | Use S3-compatible service with TLS enabled | ||
Logging & Trace (multiple options allowed) | trace_console | Log output to console | โ |
trace_rolling | Rolling logs in JSON format | ||
trace_otlp | Integrate with OpenTelemetry, suitable for distributed projects | ||
trace_otlp_tls | Integrate with OpenTelemetry with TLS enabled | ||
Feature Flags (choose one only) | flag_flipt | Use flipt as feature flag, suitable for distributed projects |
Modify in
bin/server/Cargo.toml
.
- Architecture: Powered by
Amis.js
low-code with rich components for fast CRUD, extendable with React custom components. - Optimization: Auto obfuscation, gzip compression (brotli optional) at build time.
- Embedding: Static assets embedded into binaries.
- Backend: Rust + Axum + Nject + SQLx + Postgres
- Frontend: Amis.js + React + TypeScript + Rsbuild
- Tools: just + Bun
oxide_admin/
โโโ app/ # Rust backend
โ โโโ adapter/ # API layer (REST endpoints)
โ โโโ application/ # Application layer (use cases/services)
โ โโโ domain/ # Domain layer (entities/value objects)
โ โโโ infrastructure/ # Infrastructure layer (technical details)
โ โโโ port/ # Domain implementations
โ โโโ migration/ # Database migrations
โ โโโ repository/ # Repository implementations
โโโ frontend/ # Frontend app
โโโ target/ # Build output
โโโ Cargo.toml # Workspace config
Strictly follows DDD design principles to ensure maintainability and scalability.
Please ensure that you have installed Rust and Bun, as well as just.
git clone git@github.com:shmy/oxide_admin.git
cd oxide_admin
# start a postgres
docker compose up -d
# setup env
cp .env.example .env
# install sqlx-cli & cargo-watch
cargo install sqlx-cli cargo-watch
# setup sqlx migration
just setup
just dev
The backend listens on
127.0.0.1:8080
by default, and the frontend will have adev server
to proxy;
cd frontend
bun install
bun run dev
Access
http://127.0.0.1:3000/_
- Local Architecture:
just build
- Cross Compilation:
Linux/x86_64-unknown-linux-musl
Ensure that
cross
is installed, usecargo install cross
to install.
just build_linux_x86_64_musl
- Cross Compilation:
Windows/x86_64-pc-windows-msvc
Ensure that
xwin
is installed, usecargo install cargo-xwin
to install.
just build_windows_x86_64_msvc
- Build Docker image
just build_image
Install the following tools
cargo install cargo-llvm-cov
cargo install cargo-nextest
cargo install hurl
just test
just test_coverage
cargo g scaffold -h
cargo g -h