Director's Palette is built with a modern Next.js architecture using server actions for AI operations and client-side state management with Zustand.
- Server Actions: All AI operations (
/app/actions/) - Client Components: UI and interaction (
/components/) - State Management: Zustand stores (
/stores/) - Business Logic: Service layer (
/services/)
All server actions are exported through a single point of entry:
// app/actions/index.ts
export {
// Story actions
extractStoryReferences,
generateStoryBreakdownWithReferences,
// Music video actions
extractMusicVideoReferences,
generateMusicVideoBreakdownWithReferences,
// ... etc
} from './respective-modules'StoryContainer
├── StoryInput (input collection)
├── StoryWorkflow (reference extraction & config)
└── StoryMode (results display)
MusicVideoContainer
├── MusicVideoInput (input collection)
├── MusicVideoWorkflow (reference extraction & config)
└── MusicVideoMode (results display)
app-store.ts- Global app state (loading, errors)story-store.ts- Story mode specific statemusic-video-store.ts- Music video specific statestory-workflow-store.ts- Story workflow statemusic-video-workflow-store.ts- Music video workflow stateworkflow-coordinator.ts- Coordinates shared workflow states
- User input → Component state
- Generation trigger → Workflow store
- Server action → AI service
- Response → Mode store
- UI update → Component render
extractReferences(content) → {
locations: [],
characters/wardrobe: [],
props: [],
themes: []
}- Inline configuration UI
- User edits references
- Adds visual themes
generateBreakdown(configuredRefs) → {
sections/chapters: [],
shots: [],
treatments: []
}{
isConfigured: true, // MUST be true for shot generation
locations: [],
wardrobe: [],
props: [],
visualThemes: [] // Optional but recommended
}- Retry logic with exponential backoff
- Fallback to text parsing on schema failures
- Comprehensive error messages
- Error boundaries for component failures
- Toast notifications for user feedback
- Loading states during operations
- Component code splitting
- Lazy loading for heavy components
- Session persistence with localStorage
- Parallel API calls where possible
- Caching of director profiles
- Optimized prompt templates
interface SavedProject {
id: string
name: string
updatedAt: Date
isMusicVideoMode: boolean
// Mode-specific data...
}- Server-side API key validation
- Input sanitization
- Rate limiting on AI calls
- No client-side secrets
- Build Configuration: ESLint errors ignored in production
- No Test Coverage: Test suite not fully implemented
- Type Safety: Some components use
anytypes - Performance: No code splitting for initial bundle