# `PhoenixKit.Modules.Storage.Library`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v2.40.1/lib/modules/storage/schemas/library.ex#L1)

A storage library: a partition of the file store (V202).

Every file, media folder and folder link belongs to exactly one library.
**System** libraries are site-wide and managed by admins; everything that
existed before V202 lives in the default one, **Media**
(`PhoenixKit.Modules.Storage.Libraries.media_uuid/0`). **User** libraries
(V203) belong to a user, are `private`, and may have members
(`PhoenixKit.Modules.Storage.LibraryMember`). A trashed user library may
outlive its owner (`owner_uuid` NULL) until it is purged.

`key_prefix` is the first segment of the object key for files stored in the
library from now on. `nil` keeps the historical layout, which is what Media
uses, so nothing about an existing install's keys changes.

Go through `PhoenixKit.Modules.Storage.Libraries` rather than this schema.

# `t`

```elixir
@type t() :: %PhoenixKit.Modules.Storage.Library{
  __meta__: term(),
  inserted_at: DateTime.t() | nil,
  is_default: boolean(),
  key_prefix: String.t() | nil,
  kind: String.t(),
  name: String.t() | nil,
  owner: term(),
  owner_uuid: UUIDv7.t() | nil,
  settings: map(),
  slug: String.t() | nil,
  trashed_at: DateTime.t() | nil,
  updated_at: DateTime.t() | nil,
  uuid: UUIDv7.t() | nil,
  visibility: String.t()
}
```

# `create_system_changeset`

A new system library: a name, a URL slug and an object-key prefix.

# `create_user_changeset`

A new user library: a name, its owner, a URL slug (unique among the
owner's libraries) and an object-key prefix. Always `private`.

# `rename_changeset`

Renames a library. Its kind, owner and key prefix never change here.

# `slugify`

```elixir
@spec slugify(String.t()) :: String.t()
```

The slug a name gives: lower-case letters and digits, hyphen-separated
(`"Brand Assets 2026"` → `"brand-assets-2026"`). Letters outside ASCII
are dropped with their accents where they have one; a name with nothing
left is `"library"`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
