Repository Overview
CAPlayground is a monorepo containing the web application and related packages.Web Application Structure
The main application is located inapps/web/:
Key Directories
app/ - Pages and Routes
Next.js App Router pages:
User-facing pages:
app/page.tsx- Homepageapp/dashboard/page.tsx- User dashboardapp/projects/page.tsx- Project editorapp/wallpapers/page.tsx- Community wallpapers
app/signin/page.tsx- Sign inapp/account/page.tsx- Account settingsapp/forgot-password/page.tsx- Password reset
app/api/account/delete/route.ts- Account deletion- Other API endpoints as needed
components/ - React Components
Editor components (components/editor/):
editor-context.tsx- Main editor state managementlayers-panel.tsx- Layers list and managementcanvas-preview.tsx- Visual canvas previewsettings-panel.tsx- Editor settingsstates-panel.tsx- State transitions panelinspector/- Property inspector components
components/ui/):
- Built with shadcn/ui
- Reusable components (Button, Card, Dialog, etc.)
- Follows shadcn/ui conventions
lib/ - Core Logic
Core Animation (lib/ca/):
types.ts- TypeScript types for layers, projects, animations- Core Animation data structures
- Export/import logic
lib/supabase/):
- Supabase client configuration
- Authentication helpers
- Database queries
lib/utils.ts):
- Helper functions
- Common utilities
hooks/ - Custom Hooks
Custom React hooks for:
- Local storage
- Editor state
- Authentication
- And more
Core Animation System
The Core Animation system is the heart of CAPlayground:Layer Types
Defined inlib/ca/types.ts:
TextLayer- Text contentShapeLayer- Geometric shapesImageLayer- ImagesGradientLayer- Color gradientsVideoLayer- Animated videosEmitterLayer- Particle effectsGroupLayer- Layer containers
Project Structure
A CAPlayground project (CAProjectBundle) contains:
project- Project metadata (name, dimensions, etc.)root- Root layer (can be a group with children)assets- Embedded images, videos, etc.states- List of states (Base, Locked, Unlock, Sleep)stateOverrides- Property overrides per statestateTransitions- Transition configurations
Export Formats
- .CA - CAPlayground project format (JSON)
- .tendies - iOS wallpaper format (for PocketPoster/Nugget)
Editor Architecture
State Management
The editor uses React Context for state management:EditorContext (components/editor/editor-context.tsx):
- Manages the entire project state
- Provides actions for modifying layers
- Handles undo/redo
- Manages state transitions
addTextLayer(),addImageLayer(), etc.updateLayer()- Update layer propertiesdeleteLayer()- Remove a layerselectLayer()- Select a layermoveLayer()- Reorder layers- And many more
Component Structure
Editor layout:Development Workflow
Running Locally
Environment Variables
Create.env.local for Supabase (optional):
Building
Resources
Documentation: CAPlayground:Next Steps
Core Animation
Learn about Core Animation in Posterboard wallpapers
GitHub Repository
View the source code
Contributing Guide
Read the full contributing guide
Discord Community
Join the community
