directus-main — system architecture

Seven workspaces, one real dependency order — not name-based guessing.

Every dependency below was checked against the real Directus project's actual package.json fields before anything was built, not assumed from what a package's name sounds like it should need. That's how packages/constants — not packages/types — turned out to be the actual zero-dependency leaf. See Auth & Request Flow for how app/ actually uses these packages at runtime.

Workspace Dependency Graph

@directus/constants @directus/errors @directus/system-data
↓ workspace:*
stores + errors @directus/stores ↓ workspace:* (stores + errors)
catalog: (vue-router, pinia, vue)
app/
constants + system-data @directus/utils
errors only ↓ workspace:* (errors only)
catalog: (express)
api/

The Six Layers

Complete

packages/constants + packages/errors

  • Both genuine zero-dependency leaves — verified against the real source, not guessed
  • PERMISSION_ACTIONS, LOCAL_AUTH_DRIVER, and a real DirectusError class hierarchy
  • Grow only against real consumers, never speculatively
Type surface done

packages/system-data

  • Another zero-dependency leaf — the real types.ts surface: filters, permissions, collection/field/relation metadata
  • Type-only (expectTypeOf), so 0/0 runtime coverage is correct by design, not a gap
Complete

packages/stores

  • 4 Pinia stores, 20 tests, 100% coverage
  • Depends on @directus/constants for real, wired RBAC/auth-driver vocabulary
In progress

packages/utils

  • toBoolean/toArray done so far, 2 of a real 61-function scope
  • Depends on @directus/constants + @directus/system-data — the first package here to depend on another real package
Live

app/

  • Vite + Vue 3 + Pinia + vue-router, routed and styled
  • Depends on both packages above — the only workspace that needs @directus/stores
In progress

api/

  • Express, a real POST /auth/login, reusing @directus/errors
  • Depends only on @directus/errors — never needed @directus/stores at all

Verify → Deploy

push to main
↓
CI: format → build → lint → lint:style → test CodeQL
↓ CI green triggers workflow_run
Deploy Pages: yarn build → copy app/dist + portfolio.html → GitHub Pages
!

Real CI bug, found and fixed: the workflow originally ran Lint/Test before Build. That passed locally (where a previous yarn build had already left dist/ on disk) but failed on a fresh CI checkout, because packages/stores importing from @directus/constants resolves against dist/index.js — which doesn't exist until Build runs. Fixed by moving Build right after Format, and verified by deleting all local dist/ output and re-running the full suite in the new order before trusting it.