Skip to content

Latest commit

 

History

28 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smartflow-ai-worker

Cloudflare Worker — secure AI proxy for SmartFlow

Cloudflare Workers JavaScript Gemini License


Overview

This worker connects the SmartFlow frontend with Google Gemini AI. It acts as a secure serverless proxy — handling authentication, CORS, rate limiting and Gemini API communication so the API key is never exposed in the browser.

Live app: https://barakzai.cloud · Main repo: aryanbarak/smartflow


Endpoints

Method Path Protection Description
POST /analyze JWT + Origin Send a message to Gemini, returns AI response
POST /briefing JWT + Origin Generate personalized weekly life briefing
POST /translate JWT + Origin Translate text via Gemini
POST /tts JWT + Origin Text-to-speech conversion
GET /health Public Health check

Security

Measure Implementation
API key isolation Stored in Cloudflare Worker secrets only
User authentication JWT validation on every protected endpoint
Rate limiting Per-user request counter via Cloudflare KV
Origin restriction CORS whitelist for SmartFlow frontend only

Technology Stack

Layer Technology
Runtime Cloudflare Workers (V8 isolates)
Language JavaScript (ES2022)
AI Google Gemini 2.5 Flash → 2.0 Flash (fallback)
Rate limiting Cloudflare KV
Auth JWT validation
Deploy Wrangler CLI

Powers these SmartFlow features

  • AI Learning Assistant
  • Weekly Life Briefing
  • Document Analysis & OCR Summaries
  • Action Item Generation
  • Text-to-Speech

Author

Aryan Barakzai · barakzai.cloud · GitHub


License

All Rights Reserved — Copyright © Aryan Barakzai

About

Cloudflare Worker — secure AI proxy for SmartFlow. Gemini integration, JWT auth and rate limiting.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages