Vue 3 application for creating notes with local data storage. Built using TDD (Test-Driven Development) and CI/CD.
- Note creation - Add title and note content
- Local storage - Data saved in browser's IndexedDB
- Responsive design - Works on all devices
- Form validation - Data correctness checking
- Error handling - User-friendly error messages
# Install dependencies
npm install
# Run dev server
npm run dev
# Run tests in watch mode
npm run test- Creating a note: Enter a title (required) and note content, then click "Save"
- Local storage: Notes are automatically saved in browser's IndexedDB
- Display: All notes appear below the form, sorted from newest
- Persistence: Notes remain after page refresh - data is stored locally
- Vue 3 + Composition API - modern framework
- Pinia - application state management
- Vue Router - navigation between pages
- IndexedDB - local data storage
- TailwindCSS - component styling
- Vitest - unit testing
This project is configured to work with TDD. See examples in:
src/components/__tests__/NoteEditor.spec.ts- note editor component testssrc/components/__tests__/NoteList.spec.ts- note list component testssrc/stores/__tests__/notes.store.spec.ts- Pinia store tests
- RED β - Write a test that will fail
- GREEN β - Write minimal implementation
- REFACTOR π - Improve code while keeping tests passing
# Check TDD status - some tests are RED (that's OK!)
npm run test:runnpm run dev # Development server (port 5173)
npm run build # Production build
npm run preview # Preview buildnpm run test # Unit tests (watch mode)
npm run test:run # Unit tests (single run)
npm run test:ui # Unit tests (UI mode)
npm run test:coverage # With code coverage
npm run test:e2e # E2E tests (Playwright)
npm run test:e2e:ui # E2E UI modenpm run lint # TypeScript check
npm run lint:fix # Code formatting- Vue 3 - Framework
- Vite - Build tool
- TypeScript - Type safety
- TailwindCSS - Styling
- Vitest - Unit testing framework
- Vue Test Utils - Vue testing utilities
- Playwright - E2E testing
- @testing-library/jest-dom - Extended matchers
- GitHub Actions - CI/CD pipeline
- Husky - Git hooks
- lint-staged - Pre-commit linting
src/
βββ components/ # Vue components
β βββ __tests__/ # Component tests
β βββ NoteEditor.vue # Note creation form
β βββ NoteList.vue # Note list display
βββ stores/ # Pinia store
β βββ __tests__/ # Store tests
β βββ notes.store.ts # Notes management store
βββ lib/ # Database layer
β βββ __tests__/ # Database tests
β βββ db.ts # IndexedDB wrapper
βββ views/ # Page components
β βββ HomeView.vue # Main application page
βββ router/ # Routing configuration
β βββ index.js # Route definitions
βββ assets/ # Static assets
βββ __tests__/ # Main tests
docs/ # Documentation
βββ tdd-ci-setup.md # TDD + CI guide
βββ branch-protection-setup.md # GitHub configuration
Every PR goes through:
- β TypeScript type checking
- β Unit tests (Vitest)
- β Build verification
- β E2E tests (optional)
- β Code formatting
Main branch is protected and requires:
- β All tests passing
- β Approval from another developer
- β Up-to-date branch version
Before each commit automatically:
- Formats code (Prettier)
- Checks types (TypeScript)
- Runs unit tests
feat(component): add new feature
fix(ui): fix bug in component
test(utils): add tests for function
docs(readme): update documentation- Unit tests:
*.test.ts - E2E tests:
*.spec.ts - Test descriptions: "should [expected behavior]"
-
Write test (file already exists):
# src/utils/__tests__/noteUtils.test.ts # Tests for formatNoteTitle, validateNoteData functions, etc.
-
Run test (RED):
npm run test:run # β Error: Cannot resolve import "../noteUtils" -
Write implementation:
// src/utils/noteUtils.ts export function formatNoteTitle(title: string): string { // Your implementation }
-
Run test (GREEN):
npm run test:run # β All tests passed
Project automatically deploys to Vercel after merge to main branch.
Required environment variables in GitHub Secrets:
VERCEL_TOKENORG_IDPROJECT_ID
- Create feature branch:
git checkout -b feature/name - Write tests (TDD approach)
- Implement functionality
- Make sure all tests pass
- Create Pull Request
Happy coding with TDD! π§ͺβ¨