# Shrine

> File Attachment toolkit for Ruby applications

Source: https://talira.ai/catalog/shrine-178m6tsb
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / file uploads](https://talira.ai/categories/libraries/file-uploads), [languages / ruby](https://talira.ai/categories/languages/ruby)
- Platforms: linux, macos, windows
- Licence: MIT
- Pricing: Free and open source
- Free tier: yes
- Self-hostable: yes
- Plugins: yes
- Creator: Janko Marohnić (janko), also author of rodauth-rails

Shrine is a toolkit for handling file uploads and attachments in Ruby applications, built from plugins so an app loads only what it needs. It streams uploads and downloads for large files, stores files on disk, S3, Google Cloud Storage, Cloudinary and others, and integrates with Active Record, Sequel, ROM, Hanami and Mongoid. It supports direct and resumable uploads with Uppy (S3 presigned, S3 multipart, tus), eager or on-the-fly processing with [ImageMagick](https://talira.ai/catalog/imagemagick-yw9v07z4.md) or libvips, metadata extraction and validation, and background processing with any job library. Unlike Active Storage it does not depend on Rails.

## Links

- Website: https://shrinerb.com
- GitHub: https://github.com/shrinerb/shrine
- Docs: https://shrinerb.com/docs/getting-started

## Problems it solves

- let users upload files straight to S3 from the browser without going through my Ruby server
- handle file attachments in a Sinatra, Roda or Hanami app that doesn't use Rails
- large video uploads keep failing halfway and need to be resumable
- generate image thumbnails on the fly instead of up front
- move image processing for uploads into background jobs
- Active Storage doesn't fit how we want to store attachment metadata on our own table
- validate uploaded files by real MIME type, size and image dimensions
- file uploads load the whole file into memory and the server runs out of RAM
- keep an uploaded file when the form fails validation and is shown again
- attach files to Sequel or ROM models
- replace a deprecated Paperclip setup in an old Rails app

## Features

- plugin system
- streaming uploads and downloads
- storages: file system, S3, Google Cloud Storage, Cloudinary and more
- ORM plugins: Active Record, Sequel, ROM, Hanami, Mongoid
- eager and on-the-fly processing (derivatives)
- ImageMagick or libvips via image_processing
- metadata extraction and validation
- direct uploads to the app or to cloud storage with Uppy
- resumable uploads (S3 multipart, tus)
- background processing with any job library

## Capabilities

- Takes plugins: plan not known

## Trust

Overall: 0.57 out of 1.
Signals: maintenance 0.73, adoption 0.70, momentum 0.43, community 0.83, backing 0.20, extensibility 0.20.

- last commit 19 days ago
- 19 commits in the last 90 days
- 3.3k GitHub stars
- 120 contributors
- created by Janko Marohnić (janko), also author of rodauth-rails
- has a plugin system

## Alternatives

- [CarrierWave](https://talira.ai/catalog/carrierwave-9wx59p5e.md): Classier solution for file uploads for Rails, Sinatra and other Ruby web frameworks
- [Paperclip](https://talira.ai/catalog/paperclip-spqbrsep.md): The app people use to manage AI agents for work
- [Dragonfly](https://talira.ai/catalog/dragonfly-anqs23rc.md): The world's most efficient in-memory data store
