Drawings and documents used to live wherever the last person saved them — one project's structure never quite matched the next, and there was no consistent way to say "Team Lead can see structural drawings but not invoices."
A consistent, permission-aware folder structure now auto-creates itself for every new project, and holds up cleanly past a few hundred files.
Every project organized differently
Same structure, every single time
Role-aware, versioned, at scale
A firm running bridges, residential, industrial, and administration projects side by side needed one folder structure that made sense for all of them — financial documents, discipline drawings (architectural, structural, electrical, mechanical), and general administration — without forcing every project into a rigid, hand-built hierarchy each time. It also needed to hold up at scale: hundreds of files per project, permission checks on every single one, and staff assignments that change mid-project and need folder access to follow along automatically.
A VirtualFolderTemplate defines the standard BCE structure once — Financial, Discipline (Architecture/Structural/Electrical/Mechanical, each split into In/WIP/Out phases), and Administrative — and every new project gets that whole tree auto-created from the template. Each VirtualFolder is polymorphic, attaching to either a Project or a Client, and carries its own JSON-defined role_access_rules per folder type. Underneath that: a BulkPermissionChecker that preloads assignment data instead of querying per-file, a Celery task pipeline for hashing and folder moves that never blocks the request, and signals that keep folder access in sync the moment a staff assignment changes.
A new project's entire folder tree — Financial, Discipline (4 sub-disciplines × 3 phases), Administrative — is created automatically from the standard BCE template, not built by hand each time.
Each folder links to either a Project or a Client through a generic relation, so the same folder model serves both without duplicating logic.
Every folder type carries its own JSON role-access rules — Financial folders are locked to CEO/Senior/Accountant, Discipline folders stay open to whoever's actually assigned to that work.
Every file upload creates a new version linked to a single root file with an incrementing version number — nothing is ever silently replaced, and SHA-256 hashing runs in the background so it doesn't block the upload.
The parts that only matter once a project has real volume behind it — which, for a firm running since 1970, happens fast.
Folders under 100 files zip straight into memory. Past that, it switches to a temp file on disk automatically — so a big discipline folder download doesn't try to hold everything in RAM at once.
SHA-256 hashing reads large files in 1MB chunks with progress checkpoints every 10MB, a 25-minute soft limit, and exponential-backoff retries on I/O errors — a huge upload can't silently hang a worker.
A BulkPermissionChecker loads every relevant assignment in one query before checking access on a whole folder tree — instead of one query per file, which is what actually falls over at scale.
Folder permissions aren't set once and forgotten — a set of signals keeps them honest every time the underlying reality changes.
The moment a firm has more than a handful of projects, "just organize it sensibly" stops being a plan. Seeding the same structure every time — with the same access rules baked in — means a Team Lead on project #40 finds things exactly where they were on project #4, and nobody has to remember to lock down the financial folder by hand.