BittyBettr is a minimalist, local-first engine that captures your random sparks of curiosity—about history, science, technology, or philosophy—and transforms them into a beautifully crafted, in-depth Daily Learning Digest sent directly to your Kindle.
Built with Python, FastAPI, and powered by Google Gemini (or OpenAI), BittyBettr skips the databases and complex infrastructure in favor of a clean, hacker-friendly local MVP.
- Topic Capture API: A lightweight FastAPI server to instantly POST any topic you want to learn about.
- Deduplication Engine: Uses a simple, flat-file storage system (
topics.txt) to ensure you never learn the same thing twice. - Deep-Dive LLM Generation: Instructs the LLM to write like a long-form New Yorker profile—breaking down intuition, history, deep mechanics, and real-world examples.
- Direct-to-Kindle Delivery: Automatically bundles your daily digest into clean, Kindle-native HTML and emails it straight to your device via SMTP.
- Multi-Provider LLM Support: Designed out-of-the-box to effortlessly swap between Google Gemini and OpenAI with a single
.envvariable.
- Python 3.9+
- A Google Gemini API Key (Free tier works perfectly) or OpenAI API Key.
- A Kindle device (or Kindle app) configured to receive documents via email.
-
Clone the repository:
git clone https://github.com/SaiSandilya01/bitty-bettr.git cd bitty-bettr -
Create a virtual environment and install dependencies:
python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt -
Configure your environment:
cp .env.example .env
Open
.envand configure:- Your LLM Provider and API Key (
GEMINI_API_KEY) - Your target Kindle email address (
KINDLE_EMAIL) - Your SMTP credentials (
SMTP_USER,SMTP_PASSWORD) (Note: For Gmail, you MUST generate an App Password in your Google Account Security settings).
- Your LLM Provider and API Key (
-
Whitelist your Email with Amazon: Log into your Amazon Account → Manage Your Content and Devices → Preferences → Personal Document Settings. Ensure your
SMTP_USERemail is on the Approved Personal Document E-mail List.
Leave this running in the background to capture your thoughts throughout the day.
source .venv/bin/activate
uvicorn main:app --reloadWhenever you encounter something you want a deep dive into, hit the API:
curl -X POST http://localhost:8000/topics \
-H "Content-Type: application/json" \
-d '{"topic": "Compound Interest"}'
curl -X POST http://localhost:8000/topics \
-H "Content-Type: application/json" \
-d '{"topic": "Stoicism"}'At the end of your day (or via a morning Cron job), run the generator:
python3 digest_runner.pyThe engine will read your queued topics, orchestrate the LLM deep-dives, generate a single self-contained HTML document (digest.html), and instantly email it to your Kindle for reading!
main.py&routers/: The FastAPI application serving REST endpoints.storage/topic_store.py: The file I/O layer isolating the flat-file DB from the rest of the app.llm/: The Abstract LLM Factory, implementing the provider clients and housing the structured prompt template.services/email_service.py: Manages the TLS SMTP handshake and constructs multipart attachments for Amazon.digest_runner.py: The stateless CLI entry point that orchestrates the run cycle.
Queue topics and trigger digest generation directly from your phone — no curl commands needed.
- Create a bot via @BotFather on Telegram and copy the token.
- Add the token to your
.env:TELEGRAM_BOT_TOKEN=your-telegram-bot-token-here - Install the dependency (if not already done):
pip install -r requirements.txt
- Run the bot (in a separate terminal from the API server):
source .venv/bin/activate python -m telegram_bot.bot
| Command | Description |
|---|---|
/start |
Welcome message & command list |
/add <topic> |
Add a topic to the queue |
/list |
Show all queued topics |
/clear |
Remove all queued topics |
/digest |
Generate the digest and email it to your Kindle |
Tip: The bot and FastAPI server share the same
topics.txtfile, so you can mix-and-match — add topics via the API and send the digest via Telegram, or vice versa.
- Connect a Telegram Bot to
topics.txtso you can text ideas to your queue from your phone. - Setup a strictly scheduled crontab daemon to fully automate generation at 7:00 AM.
- Add EPUB native conversion using
ebooklibfor complex embedded images.