- A self-hostable project that generates weekly movie recommendations and sends them via email using Cloudflare Workers.
- Bun (JS Runtime), A Cloudflare account, Google AI and Resend API keys.
- Cloudflare Workers, Google's Generative AI (Model: Gemini 1.5 Pro), Resend (to send emails), and Cloudflare KV (to store previous responses and improve the new ones).
-
Clone the repository:
git clone https://github.com/zxcodes/Suggestify.git
-
Install dependencies:
bun install
-
Create a
.dev.vars
file in the root and store your API secrets there. An.env
file won't work here since workers don't run in a typical Node environment.
RESEND_API_KEY
: Your Resend API keyAPI_KEY
: Your Google AI API key
- Create a KV namespace called
SUGGESTIONS_STORE
using Wrangler or CF Dashboard. - Configure your
wrangler.toml
file with the necessary bindings and environment variables (Refer CF Docs).
- Start the dev server by running
bun dev
and hit the cron bycurl http://localhost:8787/__scheduled
- Authenticate with Cloudflare:
wrangler login
- Deploy the worker:
bun deploy
- To View logs from the deployed worker, do
bun logs
- The
.dev.vars
file is only for local dev. Use wrangler to upload your secrets to CF so that they're available when you deploy your worker. You can add secrets by runningwrangler secret put <KEY>