https://github.com/pmarkaide/event42sync
An AWS Lambda service written in Kotlin that seamlessly syncs 42 School campus events to Google Calendar, featuring automated daily updates and intelligent change detection.
https://github.com/pmarkaide/event42sync
42api 42school aws aws-lambda google-calendar-api kotlin ktor
Last synced: about 2 months ago
JSON representation
An AWS Lambda service written in Kotlin that seamlessly syncs 42 School campus events to Google Calendar, featuring automated daily updates and intelligent change detection.
- Host: GitHub
- URL: https://github.com/pmarkaide/event42sync
- Owner: pmarkaide
- Created: 2024-12-07T10:08:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-30T13:39:07.000Z (over 1 year ago)
- Last Synced: 2025-01-30T14:33:16.685Z (over 1 year ago)
- Topics: 42api, 42school, aws, aws-lambda, google-calendar-api, kotlin, ktor
- Language: Kotlin
- Homepage:
- Size: 112 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Event42Sync
Event42Sync is an automated synchronization service that keeps 42 School campus events in sync with Google Calendar. Built as an AWS Lambda function using Kotlin, it provides reliable event synchronization with minimal maintenance.
## 🚀 Features
- **Automated Sync**: Daily synchronization of 42 School events to Google Calendar
- **Smart Update Detection**: Only syncs events that have been modified since the last update
- **Robust Error Handling**: Comprehensive error management and logging
- **Database Tracking**: PostgreSQL-based event tracking to prevent duplicates
- **AWS Lambda Integration**: Serverless architecture for efficient scaling
- **Token Management**: Automatic handling of OAuth tokens for both APIs
## 🛠 Tech Stack
- **Language**: Kotlin
- **Platform**: AWS Lambda
- **Database**: PostgreSQL
- **HTTP Client**: Ktor
- **APIs**:
- 42 School API
- Google Calendar API
- **Authentication**: OAuth 2.0
- **JSON Processing**: kotlinx.serialization
- **Configuration**: Environment variables & AWS SSM Parameter Store
## ⚙️ Architecture
The service consists of two main Lambda functions:
1. **InitializationHandler**: Complete calendar reinitialization
- Clears existing calendar events
- Fetches all events from 42 API
- Rebuilds the calendar and database
2. **DailySyncHandler**: Daily event updates
- Fetches recently updated events
- Syncs changes to Google Calendar
- Updates tracking database
## 🔧 Setup Requirements
- AWS Account with Lambda access
- Google Cloud Project with Calendar API enabled
- 42 School API credentials
- PostgreSQL database
- Environment variables:
- `CALENDAR_ID`: Google Calendar ID
- `DATABASE_URL`: PostgreSQL connection string
- `UID`: 42 API client ID
- `SECRET`: 42 API client secret
- Additional Google Cloud credentials
## 🔑 Security Notes
- Sensitive credentials are stored in AWS SSM Parameter Store
- Service account authentication for Google Calendar API
- OAuth 2.0 client credentials flow for 42 API
- Secure database connection handling
## 🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## 📜 License
MIT License