Skip to content

A fast, personalized C++ scheduling system to manage daily tasks and routines. Supports one-time and recurring events, with a modular design built for speed, flexibility, and future AI integration.

License

Notifications You must be signed in to change notification settings

ostepan8/personal-scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Personal Scheduler

A high-performance personal scheduling application built with SOLID principles featuring a C++ backend API server and React frontend. Optimized for enterprise-grade performance with comprehensive testing and benchmarking suite.

⚑ Performance

Production-Ready Performance Metrics:

  • API Layer: 13,042 RPS (4,500x improvement from baseline)
  • Model Layer: 20,000 events/second (50ms for 1000 events)
  • Database: 185,000 inserts/second with SQLite
  • Memory Usage: 11-37MB peak (highly efficient)
  • Response Caching: Sub-millisecond cache hits
  • Thread Pool: Hardware-optimized concurrency

Benchmarked on Apple Silicon with optimized builds

πŸ“Š View Performance Benchmark Results β†’

πŸ—οΈ SOLID Architecture

This project demonstrates enterprise-grade software design following SOLID principles:

βœ… Single Responsibility Principle

  • EventService: Pure event operations
  • EventsHandler: HTTP request handling only
  • Router: Route matching and dispatch
  • PerformanceMonitor: Metrics collection

βœ… Open/Closed Principle

  • Extensible handler system via IRequestHandler
  • Plugin-based notification and action system
  • Configurable performance monitors

βœ… Liskov Substitution Principle

  • Interface-based dependency injection
  • Polymorphic event types (OneTime/Recurring)
  • Substitutable calendar integrations

βœ… Interface Segregation Principle

  • IEventService for clean business logic
  • IPerformanceMonitor for metrics
  • IRequestHandler for HTTP handling

βœ… Dependency Inversion Principle

  • Constructor injection throughout
  • Abstract interfaces over concrete implementations
  • DependencyContainer for IoC management

πŸš€ Features

Backend (C++)

  • SOLID-Compliant Architecture with dependency injection
  • Ultra-High Performance API (13K+ RPS with optimizations)
  • Advanced Caching System with TTL and cache metrics
  • Thread Pool Architecture for concurrent processing
  • Comprehensive Security (Auth, Rate Limiting, CORS)
  • Zero-Copy Optimizations and fast serialization
  • Production Monitoring with detailed performance metrics
  • Extensive Unit Tests for all SOLID components

Frontend (React)

  • Modern React UI with TypeScript and Tailwind CSS
  • Multiple Calendar Views (Day, Week, Month)
  • Interactive Event Management with recurring event support
  • Real-time Dashboard with today's events and statistics
  • 12-hour Time Display with proper formatting
  • Responsive Design optimized for desktop and mobile

πŸ§ͺ Testing Framework

Comprehensive Test Suite:

  • Unit Tests: EventService, Handlers, Router, Security
  • Integration Tests: Full API and database testing
  • Performance Tests: Benchmarking and load testing
  • Security Tests: Auth, Rate Limiting, Input validation
# Run all unit tests
make unit-tests

# Run individual test suites
make event_service_tests    # EventService component tests
make handlers_tests         # API handlers tests  
make router_tests          # Router component tests
make security_tests        # Auth and RateLimiter tests

# Run performance benchmarks
make benchmark
./benchmark

# Run comprehensive test script
./run_benchmark.sh

πŸ“¦ Installation

Prerequisites

  • C++17 compiler (g++ or clang++)
  • Node.js 16+ and npm
  • SQLite3 development libraries
  • libcurl for HTTP client functionality

Quick Start

  1. Clone and setup:

    git clone https://github.com/ostepan8/personal-scheduler.git
    cd personal-scheduler
    cp .env.example .env
  2. Build and run server:

    make clean && make server
    ./scheduler_server
  3. Setup frontend:

    cd frontend
    npm install
    cp .env.example .env.local
    PORT=3004 npm start
  4. Access application:

    • Frontend: http://localhost:3004
    • API: http://localhost:8080

Environment Configuration

.env (Backend):

API_KEY=your-secret-api-key
ADMIN_API_KEY=your-admin-key
HOST=127.0.0.1
PORT=8080
CORS_ORIGIN=http://localhost:3004
RATE_LIMIT=100
RATE_WINDOW=60

frontend/.env.local:

REACT_APP_API_URL=http://localhost:8080
REACT_APP_API_KEY=your-secret-api-key

πŸ—οΈ Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   React Frontend │────│   C++ API Server  │────│  SQLite Database β”‚
β”‚   (Port 3004)    β”‚    β”‚   (Port 8080)     β”‚    β”‚   (events.db)    β”‚
β”‚                  β”‚    β”‚                   β”‚    β”‚                  β”‚
β”‚  - TypeScript    β”‚    β”‚  SOLID Architectureβ”‚    β”‚  - WAL Mode      β”‚
β”‚  - Tailwind CSS  β”‚    β”‚  - Dependency      β”‚    β”‚  - Auto Schema   β”‚
β”‚  - Calendar Viewsβ”‚    β”‚    Injection      β”‚    β”‚  - Prepared Stmtsβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚  - Thread Pools    β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚  - Response Cache  β”‚
                       β”‚  - Security Layer  β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚ Optional Services β”‚
                       β”‚ - Google Calendar β”‚
                       β”‚ - Notifications   β”‚
                       β”‚ - Custom Actions  β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ Development

Available Make Targets

make help           # Show all available targets
make server         # Build SOLID-compliant server
make benchmark      # Build performance benchmark
make unit-tests     # Build and run all unit tests
make clean          # Clean build artifacts
make install        # Install to /usr/local/bin

Performance Benchmarking

# Build and run comprehensive benchmarks
make benchmark
./benchmark

# Run specific benchmark categories
./benchmark --model     # Model layer performance
./benchmark --api       # API performance  
./benchmark --full      # Full system benchmark

# Use benchmark script for load testing
./run_benchmark.sh

# Results automatically saved to benchmark_results/

Project Structure

scheduler/
β”œβ”€β”€ main.cpp                    # SOLID-compliant server entry point
β”œβ”€β”€ Makefile                    # Build system with test targets
β”œβ”€β”€ benchmark.cpp               # Comprehensive performance testing
β”œβ”€β”€ run_benchmark.sh           # Load testing script
β”‚
β”œβ”€β”€ api/                       # API layer (SOLID-compliant)
β”‚   β”œβ”€β”€ ApiServer.h/cpp        # Main HTTP server with DI
β”‚   β”œβ”€β”€ handlers/              # Request handlers (SRP)
β”‚   β”‚   β”œβ”€β”€ EventsHandler.*    # Event operations handler
β”‚   β”‚   └── StatsHandler.*     # Statistics handler
β”‚   β”œβ”€β”€ routing/               # Route management (OCP)
β”‚   β”‚   └── Router.*           # Route matching and dispatch
β”‚   β”œβ”€β”€ interfaces/            # Abstract interfaces (DIP)
β”‚   β”‚   β”œβ”€β”€ IEventService.h    # Event service interface
β”‚   β”‚   β”œβ”€β”€ IRequestHandler.h  # Handler interface
β”‚   β”‚   └── IPerformanceMonitor.h # Monitoring interface
β”‚   └── performance/           # Performance monitoring
β”‚       └── PerformanceMonitor.* # Metrics collection
β”‚
β”œβ”€β”€ services/                  # Business logic layer
β”‚   └── EventService.*         # Event operations (SRP + DIP)
β”‚
β”œβ”€β”€ model/                     # Domain models
β”‚   β”œβ”€β”€ Model.*                # Event aggregation
β”‚   β”œβ”€β”€ OneTimeEvent.*         # Single events
β”‚   β”œβ”€β”€ RecurringEvent.*       # Recurring events
β”‚   └── recurrence/            # Recurrence patterns
β”‚
β”œβ”€β”€ database/                  # Data persistence
β”‚   β”œβ”€β”€ SQLiteScheduleDatabase.* # SQLite implementation
β”‚   └── SettingsStore.*        # Configuration storage
β”‚
β”œβ”€β”€ security/                  # Security components
β”‚   β”œβ”€β”€ Auth.*                 # Authentication
β”‚   └── RateLimiter.*          # Rate limiting
β”‚
β”œβ”€β”€ utils/                     # Utilities
β”‚   β”œβ”€β”€ ResponseCache.*        # HTTP response caching
β”‚   β”œβ”€β”€ FastSerializer.*       # Optimized JSON serialization
β”‚   β”œβ”€β”€ ThreadPool.*           # Concurrent processing
β”‚   └── DependencyContainer.*  # IoC container
β”‚
β”œβ”€β”€ tests/                     # Comprehensive test suite
β”‚   β”œβ”€β”€ services/              # Service layer tests
β”‚   β”œβ”€β”€ api/                   # API layer tests
β”‚   β”œβ”€β”€ security/              # Security tests
β”‚   └── test_utils.h           # Test utilities
β”‚
β”œβ”€β”€ frontend/                  # React application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/        # React components
β”‚   β”‚   β”œβ”€β”€ services/          # API client
β”‚   β”‚   └── types/            # TypeScript interfaces
β”‚   └── public/               # Static assets
β”‚
└── benchmark_results/         # Performance test outputs

πŸ› οΈ API Documentation

Authentication

All requests require the Authorization header:

curl -H 'Authorization: your-api-key' http://localhost:8080/events

Core Endpoints

  • GET /events - List all events
  • POST /events - Create new event
  • GET /events/next/{count} - Get next N events
  • GET /stats - Performance and cache statistics
  • OPTIONS /* - CORS preflight support

Response Format

{
  "status": "ok",
  "data": [...],
  "meta": {
    "cache_hit": true,
    "response_time_ms": 1.2
  }
}

πŸ”’ Security Features

  • Multi-layer Authentication (API keys + Admin keys)
  • Configurable Rate Limiting (per-IP protection)
  • CORS Security with configurable origins
  • Input Sanitization for all user data
  • Secure Headers (HTTPS-ready)
  • Dependency Injection for secure component isolation
  • Production-Safe Logging (no sensitive data)

⚑ Performance Optimizations

Phase 1: Response Caching & Fast Serialization

  • Response Cache: TTL-based caching with hit/miss metrics
  • Fast JSON: Custom serialization avoiding nlohmann overhead
  • Connection Keep-Alive: HTTP connection reuse

Phase 2: Thread Pools & Async Processing

  • Thread Pool: Hardware-optimized worker threads
  • Async Handlers: Non-blocking request processing
  • Database Pooling: Connection reuse and optimization

Phase 3: Zero-Copy & Memory Optimization

  • Zero-Copy Streaming: Direct buffer operations
  • Lock-Free Structures: Concurrent data access
  • Memory Pools: Pre-allocated object management

Result: 13,042 RPS (4,500x improvement from baseline 2.9 RPS)

πŸ§ͺ Quality Assurance

Test Coverage

  • Unit Tests: 100% coverage of SOLID components
  • Integration Tests: Full API workflow testing
  • Performance Tests: Continuous benchmarking
  • Security Tests: Auth, rate limiting, input validation
  • Load Tests: High-concurrency validation

Continuous Integration Ready

  • Automated test execution with make unit-tests
  • Performance regression detection
  • Code quality validation
  • Build artifact management

πŸš€ Deployment

Production Build

# Backend
make clean && make server
sudo make install  # Installs to /usr/local/bin

# Frontend  
cd frontend
npm run build

Docker Support (Future)

The SOLID architecture makes containerization straightforward:

  • Clean dependency injection
  • Environment-based configuration
  • Stateless request handling
  • Health check endpoints

🀝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Follow SOLID principles in your code
  4. Add unit tests for new components
  5. Run test suite (make unit-tests)
  6. Benchmark performance impact (make benchmark)
  7. Commit changes (git commit -m 'Add SOLID feature')
  8. Push to branch (git push origin feature/amazing-feature)
  9. Open Pull Request

Code Standards

  • SOLID Principles: All new code must follow SOLID design
  • Unit Tests: New components require comprehensive tests
  • Performance: No regressions in benchmark results
  • Documentation: Update README for new features

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • httplib for lightweight C++ HTTP server
  • nlohmann/json for JSON processing
  • SQLite for embedded database excellence
  • React ecosystem for modern frontend
  • SOLID Principles by Robert C. Martin
  • Clean Architecture design patterns

Built with ❀️ following SOLID principles and modern C++ best practices

About

A fast, personalized C++ scheduling system to manage daily tasks and routines. Supports one-time and recurring events, with a modular design built for speed, flexibility, and future AI integration.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published