- Node.js 18+
- npm or yarn
- SQLite3 (for database)
# Clone the repository
git clone https://github.com/wajeht/calendar.git
cd calendar
# Install dependencies
npm install
# Set up database
npm run db:migrate:latest
# Start development server
npm run devThe app will be available at http://localhost:3000
src/
├── api/ # Express.js API routes
│ ├── auth/ # Authentication routes & middleware
│ ├── calendar/ # Calendar CRUD & iCal processing
│ └── settings/ # App configuration routes
├── db/ # Database layer
│ ├── migrations/ # Knex.js migrations
│ └── sqlite/ # SQLite database files
├── vue/ # Vue.js frontend
│ ├── components/ # Reusable UI components
│ ├── composables/ # Vue composition functions
│ ├── pages/ # Page components
│ └── router.js # Vue Router config
├── utils/ # Shared utilities
├── app.js # Express app setup
├── server.js # Server entry point
├── cron.js # Background sync jobs
└── config.js # App configuration
npm run dev # Start both Vue & Express in watch mode
npm run dev:server # Start only Express server with --watch
npm run dev:vue # Start only Vite dev server
npm run dev:serve # Build Vue & watch + start Expressnpm run build # Build Vue.js for production
npm start # Start production servernpm run db:migrate:latest # Run latest migrations
npm run db:migrate:rollback # Rollback last migration
npm run db:migrate:make # Create new migration
npm run db:reset:password # Reset app passwordnpm test # Run tests once
npm run test:watch # Run tests in watch modenpm run lint:check # Check for lint issues
npm run lint # Fix lint issues
npm run format:check # Check formatting
npm run format # Fix formattingnpm run rmds # Remove .DS_Store filesUses SQLite with Knex.js for migrations and query building.
Key tables:
calendars- Calendar sources and settingssettings- App configuration (passwords, cron settings)
Migration workflow:
# Create new migration
npm run db:migrate:make add_new_feature
# Edit migration file in src/db/migrations/
# Run migration
npm run db:migrate:latestTech Stack:
- Vue.js 3 with Composition API
- Vue Router for routing
- Tailwind CSS for styling
- FullCalendar.js for calendar UI
- Vite for build tooling
Key patterns:
- Use composables for shared logic (
useAuth,useCalendar,useSettings) - Components follow Vue 3
<script setup>syntax - API calls centralized in
src/vue/api.js - Reactive state management with
ref()andreactive()
Tech Stack:
- Express.js 5 with ES modules
- Better-SQLite3 for database
- ICAL.js for calendar parsing
- node-cron for background sync
- Helmet & security middleware
Key patterns:
- Dependency injection for services and models
- Custom error classes with proper HTTP status codes
- Middleware for authentication and validation
- Service layer for business logic
Tests use Vitest and Supertest:
# Run specific test file
npm test auth.test.js
# Test with coverage
npm test -- --coverageTest structure:
- API route tests in
src/api/**/*.test.js - Test utilities in
src/utils/test-utils.js - Tests use in-memory SQLite database
Server-side:
# Debug mode with inspect
node --inspect --watch ./src/server.js
# Environment variables
DEBUG=calendar:* npm run devClient-side:
- Vue DevTools browser extension
- Console logs in development mode
- Network tab for API debugging
Build process:
npm run build # Build frontend assets
npm run db:prepare:prod # Run production migrations
npm start # Start production serverEnvironment variables:
NODE_ENV=production
PORT=3000
DATABASE_URL=./src/db/sqlite/db.sqlite
APP_SECRET=your-session-secretFrontend dependencies:
npm install package-name
# Import in Vue components or main.jsBackend dependencies:
npm install package-name
# Import in Node.js filesDevelopment dependencies:
npm install -D package-nameKey config files:
package.json- Scripts and dependenciesvite.config.js- Frontend build configsrc/config.js- App configurationsrc/db/knexfile.js- Database configtailwind.config.js- CSS framework config
Database locked:
# Stop all processes and restart
npm run devPort already in use:
# Kill process on port 3000
lsof -ti:3000 | xargs killBuild errors:
# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm installCalendar not fetching:
- Check CORS settings for iCal URLs
- Verify URL returns valid iCal format
- Check server logs for fetch errors