Frontend Stack
Vue.js 2.7
Component framework with Composition API support
Vuex 3.x
State management pattern and library
Vue Router 3.x
Official router for Vue.js
Vuetify 1.5
Material Design component framework
Project Structure
Frontend code lives incontentcuration/contentcuration/frontend/:
Creating Components
Component Conventions
Create component file
Place components in the appropriate directory:
- Page components:
<spa>/pages/ - SPA-specific components:
<spa>/components/ - Shared components:
shared/components/
Import Paths
Use Webpack aliases for cleaner imports:Working with Vuex
Vuex Module Structure
Vuex modules follow this pattern:State Management
- State
- Getters
- Mutations
- Actions
Define reactive state:
Using Vuex in Components
IndexedDB Resources
Using the Resource API
The Resource API provides a unified interface for data operations:Advanced Queries
IndexedDB Listeners
Vuex modules automatically listen to IndexedDB changes:Routing
Define Routes
Navigate Programmatically
Build Commands
Testing Components
Use Jest with @testing-library/vue for component tests:Common Patterns
Loading Data on Mount
Computed Properties with Vuex
Form Handling
Best Practices
Use Resource API for all data operations
Use Resource API for all data operations
Always use the Resource API instead of direct API calls. It handles caching, IndexedDB storage, and sync automatically.
Let IndexedDB listeners update Vuex
Let IndexedDB listeners update Vuex
Don’t manually commit mutations after Resource updates - listeners handle it:
Keep components focused
Keep components focused
Components should be focused on a single responsibility. Extract reusable logic into mixins or composables.
Write tests for components
Write tests for components
Every component should have tests in
__tests__/ directory. Test user interactions and edge cases.Next Steps
Backend Development
Learn about Django models and viewsets
Testing
Write comprehensive tests
