Skip to content

Repository Overview

Motif is a TypeScript monorepo managed with pnpm workspaces and Turborepo.

motif/
├── apps/
│ └── studio/ # Main authoring UI (Next.js 15)
├── packages/ # Shared libraries
│ ├── schema/ # Canonical types and Zod validation
│ ├── asset-index/ # Pack integrity indexing and auditing
│ ├── audio-engine/ # Sample playback and voice management
│ ├── clip-engine/ # Clip sequencing, transforms, cue scheduling
│ ├── instrument-rack/ # Synth/drum voice management with presets
│ ├── music-theory/ # Scales, chords, motifs, intensity
│ ├── playback-engine/ # Real-time transport, players, mixing, effects
│ ├── scene-mapper/ # Trigger mapping, scene resolution, the Grounded pack
│ ├── runtime-pack/ # Runtime export/import
│ ├── review/ # Summaries and audit helpers
│ ├── ui/ # Shared UI components
│ ├── sample-lab/ # Trim/slice/kit tools + generated-audio ingest lanes
│ ├── score-map/ # World scoring, cue families, catalog-derived library packs
│ ├── automation/ # Lanes, macros, envelopes, capture
│ ├── library/ # Templates, snapshots, branches, favorites, compare
│ └── test-kit/ # Fixtures and test utilities
├── site/ # Landing page + this handbook (Astro + Starlight)
├── examples/ # Example packs and starter content
├── handbook/ # In-repo operating notes (source material for this site)
├── eslint.config.js # Shared ESLint configuration
├── tsconfig.base.json # Shared TypeScript base config
├── turbo.json # Turborepo pipeline configuration
├── vitest.config.ts # Root Vitest configuration
└── pnpm-workspace.yaml
  • Shared types: The @motif-studio/schema package defines all types. Every other package imports from it.
  • Atomic changes: A schema change, a logic change, and a UI change can ship in one commit.
  • Consistent tooling: One ESLint config, one TypeScript base config, one test runner, one CI pipeline.
  • Fast feedback: pnpm build && pnpm lint && pnpm test validates everything.

Each package has a single, clear responsibility:

PackageOwnsDoes Not Own
schemaTypes, Zod schemas, parse/validateBusiness logic, rendering
asset-indexIntegrity checks, duplicate detectionAsset file I/O
audio-engineSample playback, voice managementScene orchestration, mixing
clip-engineClip sequencing, transforms, cuesAudio rendering
instrument-rackSynth/drum voices, presetsAudio DSP
music-theoryScales, chords, motifs, intensityPlayback
playback-engineMixing, effects, renderingComposition
sample-labTrim/slice/kit logic; the generation lane — submitting and retrieving cloud jobs, then ingesting the artifacts (FLAC decode, resample, loudness normalization, WAV masters, GeneratedCueRecords, content-addressed reuse)Generating audio itself; composition; playback
score-mapMotifs, profiles, cue families, derivation; catalog-driven library packs and generation locksPlayback, rendering
automationLanes, macros, envelopes, captureAudio DSP
libraryTemplates, snapshots, branches, favoritesUI, persistence
runtime-packRuntime export/import of packsAuthoring, playback
reviewPack summaries and audit helpersMutation of pack data
uiShared UI componentsApplication state
test-kitFixtures, loader utilitiesApplication tests
ToolVersionPurpose
pnpm10.xPackage management
Turborepo2.xBuild orchestration
TypeScript5.8+Type checking and compilation
Vitest3.2+Unit and integration testing
ESLint9.xLinting
Next.js15.xStudio app framework
Zustand5.xStudio state management
Zod4.xSchema validation