Skip to content

Repository Overview

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

motif/
├── apps/ # Deployable applications
│ ├── studio/ # Main authoring UI (Next.js 15)
│ └── docs/ # Documentation site (Astro)
├── 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 playback, mixing, effects
│ ├── scene-mapper/ # Trigger mapping and scene resolution
│ ├── runtime-pack/ # Runtime export/import
│ ├── review/ # Summaries and audit helpers
│ ├── ui/ # Shared UI components
│ ├── sample-lab/ # Trim, slice, kit, instrument helpers
│ ├── score-map/ # World scoring, motifs, profiles, cue families
│ ├── automation/ # Lanes, macros, envelopes, capture
│ ├── library/ # Templates, snapshots, branches, favorites, compare
│ └── test-kit/ # Fixtures and test utilities
├── examples/ # Example packs and starter content
├── handbook/ # Operating manual
├── 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/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, instrument logicAudio file decoding
score-mapMotifs, profiles, cue families, derivationPlayback, rendering
automationLanes, macros, envelopes, captureAudio DSP
libraryTemplates, snapshots, branches, favoritesUI, persistence
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