Folder structure for Media
Opened by @rchlfryn · Assignees: None
Solve & Merge Reward: Up to +210 XP & +60 Coins
+30 XP on PR open · +180 XP & +60 coins on merge
Claim Status & GitHub Signal
Unassigned, with 4 comments. Unassigned does not guarantee unclaimed—read comments and linked PRs first.
Estimated from issue labels (enhancement, good first issue, ready-for-agent), TypeScript context, and discussion depth. There are 4 GitHub comments to review for maintainer clarifications. Note: this is an estimate, not a guarantee.
What It's About
Folder structure for Media. In our initial overview with SAC, it was mentioned there might be a need for adding folder structure to Media. (ie: Bios/ , BlogImages/)
Why It Matters
Resolving #307 improves reliability and developer experience in NWACus/web.
Expected Outcome
A focused pull request addressing #307 with relevant checks or tests verified locally.
Log in to compare this issue's requirements against your profile skills. Required concepts: TypeScript, SQL & Databases.
Progressive AI Hints
Hint #1 is always free and calibrated to your experience level. Extra hints unlock with coins without spoiling the full solution.
Skill-Gap Learning
Relational modeling, joins, constraints, and query optimization.
Addresses skill gap: SQL & Databases
Strong typing, interfaces, generics, and safer JavaScript/TypeScript code.
Addresses skill gap: TypeScript
Issue Description
In our initial overview with SAC, it was mentioned there might be a need for adding folder structure to Media. (ie: Bios/ , BlogImages/)
Linked Pull Requests (0)
No linked or cross-referenced pull requests detected via GitHub timeline. Check comments below for informal claims before starting.
GitHub Comments (4)
@rustynwac -- this functionality actually just got into Payload core. We'll need to upgrade to the latest version and it's still pretty new / seems to have some minor bugs that are getting fixed.
So we can turn this on pretty easily but I don't think it's necessary for launch but let me know if you think otherwise.
If it is really easy, I would love to turn this on to build the media organization structure as we load content. It seems like that will be easier than organizing all the media afterwards.
If it is really easy, I would love to turn this on to build the media organization structure as we load content. It seems like that will be easier than organizing all the media afterwards.
Seems reasonable to add this to me. I'd like to wait until https://github.com/NWACus/web/pull/571 is merged and then we can play around with this more and see what the implications are to the UI.
This was generated by AI during triage.
Agent Brief
Category: enhancement Summary: Enable Payload's native folder organization on the Media collection, scoped per-tenant.
Current behavior:
The Media collection (slug media) presents a flat, tenant-filtered list with no way to group assets into folders. Payload (currently 3.81.0) ships native folder support, but it is entirely off here — there is no top-level folders config and no folders option on any collection.
Desired behavior:
Editors can organize media into folders in the admin, and folders are strictly tenant-scoped — a user in one avalanche center only sees and assigns folders belonging to their own tenant. This scoping is the crux of the issue: Payload auto-creates a single global folders collection (default slug payload-folders) that has no tenant field and is not covered by the existing tenant list filter, so simply flipping the feature on would let every tenant see and reassign every other tenant's folders — a data-isolation bug that must not ship.
Key interfaces:
- Enable
folders: trueon the MediaCollectionConfig. - Add the top-level
foldersconfig to the Payload config. Note this root config is marked experimental upstream ("may change in minor versions") — call it out in the PR. Use itscollectionOverrideshook to inject the tenant relationship field, the tenant list filter, and tenant-aware RBAC access into the generated folders collection, mirroring how every other tenant-scoped collection is assembled (the repo'stenantField()+filterByTenantbase-list-filter pattern; the home-grown tenancy layer, not@payloadcms/plugin-multi-tenant). - Add the generated folders collection's slug to the tenant deprovision hook's list of tenant-scoped collections so folders cascade-delete with their tenant (avoids SQLite FK errors on tenant deletion).
- Schema change → generate a migration (SQLite adapter) and run
pnpm generate:types.
Acceptance criteria:
- Media documents can be placed into and moved between folders in the admin UI.
- A user in tenant A cannot see, select, or assign a folder created under tenant B.
- Deleting a tenant removes its folders with no foreign-key errors.
- A migration is generated and
pnpm migrate:checkpasses. -
pnpm generate:typeshas been run and folder types are present;pnpm seed:standalonecompletes.
Out of scope:
- Enabling folders on any collection other than Media (Documents is the obvious follow-up but is a separate issue).
- Migrating/auto-sorting existing media into folders.
- Any change to the public-facing frontend — this is admin-only organization.
Issue Troubleshooting Threads (0)
No troubleshooting threads opened for this issue yet. If you hit a test, build, or navigation blocker, post what you've tried so fellow contributors can help.
PR Verification & Rewards
Sign in and link GitHub to verify your PR against this issue and earn XP + coins.
Contribution Workflow
Track your local progress before opening a pull request on GitHub.
Repository Context
Top Repository Paths
Advisory PR Assistant
Helps structure your PR description or unpack reviewer feedback. Does not perform GitHub actions.