Skip to content

kollyboi/OutlookTaskWebhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Outlook Task Webhook - Refactored

This is a complete refactor of the Outlook Task Webhook service with improved organization and modularity.

Project Structure

refactored-app/
├── server.js                    # Main entry point
├── package.json                 # Dependencies and scripts
├── CLAUDE.md                    # Project instructions for Claude Code
├── OAUTH_GUIDE.md              # OAuth setup guide
├── README.md                    # This file
├── config/
│   └── index.js                # Configuration management
├── data/                       # Data files (logs, cache, mappings)
│   ├── event-mappings.json     # Google/Outlook event mappings
│   ├── subscription-cache.json # Webhook subscription cache
│   ├── google-token.json       # Google tokens cache
│   └── task-service.log        # Application logs
└── src/
    ├── auth/                   # Authentication modules
    │   ├── graph-auth.js       # Microsoft Graph authentication
    │   └── google-auth.js      # Google OAuth authentication
    ├── managers/               # Business logic managers
    │   └── subscription-manager.js # Webhook subscription management
    ├── middleware/             # Express middleware
    │   └── logging.js          # Request logging and error handling
    ├── routes/                 # Express route handlers
    │   ├── home.js             # Homepage routes
    │   ├── webhook.js          # Webhook endpoints
    │   ├── google-auth.js      # Google authentication routes
    │   ├── status.js           # Status and health endpoints
    │   ├── test.js             # Testing endpoints
    │   └── subscriptions.js    # Subscription management routes
    ├── services/               # Core business services
    │   ├── graph-client.js     # Microsoft Graph API client
    │   ├── event-processor.js  # Task identification and processing
    │   └── google-calendar-sync.js # Google Calendar synchronization
    └── utils/                  # Utility modules
        └── logger.js           # Logging utility

Key Improvements

1. Modular Architecture

  • Separated concerns into logical modules
  • Clear separation between routes, services, auth, and utilities
  • Easy to maintain and extend

2. Organized Route Structure

  • Home routes (/): Main UI and navigation
  • Webhook routes (/webhook): Microsoft Graph webhook handling
  • Google Auth routes (/google-auth/*): Google authentication flows
  • Status routes (/status): Service health and monitoring
  • Test routes (/test/*): Testing and debugging endpoints
  • Subscription routes (/subscriptions/*): Webhook subscription management

3. Service Layer

  • Graph Client: Centralized Microsoft Graph API access
  • Event Processor: Task identification and calendar operations
  • Google Calendar Sync: Google Calendar integration

4. Authentication Layer

  • Graph Auth: Microsoft Graph token management
  • Google Auth: Google OAuth flow handling

5. Configuration Management

  • Centralized configuration in config/index.js
  • Environment variable validation
  • Clear separation of settings

6. Data Management

  • All data files organized in data/ folder
  • Event mappings, caches, and logs in one location
  • Easy backup and migration

Getting Started

  1. Install dependencies:

    cd refactored-app
    npm install
  2. Configure environment: Copy your .env file to the refactored-app directory with all required variables.

  3. Run the application:

    npm start

Features Preserved

All original functionality has been preserved:

  • ✅ Webhook-based event processing
  • ✅ Task identification and calendar migration
  • ✅ Google Calendar synchronization
  • ✅ Authentication management
  • ✅ Subscription auto-renewal
  • ✅ Error handling and logging
  • ✅ All existing endpoints and UI

Benefits of Refactoring

  1. Maintainability: Code is organized by responsibility
  2. Scalability: Easy to add new features or modify existing ones
  3. Testability: Isolated modules can be tested independently
  4. Debugging: Clear separation makes issue tracking easier
  5. Documentation: Self-documenting structure
  6. Team Collaboration: Multiple developers can work on different modules

Migration Notes

  • The refactored version is completely self-contained
  • No changes needed to existing .env configuration
  • All data files are preserved and migrated
  • Same port and endpoint structure maintained
  • Backward compatible with existing webhooks and configurations

Development

To add new features:

  1. New routes: Add to appropriate route file in src/routes/
  2. New services: Create in src/services/
  3. New auth providers: Add to src/auth/
  4. New utilities: Add to src/utils/

The modular structure makes it easy to understand where new code should go and how it should integrate with existing functionality.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors