Skip to content

Commit 2d834a4

Browse files
committed
Merge branch 'staging'
2 parents 792fb6c + a7d90f7 commit 2d834a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2457
-1427
lines changed

.cursor/rules/ultracite.mdc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,13 @@ Ultracite enforces strict type safety, accessibility standards, and consistent c
4242
- Don't insert comments as text nodes.
4343
- Use `<>...</>` instead of `<Fragment>...</Fragment>`.
4444

45+
### Function Parameters and Props
46+
- Always use destructured props objects instead of individual parameters in functions.
47+
- Example: `function helloWorld({ prop }: { prop: string })` instead of `function helloWorld(param: string)`.
48+
- This applies to all functions, not just React components.
49+
4550
### Correctness and Safety
4651
- Don't assign a value to itself.
47-
- Use props instead of parameters in all functions.
4852
- Avoid unused imports and variables.
4953
- Don't use await inside loops.
5054
- Don't hardcode sensitive data like API keys and tokens.
@@ -86,4 +90,4 @@ try {
8690
} catch (e) {
8791
console.log(e);
8892
}
89-
```
93+
```

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ node_modules
2929
# cursor
3030
bun.lockb
3131
apps/transcription/__pycache__
32-
apps/transcription/env
32+
apps/transcription/env
33+
34+
apps/bg-remover/env

CLAUDE.md

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
OpenCut is a free, open-source video editor built with Next.js, focusing on privacy (no server processing), multi-track timeline editing, and real-time preview. The project is a monorepo using Turborepo with multiple apps including a web application, desktop app (Tauri), background remover tools, and transcription services.
8+
9+
## Essential Commands
10+
11+
**Development:**
12+
```bash
13+
# Root level development
14+
bun dev # Start all apps in development mode
15+
bun build # Build all apps
16+
bun lint # Lint all code using Ultracite
17+
bun format # Format all code using Ultracite
18+
19+
# Web app specific (from apps/web/)
20+
cd apps/web
21+
bun run dev # Start Next.js development server with Turbopack
22+
bun run build # Build for production
23+
bun run lint # Run Biome linting
24+
bun run lint:fix # Fix linting issues automatically
25+
bun run format # Format code with Biome
26+
27+
# Database operations (from apps/web/)
28+
bun run db:generate # Generate Drizzle migrations
29+
bun run db:migrate # Run migrations
30+
bun run db:push:local # Push schema to local development database
31+
bun run db:push:prod # Push schema to production database
32+
```
33+
34+
**Testing:**
35+
- No unified test commands are currently configured
36+
- Individual apps may have their own test setups
37+
38+
## Architecture & Key Components
39+
40+
### State Management
41+
The application uses **Zustand** for state management with separate stores for different concerns:
42+
- **editor-store.ts**: Canvas presets, layout guides, app initialization
43+
- **timeline-store.ts**: Timeline tracks, elements, playback state
44+
- **media-store.ts**: Media files and asset management
45+
- **playback-store.ts**: Video playback controls and timing
46+
- **project-store.ts**: Project-level data and persistence
47+
- **panel-store.ts**: UI panel visibility and layout
48+
- **keybindings-store.ts**: Keyboard shortcut management
49+
- **sounds-store.ts**: Audio effects and sound management
50+
- **stickers-store.ts**: Sticker/graphics management
51+
52+
### Storage System
53+
**Multi-layer storage approach:**
54+
- **IndexedDB**: Projects, saved sounds, and structured data
55+
- **OPFS (Origin Private File System)**: Large media files for better performance
56+
- **Storage Service** (`lib/storage/`): Abstraction layer managing both storage types
57+
58+
### Editor Architecture
59+
**Core editor components:**
60+
- **Timeline Canvas**: Custom canvas-based timeline with tracks and elements
61+
- **Preview Panel**: Real-time video preview (currently DOM-based, planned binary refactor)
62+
- **Media Panel**: Asset management with drag-and-drop support
63+
- **Properties Panel**: Context-sensitive element properties
64+
65+
### Media Processing
66+
- **FFmpeg Integration**: Client-side video processing using @ffmpeg/ffmpeg
67+
- **Background Removal**: Python-based tools with multiple AI models (U2Net, SAM, Gemini)
68+
- **Transcription**: Separate service for audio-to-text conversion
69+
70+
## Development Focus Areas
71+
72+
**✅ Recommended contribution areas:**
73+
- Timeline functionality and UI improvements
74+
- Project management features
75+
- Performance optimizations
76+
- Bug fixes in existing functionality
77+
- UI/UX improvements outside preview panel
78+
- Documentation and testing
79+
80+
**⚠️ Areas to avoid (pending refactor):**
81+
- Preview panel enhancements (fonts, stickers, effects)
82+
- Export functionality improvements
83+
- Preview rendering optimizations
84+
85+
**Reason:** The preview system is planned for a major refactor from DOM-based rendering to binary rendering for consistency with export and better performance.
86+
87+
## Code Quality Standards
88+
89+
**Linting & Formatting:**
90+
- Uses **Biome** for JavaScript/TypeScript linting and formatting
91+
- Extends **Ultracite** configuration for strict type safety and AI-friendly code
92+
- Comprehensive accessibility (a11y) rules enforced
93+
- Zero configuration approach with subsecond performance
94+
95+
**Key coding standards from Ultracite:**
96+
- Strict TypeScript with no `any` types
97+
- No React imports (uses automatic JSX runtime)
98+
- Comprehensive accessibility requirements
99+
- Use `for...of` instead of `Array.forEach`
100+
- No TypeScript enums, use const objects
101+
- Always include error handling with try-catch
102+
103+
## Environment Setup
104+
105+
**Required environment variables (apps/web/.env.local):**
106+
```bash
107+
# Database
108+
DATABASE_URL="postgresql://opencut:opencutthegoat@localhost:5432/opencut"
109+
110+
# Authentication
111+
BETTER_AUTH_SECRET="your-generated-secret-here"
112+
BETTER_AUTH_URL="http://localhost:3000"
113+
114+
# Redis
115+
UPSTASH_REDIS_REST_URL="http://localhost:8079"
116+
UPSTASH_REDIS_REST_TOKEN="example_token"
117+
118+
# Content Management
119+
MARBLE_WORKSPACE_KEY="workspace-key"
120+
NEXT_PUBLIC_MARBLE_API_URL="https://api.marblecms.com"
121+
```
122+
123+
**Docker services:**
124+
```bash
125+
# Start local database and Redis
126+
docker-compose up -d
127+
```
128+
129+
## Project Structure
130+
131+
**Monorepo layout:**
132+
- `apps/web/` - Main Next.js application
133+
- `apps/desktop/` - Tauri desktop application
134+
- `apps/bg-remover/` - Python background removal tools
135+
- `apps/transcription/` - Audio transcription service
136+
- `packages/` - Shared packages (auth, database)
137+
138+
**Web app structure:**
139+
- `src/components/` - React components organized by feature
140+
- `src/stores/` - Zustand state management
141+
- `src/hooks/` - Custom React hooks
142+
- `src/lib/` - Utility functions and services
143+
- `src/types/` - TypeScript type definitions
144+
- `src/app/` - Next.js app router pages and API routes
145+
146+
## Common Patterns
147+
148+
**Error handling:**
149+
```typescript
150+
try {
151+
const result = await processData();
152+
return { success: true, data: result };
153+
} catch (error) {
154+
console.error('Operation failed:', error);
155+
return { success: false, error: error.message };
156+
}
157+
```
158+
159+
**Store usage:**
160+
```typescript
161+
const { tracks, addTrack, updateTrack } = useTimelineStore();
162+
```
163+
164+
**Media processing:**
165+
```typescript
166+
import { processVideo } from '@/lib/ffmpeg-utils';
167+
const processedVideo = await processVideo(inputFile, options);
168+
```

apps/web/src/app/editor/[project_id]/page.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ import {
66
ResizablePanelGroup,
77
ResizablePanel,
88
ResizableHandle,
9-
} from "../../../components/ui/resizable";
10-
import { MediaPanel } from "../../../components/editor/media-panel";
11-
import { PropertiesPanel } from "../../../components/editor/properties-panel";
12-
import { Timeline } from "../../../components/editor/timeline";
13-
import { PreviewPanel } from "../../../components/editor/preview-panel";
14-
import { EditorHeader } from "@/components/editor-header";
9+
} from "@/components/ui/resizable";
10+
import { MediaPanel } from "@/components/editor/media-panel";
11+
import { PropertiesPanel } from "@/components/editor/properties-panel";
12+
import { Timeline } from "@/components/editor/timeline";
13+
import { PreviewPanel } from "@/components/editor/preview-panel";
14+
import { EditorHeader } from "@/components/editor/editor-header";
1515
import { usePanelStore } from "@/stores/panel-store";
1616
import { useProjectStore } from "@/stores/project-store";
17-
import { EditorProvider } from "@/components/editor-provider";
17+
import { EditorProvider } from "@/components/providers/editor-provider";
1818
import { usePlaybackControls } from "@/hooks/use-playback-controls";
19-
import { Onboarding } from "@/components/onboarding";
19+
import { Onboarding } from "@/components/editor/onboarding";
2020

2121
export default function Editor() {
2222
const {

0 commit comments

Comments
 (0)