๐ Developer Quick Start Guide
Fast Track: Get up and running with Uptime Watcher development in minutes.
๐ Overviewโ
Uptime Watcher is a sophisticated Electron desktop application for monitoring website uptime with real-time updates, comprehensive analytics, and desktop notifications.
โก Quick Setupโ
Prerequisitesโ
- Node.js: 18+ (LTS recommended)
- npm: 9+ (comes with Node.js)
- Git: Latest version
1. Clone & Installโ
git clone https://github.com/Nick2bad4u/Uptime-Watcher.git
cd Uptime-Watcher
npm install
2. Start Developmentโ
# Start both Vite dev server and Electron
npm run electron-dev
# Or start separately:
npm run dev # Vite dev server (port 5173)
npm run electron # Electron (waits for Vite)
3. Verify Setupโ
- Application window should open automatically
- React DevTools available in development
- Hot reload enabled for both frontend and backend changes
๐๏ธ Architecture Quick Referenceโ
Technology Stackโ
- Frontend: React + TypeScript + Tailwind CSS + Vite
- Desktop: Electron (main + renderer processes)
- Database: SQLite (node-sqlite3-wasm)
- State: Zustand (domain-specific stores)
- Testing: Vitest (dual configuration)
- IPC: Type-safe Electron contextBridge
Project Structureโ
uptime-watcher/
โโโ electron/ # Main process (Node.js backend)
โ โโโ main.ts # Entry point
โ โโโ services/ # Service-oriented architecture
โ โ โโโ database/ # Repository pattern
โ โ โโโ ipc/ # IPC handlers
โ โ โโโ monitoring/ # Monitoring services
โ โโโ managers/ # Business logic orchestrators
โโโ src/ # Renderer process (React frontend)
โ โโโ components/ # React components
โ โโโ stores/ # Zustand state management
โ โโโ services/ # Frontend services
โโโ shared/ # Common code (types, validation)
โโโ docs/ # Comprehensive documentation
๐ ๏ธ Common Development Tasksโ
Adding a New Featureโ
- Backend: Add service/repository in
electron/services/
- IPC: Create type-safe handlers in
electron/services/ipc/
- Frontend: Add components and store in
src/
- Types: Define shared types in
shared/types/
- Tests: Add tests in both
electron/test/
andsrc/test/
Database Changesโ
- Repository: Create/modify in
electron/services/database/
- Manager: Update business logic in
electron/managers/
- Migration: Handle schema changes in DatabaseService
- Types: Update interfaces in
shared/types/
Frontend Changesโ
- Components: Add to
src/components/
- State: Create/modify Zustand stores in
src/stores/
- Styling: Use Tailwind CSS classes
- IPC: Communicate via
window.electronAPI
(typed)
๐ง Available Scriptsโ
Developmentโ
npm run electron-dev # Start full development environment
npm run dev # Vite dev server only
npm run electron # Electron only (needs Vite running)
npm run build # Production build
npm run dist # Build and package application
Testingโ
npm test # Run all tests
npm run test:electron # Backend tests only
npm run test:frontend # Frontend tests only
npm run test:watch # Watch mode
Code Qualityโ
npm run lint # ESLint + Stylelint
npm run lint:fix # Auto-fix lint issues
npm run format # Prettier formatting
npm run check-types # TypeScript type checking
Documentationโ
npm run docs # Generate TypeDoc documentation
npm run context # Generate AI context (for AI assistants)
๐ฏ Key Development Patternsโ
1. Repository Pattern (Database)โ
// Always use repositories for database access
const sites = await siteRepository.findAll();
await siteRepository.create(newSite);
2. IPC Communicationโ
// Backend: electron/services/ipc/
ipcService.registerStandardizedIpcHandler(
"sites:create",
async (data: SiteCreationData) => {
return await siteManager.createSite(data);
},
isSiteCreationData
);
// Frontend: React components
const result = await window.electronAPI.sites.create(siteData);
3. Event-Driven Updatesโ
// Emit events for cross-service communication
await eventBus.emitTyped("sites:added", { site: newSite });
// Listen to events
eventBus.onTyped("sites:added", (data) => {
updateUI(data.site);
});
4. Zustand State Managementโ
// Domain-specific stores
export const useSitesStore = create<SitesStore>()((set, get) => ({
sites: [],
addSite: (site) =>
set((state) => ({
sites: [...state.sites, site],
})),
// ... other actions
}));
๐จ Important Guidelinesโ
DO's โ โ
- Follow TypeScript strict mode - No
any
or type shortcuts - Use established patterns - Repository, Service, IPC patterns
- Write tests - Both frontend and backend tests required
- Document with TSDoc - Follow established standards
- Use error handling utilities -
withErrorHandling()
for consistency
DON'Ts โโ
- No direct database access - Always use repositories
- No untyped IPC - All communication must be typed
- No global state - Keep Zustand stores domain-specific
- No direct state mutations - Use store actions
- No bypassing error handling - Use established patterns
๐ Debuggingโ
Development Toolsโ
- React DevTools: Available in development mode
- Electron DevTools: F12 in the application window
- VS Code Debugging: Configured launch configurations available
Common Issuesโ
- SQLite WASM not found: Run
npm run postbuild
- IPC communication fails: Check type definitions and handlers
- Hot reload not working: Restart development server
- Database errors: Check transaction safety and repository usage
Loggingโ
# Enable debug logging
npm run electron-dev -- --debug
# Production-level logging
npm run electron-dev -- --log-production
# Info-level logging
npm run electron-dev -- --log-info
๐ Essential Documentationโ
Architecture Understandingโ
docs/AI-CONTEXT.md
- AI assistant guidedocs/Architecture/ADRs/
- Architectural decisionsdocs/Architecture/Patterns/
- Development patterns
Implementation Guidesโ
docs/Guides/NEW_MONITOR_TYPE_IMPLEMENTATION.md
docs/Guides/UI-Feature-Development-Guide.md
docs/Architecture/Templates/
- Code templates
Code Standardsโ
๐ฏ Next Stepsโ
For New Contributorsโ
- Read:
docs/AI-CONTEXT.md
for project understanding - Explore: Run the application and explore existing features
- Practice: Try adding a simple feature following the patterns
- Ask: Check documentation first, then ask questions
For AI Assistantsโ
- Context: Load
docs/AI-CONTEXT.md
for comprehensive context - Patterns: Reference
docs/Architecture/
for coding patterns - Examples: Use templates in
docs/Architecture/Templates/
๐ Ready to contribute! The codebase follows strict patterns and comprehensive documentation. When in doubt, check the existing code and documentation patterns.