Development
Development
Section titled “Development”This guide covers the development workflow, conventions, and best practices for IONFLOW Frontend.
Development Server
Section titled “Development Server”Starting the Server
Section titled “Starting the Server”# Start development serverpnpm dev
# Start with specific portpnpm dev --port 3000
# Start with host access (for mobile testing)pnpm dev --hostHot Module Replacement (HMR)
Section titled “Hot Module Replacement (HMR)”Vite provides instant HMR for:
- Vue single-file components
- CSS/Tailwind changes
- TypeScript files
Code Style
Section titled “Code Style”TypeScript Rules
Section titled “TypeScript Rules”// ❌ NEVER use anyconst data: any = response.data;
// ✅ Always use proper typesconst data: UserResponse = response.data;
// ❌ NEVER use interfaceinterface User { id: string;}
// ✅ Always use typetype User = { id: string;};Vue Component Structure
Section titled “Vue Component Structure”<script setup lang="ts">// 1. Importsimport { ref, computed } from 'vue';import type { User } from '@/models/user';
// 2. Props with typestype Props = { title: string; items: User[];};const props = defineProps<Props>();
// 3. Emits with typestype Emits = { select: [item: User]; update: [value: string];};const emit = defineEmits<Emits>();
// 4. Composables and refsconst isLoading = ref(false);
// 5. Computedconst filteredItems = computed(() => props.items.filter(/* ... */));
// 6. Methodsconst handleSelect = (item: User) => { emit('select', item);};</script>
<template> <!-- Template with Tailwind CSS --></template>Language
Section titled “Language”- All code must be in English: comments, variables, functions
- Only exception: Translation files in
src/lang/
Testing
Section titled “Testing”Unit Tests
Section titled “Unit Tests”# Run all unit testspnpm test:unit
# Run tests in watch modepnpm test:unit --watch
# Run tests with coveragepnpm test:unit --coverage
# Run specific test filepnpm test:unit src/components/common/TruncateText.spec.tsE2E Tests
Section titled “E2E Tests”# Run E2E testspnpm test:e2e
# Run E2E tests with UIpnpm test:e2e --ui
# Run specific testpnpm test:e2e e2e/login.spec.tsTest File Location
Section titled “Test File Location”- Unit tests: Next to the component (
Component.spec.ts) - E2E tests: In
e2e/directory
Building
Section titled “Building”Development Build
Section titled “Development Build”# Type checkingpnpm type-check
# Lintpnpm lint
# Formatpnpm formatProduction Build
Section titled “Production Build”# Build for productionpnpm build
# Preview production buildpnpm previewDebugging
Section titled “Debugging”Vue DevTools
Section titled “Vue DevTools”Install Vue DevTools browser extension for:
- Component inspection
- State debugging
- Performance profiling
VSCode Debugging
Section titled “VSCode Debugging”Add to .vscode/launch.json:
{ "version": "0.2.0", "configurations": [ { "type": "chrome", "request": "launch", "name": "Debug IONFLOW", "url": "http://localhost:5173", "webRoot": "${workspaceFolder}/src" } ]}Git Workflow
Section titled “Git Workflow”Branch Naming
Section titled “Branch Naming”feature/ION-123-add-flow-builderbugfix/ION-456-fix-login-redirecthotfix/ION-789-critical-security-fixCommit Messages
Section titled “Commit Messages”Follow Conventional Commits:
feat(flows): add drag-and-drop supportfix(auth): resolve token refresh issuedocs(readme): update installation stepsrefactor(components): simplify form validationtest(flows): add unit tests for FlowCardPre-commit Checks
Section titled “Pre-commit Checks”The project uses pre-commit hooks for:
- ESLint
- Prettier
- Type checking
Common Tasks
Section titled “Common Tasks”Creating a New Component
Section titled “Creating a New Component”- Create component file in appropriate directory
- Add unit tests if in
src/components/ - Add to exports if needed
Adding a New Route
Section titled “Adding a New Route”- Add route in
src/router/[context].ts - Create view component in
src/views/[context]/ - Add navigation guard if needed
Adding a New Service
Section titled “Adding a New Service”- Create service in
src/services/[context]/ - Define types in
src/models/ - Create abstract class in
src/interfaces/if reusable
Adding Translations
Section titled “Adding Translations”- Add keys to
src/lang/en/message.ts - Add translations to
src/lang/es/message.ts - Use
t('key')in components
Performance Tips
Section titled “Performance Tips”- Use lazy loading for routes
- Implement virtual scrolling for large lists
- Optimize images and assets
- Use TanStack Query for caching