Skip to content

boyonglin/shared-calendar

Β 
Β 

Repository files navigation

Shared Calendar

A modern, full-stack calendar sharing application that integrates with Google Calendar, iCloud Calendar, and Outlook Calendar. Designed for teams and individuals to view shared availability, manage friend connections, and schedule meetings with AI-powered assistance.

Node.js TypeScript React License

✨ Features

Calendar Integration

  • Multi-Provider Support: Connect Google Calendar, iCloud Calendar, and Outlook Calendar simultaneously
  • Unified View: View all your calendars and friends' calendars in a single weekly view
  • Event Creation: Create calendar invites directly from the app with attendee selection
  • Cross-Timezone Support: Events are properly synchronized across different timezones

Social Features

  • Friend System: Add friends by email and share calendar availability
  • Friend Requests: Send, receive, accept, or reject friend requests
  • Privacy-Focused: Only mutually accepted friends can view each other's calendars
  • Team Collaboration: Filter calendar view by team members

AI-Powered Assistant

  • Smart Invitation Drafts: Generate professional, casual, or friendly invitation messages using Google Gemini AI
  • Customizable Tone: Choose between professional, casual, and friendly tones for your invitations
  • Secure Input Handling: Built-in sanitization to prevent prompt injection attacks

User Experience

  • Progressive Web App (PWA): Install as a native app on desktop or mobile
  • Responsive Design: Works seamlessly on desktop, tablet, and mobile devices
  • Real-Time Updates: Automatic calendar refresh and event synchronization
  • Toast Notifications: Instant feedback for all user actions

πŸ› οΈ Tech Stack

Layer Technologies
Frontend React 18, TypeScript, Vite, Tailwind CSS, shadcn/ui, Radix UI, Lucide Icons
Backend Node.js 24, Express 5, TypeScript, SQLite (libSQL)
Auth Server-side OAuth 2.0 (Google), CalDAV (iCloud), OneCal API (Outlook), JWT
AI Google Gemini API (gemini-flash-latest)
Tooling Pixi (package management), ESLint, Prettier, Zod (validation), Pino (logging)
PWA Vite PWA Plugin, Workbox

πŸš€ Getting Started

Prerequisites

  • Pixi package manager installed
  • Node.js 24.x (automatically managed by Pixi)

Quick Start

# Clone the repository
git clone https://github.com/boyonglin/shared-calendar.git
cd shared-calendar

# Install all dependencies
pixi run install

# Start development server (frontend + backend)
pixi run dev

The app will be available at:

Available Commands

Command Description
pixi run install Install all dependencies
pixi run build Build both client and server for production
pixi run format Format code with Prettier
pixi run lint Lint code with ESLint
pixi run dev Start both frontend and backend dev servers

βš™οΈ Configuration

Environment Variables

Configuration is managed via environment variables. Refer to .env.example for the complete list.

Server Variables (server/.env)

  • Server Configuration: NODE_ENV, PORT, CLIENT_URL
  • Google OAuth: GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REDIRECT_URI
  • OneCal (Optional): ONECAL_APP_ID, ONECAL_API_KEY, ONECAL_REDIRECT_URI
  • Security: JWT_SECRET, ENCRYPTION_KEY

Client Variables (client/.env)

  • API Configuration: VITE_API_BASE_URL

Production / Deployment

  • Turso Database: TURSO_DATABASE_URL, TURSO_AUTH_TOKEN

Google OAuth Setup

  1. Go to Google Cloud Console β†’ APIs & Services β†’ Credentials
  2. Create OAuth 2.0 Client ID (Web application):
    • Authorized JavaScript origins: http://localhost:5173
    • Authorized redirect URIs: http://localhost:3001/api/auth/google/callback
  3. Enable Google Calendar API in APIs & Services β†’ Library
  4. Configure OAuth consent screen:
    • Add your account as a test user
    • Required scopes:
      • .../auth/userinfo.profile
      • .../auth/userinfo.email
      • .../auth/calendar.readonly
      • .../auth/calendar.events
  5. Copy Client ID and Client Secret to your .env file

Note: This app uses server-side OAuth to securely store refresh tokens in a local SQLite database (server/shared-calendar.db), maintaining calendar access across sessions.

iCloud Calendar Setup

  1. Go to Apple ID Account Settings
  2. Sign in with your Apple ID
  3. Navigate to Sign-In and Security β†’ App-Specific Passwords
  4. Generate a new app-specific password for this application
  5. Use your iCloud email and the generated password when connecting in the app

Important: Always use an app-specific password, not your regular Apple ID password.

Outlook Calendar Setup (via OneCal)

  1. Sign up for OneCal to get API credentials
  2. Create a new app in the OneCal dashboard
  3. Copy the App ID and API Key to your .env file
  4. Connect your Microsoft/Outlook account through the app interface

πŸ“ Project Structure

shared-calendar/
β”œβ”€β”€ client/                 # Frontend (React + Vite + Tailwind)
β”œβ”€β”€ server/                 # Backend (Express + SQLite)
β”œβ”€β”€ shared/                 # Shared code between server and Vercel
β”‚   β”œβ”€β”€ types.ts            # Shared TypeScript types
β”‚   └── core/               # Shared core modules
β”‚       β”œβ”€β”€ constants/      # Centralized configuration values
β”‚       β”œβ”€β”€ db/             # Database layer (Turso/libSQL)
β”‚       β”œβ”€β”€ repositories/   # Data access layer
β”‚       β”œβ”€β”€ services/       # Business logic (auth, AI, etc.)
β”‚       └── utils/          # Utility functions
β”œβ”€β”€ api/                    # Vercel serverless functions
β”œβ”€β”€ pixi.toml               # Pixi configuration
└── package.json            # Root package (npm workspaces)

πŸ“š API Documentation

The API specification is available in openapi.json (OpenAPI 3.0 format).


πŸ”’ Security

  • Server-side OAuth: Tokens are stored securely on the server, never exposed to the client
  • JWT Authentication: HTTP-only cookies with configurable expiration
  • Encrypted Storage: iCloud passwords encrypted with AES-256-GCM
  • Input Validation: Zod schemas for all API inputs
  • CORS Protection: Strict origin validation
  • Helmet Security Headers: HTTP security headers enabled
  • Rate Limiting: Built-in protection against abuse
  • AI Prompt Sanitization: Protection against prompt injection attacks

πŸ—ΊοΈ Roadmap

Completed

  • βœ… Google, iCloud, and Outlook Calendar integrations
  • βœ… Filter calendar view by team members
  • βœ… Create calendar invites with attendee selection
  • βœ… AI-powered invitation draft generation
  • βœ… Multi-user calendar sharing with friend system
  • βœ… Cross-timezone event synchronization
  • βœ… Progressive Web App (PWA) support

In Progress

  • 🚧 AI calendar assistant: scheduling conflicts, suggest optimal times

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

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


πŸ™ Acknowledgments

About

A calendar sharing application with Google Calendar, iCloud Calendar, and Outlook Calendar integration for viewing team availability and scheduling meetings.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 92.0%
  • CSS 6.8%
  • Other 1.2%