Umbral
Back to plugin directory
US

Umbral Storage

Official by Umbral contributors

static files, media uploads, S3/local backends, processing

official stable

About

One plugin, two jobs that every app needs and nobody wants to hand-roll: serving your compiled static assets, and storing user uploads. Both go through a single pluggable Storage trait — the local filesystem in dev, S3 in prod, the same handler code either way. Declare an ImageField or FileField on a model and you get multipart upload, streaming size caps, background processing behind a concurrency gate, and an access-control hook so private files aren't world-readable by guessing the URL.

Install

cargo add umbral-storage

Wire it up

use umbral::prelude::*;
use umbral_storage::StoragePlugin;

let app = App::builder()
    .database("default", pool)
    .plugin(
        StoragePlugin::new()
            .static_files("/static", "./static")  // compiled CSS/JS
            .media("/media", "./media"),          // user uploads
    )
    .build()?;

Target: let users upload an avatar

Add the field; the admin and forms render an upload widget with a thumbnail, and the file is stored through whichever backend is configured.

#[derive(Model)]
struct Profile {
    #[umbral(primary_key)]
    id: i64,
    avatar: Option<ImageField>,  // multipart upload, thumbnailed
}

What you get

  • One Storage trait: local filesystem in dev, S3 in prod, same code
  • FileField / ImageField model fields with upload widgets
  • Streaming size caps so a huge upload can't exhaust memory
  • Background image processing behind a concurrency gate
  • Access-control hook so private uploads aren't public by URL
  • Static-asset serving in production (no nginx required to start)

Usage

One `StoragePlugin` serves both sides: `.static_files(url, dir)` for compiled assets and `.media(url, dir)` for user uploads. The same `File`/`Image` model fields work against the filesystem in dev and S3 in prod — no handler change.

plugin setup
cargo add umbral-storage

Feature tracker

Per-feature shipping status, recorded in the directory.

7 of 7 shipped
Production static serving shipped Stable

Serve compiled assets with cache headers and ETags.

collectstatic command shipped Stable

Gather every plugin's static dir into one output tree.

Embedded static assets shipped Stable

Serve include_dir bundles for plugin-owned assets.

File and image fields shipped Stable

Model fields for uploaded files with admin/form widgets.

Media access control shipped Beta

Optional access hooks before serving private uploads.

Background media processing shipped Beta

Image processing runs behind a concurrency gate.

S3-compatible backend usable Beta

Feature-gated backend for AWS S3, MinIO, R2, and Spaces.

Compatibility

Declared support per Umbral version and database backend.

No compatibility rows declared yet.

Community notes

0 notes in the discussion thread.

No notes yet. Be the first to share how this plugin works for you.

Reported issues

Bugs and abuse reports filed against this plugin.

Report an issue

No open issues

No issues have been reported against this plugin. Track upstream bugs on the maintainer's tracker, or report a directory problem to the Umbral team.