Overview
Kitsu follows a modern Vue.js architecture with clear separation of concerns. The application uses Vuex for state management, Vue Router for navigation, and a modular API client for backend communication.Application Structure
Entry Point
The application bootstraps insrc/main.js:
src/main.js
- Create Vue app instance
- Install plugins (i18n, router, store, websocket)
- Sync router state with Vuex
- Mount to DOM
Router Architecture
Route Configuration
Routes are defined insrc/router/routes.js and follow a hierarchical structure:
Router Setup
The router (src/router/index.js) uses:
- HTML5 History Mode - Clean URLs without hash
- Scroll Behavior - Restores scroll position on navigation
- Navigation Guards - Authentication checks
src/router/index.js
Vuex Store Architecture
Store Structure
The Vuex store (src/store/index.js) uses a modular architecture:
src/store/index.js
Store Modules
Each module follows a consistent pattern:- State
- Getters
- Actions
- Mutations
Key Store Modules
assets
Manages asset entities, types, and asset-related operations
shots
Handles shot entities, sequences, and episodes
tasks
Task management, comments, and previews
people
Team members, departments, and assignments
productions
Production/project data and settings
files
File management and output files
user
Current user state and preferences
login
Authentication and session management
API Client Architecture
Base Client
The API client (src/store/api/client.js) wraps Superagent:
src/store/api/client.js
API Modules
Each API module (src/store/api/*.js) provides domain-specific methods:
src/store/api/tasks.js
Component Architecture
Component Organization
Components are organized by function:Component Patterns
- Page Component
- Widget Component
Mixins
Reusable component logic is shared through mixins insrc/components/mixins/:
State Management Patterns
When to Use Vuex
- Use Vuex When
- Use Local State When
- State is shared across multiple components
- State needs to persist across route changes
- Complex state transformations are required
- Real-time updates affect multiple views
Data Flow
Real-time Updates
Kitsu uses Socket.io for real-time collaboration:Internationalization
Kitsu uses Vue I18n for multi-language support:src/lib/i18n.js
Best Practices
Keep components focused
Each component should have a single, clear responsibility
Prefer composition
Use smaller, composable components over large monolithic ones
Minimize Vuex usage
Use local state when possible for better performance
Use getters for derived state
Don’t store computed values in state
Next Steps
Contributing Guide
Learn how to contribute code to Kitsu
