This is a FastAPI-based web service that allows users to securely log in, link multiple Google Calendar accounts, and receive daily HTML summaries of their upcoming events. It's built to run locally with PostgreSQL and supports multiple users.
- 🔐 User registration and login (with hashed passwords)
- 🔄 Google OAuth2 login to link calendar accounts
- 🗓️ Daily calendar summary using the Google Calendar API
- 📥 Multi-account support per user
- 💌 Email-ready HTML summaries
- 🛠️ Admin cron job support to email summaries automatically
- 🗃️ PostgreSQL backend with SQLAlchemy
- 📦 Token storage handled securely and excluded from Git
- Python 3.13+
- FastAPI
- Jinja2
- SQLAlchemy
- psycopg2
- Google Calendar API + OAuth2
- PostgreSQL (local)
git clone https://github.com/AlexanderPW/Calendar-Service.git
cd Calendar-Servicepython3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtCreate a .env file (if using) or edit db.py with your PostgreSQL credentials:
dbname="myappdb"
user="youruser"
password="yourpassword"
host="localhost"Make sure you have a client_secret.json for Google API OAuth in the root folder.
python
>>> from db import Base, engine
>>> Base.metadata.create_all(bind=engine)
>>> exit()uvicorn main:app --reloadOpen in browser: http://localhost:8000
To email summaries daily:
- Create a cron job that runs a script which calls the
/summaryroute or directly uses thegenerate_summary_html()function with user tokens from the database.
- Google tokens are stored as
.jsonfiles and excluded from Git via.gitignore. - Passwords are stored hashed using
passlib[bcrypt]. - No secrets are committed to GitHub.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
MIT License © Alex Waldrop