Markdown Converter
Agent skill for markdown-converter
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Bootcamp Pomodoro PWA - Progressive Web App with Node.js backend implementing a Pomodoro timer with session history, statistics, and motivational quotes. Built as part of Bootcamp II final delivery.
Version: 2.0.0
Stack:
Progressive Web App (PWA) with RESTful API backend - Monorepo with workspaces
# Install all dependencies (root + apps) npm install # Or install individually cd apps/web && npm install cd apps/api && npm install cd tests/e2e && npm install && npx playwright install chromium
# Run web dev server (Vite HMR on port 8080) npm run dev:web # Run API dev server (Node watch mode on port 3000) npm run dev:api # Run both in separate terminals for full development
# Build web PWA for production npm run build:web # Preview production build cd apps/web && npm run preview
# Run all E2E tests (requires web + API running) npm run test:e2e # Run API unit tests (16 tests - sessions + quotes) npm run test:unit # Or directly: cd apps/api && npm test # Run E2E tests with UI (interactive mode) cd tests/e2e && npm run test:ui # Run E2E tests in headed mode (see browser) cd tests/e2e && npm run test:headed # View Playwright report cd tests/e2e && npm run report
# Run Lighthouse CI locally npx @lhci/[email protected] autorun --config=.lighthouserc.cjs # Requires web server running on localhost:8080
# Build and start all services docker-compose up --build # Or use npm scripts npm run docker:up # Stop services npm run docker:down # View logs npm run docker:logs # Access: # - Web PWA: http://localhost:8080 # - API: http://localhost:3000
apps/ ├── web/ # Frontend PWA (Vite) │ ├── src/ │ │ ├── main.js # UI initialization & event handlers │ │ ├── timer.js # Timer class (localStorage state) │ │ ├── api-client.js # API communication layer │ │ └── styles.css │ ├── public/icons/ │ ├── vite.config.js # PWA manifest + service worker config │ └── Dockerfile │ ├── api/ # Backend API (Express) │ ├── src/ │ │ ├── index.js # Express app & routes │ │ ├── routes/sessions.js # Sessions CRUD endpoints │ │ └── services/quotes.js # Quotable API proxy │ └── Dockerfile │ tests/e2e/ # E2E tests (Playwright) ├── pwa.spec.ts # PWA functionality tests └── api.spec.ts # API endpoint tests docker-compose.yml # Multi-container orchestration
Browser PWA ←→ API Client ←→ Express API ←→ In-Memory Store ↓ ↓ ↓ localStorage Service Worker Quotable API
Frontend (apps/web/src/timer.js):
localStorage (mode, timeRemaining, isRunning, sessionsCompleted)localStorage (durations, sound, notifications)Timer class manages state + tick interval + callbacksBackend (apps/api/src/routes/sessions.js):
Service Worker (apps/web/vite.config.js):
autoUpdate strategyManifest:
base: '/bootcamp2-chrome-ext-SrMorim/' for GitHub Pages deploymentBase URL:
http://localhost:3000
GET /api/health - Health checkGET /api/quote - Get random motivational quote (proxied from Quotable)GET /api/sessions - List all sessions (sorted by completedAt desc)GET /api/sessions/:id - Get specific sessionGET /api/sessions/stats - Get statistics (total, today, thisWeek, byMode)POST /api/sessions - Create session (body: {mode, duration, completedAt})DELETE /api/sessions/:id - Delete sessionDELETE /api/sessions - Clear all sessionsValidation:
mode must be: focus, shortBreak, or longBreakduration must be positive numberMain UI controller that:
Timer instanceapiClient to persist completed sessionsTimer class with:
Abstraction layer for API calls:
API_URL (defaults to localhost:3000 or window.API_URL)createSession(), getSessions(), getStats(), getQuote()apps/api/Dockerfile:
npm start (production mode)apps/web/Dockerfile:
docker-compose.yml:
api and webweb depends on api health checkpomodoro-networkFile:
.github/workflows/ci-pwa.yml
Jobs:
Artifacts:
playwright-report/ - HTML test report (E2E)test-results/ - JSON results (E2E)lighthouse-report/ - Lighthouse CI results + assertionsweb-dist/ - Built PWAQuality Gates:
Environment Variables:
E2E_BASE_URL - Base URL for E2E tests (default: http://localhost:8080)API_URL - API base URL for API tests (default: http://localhost:3000)VITE_API_URL - Build-time API URL for production (GitHub Pages uses Render backend)LHCI_GITHUB_APP_TOKEN - Optional Lighthouse CI GitHub App tokenSessions Routes (sessions.test.js) - 12 tests:
Quotes Service (quotes.test.js) - 4 tests:
Running:
cd apps/api && npm test (uses Node.js test runner)
PWA Tests (pwa.spec.ts) - 8 tests:
/manifest.webmanifestAPI Tests (api.spec.ts) - 8 tests:
Configuration:
.lighthouserc.cjs
Thresholds (all ≥ 80):
Critical Assertions:
cd apps/web && npm run buildcd apps/api && npm start (background)cd apps/web && npm run preview (background)cd tests/e2e && npm testTimer class in apps/web/src/timer.js for state logicapps/web/src/main.jstests/e2e/pwa.spec.tsapps/api/src/routes/sessions.js or new route fileapps/api/src/index.jsapps/web/src/api-client.js with new methodtests/e2e/api.spec.tsService Worker/Caching:
apps/web/vite.config.js → workbox.runtimeCachingManifest:
apps/web/vite.config.js → manifest objectapps/web/public/icons/ if neededBase Path (GitHub Pages):
base: '/bootcamp2-chrome-ext-SrMorim/' in vite.config.jsARIA Implementation:
aria-label or visible labelrole="timer" with aria-live="polite"aria-live regionsaria-pressed statesrole="tabpanel" with aria-labelledbyaria-describedby for hints.sr-only CSS classKeyboard Navigation:
Semantic HTML:
<main>, <nav>, <footer> landmarksrole attributes for custom widgetsAPI not reachable from PWA:
VITE_API_URL environment variable during buildService worker not updating:
autoUpdate strategy (should auto-update)Tests failing:
E2E_BASE_URL and API_URL env varsnpx playwright install chromiumDocker build fails:
Lighthouse CI fails:
.lighthouserc.cjs configurationUnit tests fail:
cd apps/api && npm installGitHub Pages deployment fails:
actions/configure-pages@v5, actions/upload-pages-artifact@v3, and actions/deploy-pages@v4 are usedgithub-pages is configured in workflowgh-pages branch can remain (won't interfere)updateUI() lightweightCI/CD automatically deploys to GitHub Pages on push to main using the official GitHub Actions method:
actions/upload-pages-artifact@v3actions/deploy-pages@v4 (official method)Deployment Method (GitHub Actions Artifact):
configure-pages, upload-pages-artifact, deploy-pages.nojekyll needed)github-pages with deployment URL trackingAdvantages over branch-based deployment:
gh-pages branch neededRepository Settings (Auto-configured): After first successful deploy, GitHub automatically sets:
# Production deployment docker-compose up -d # View logs docker-compose logs -f # Stop docker-compose down