A SvelteKit application that uses your smartphone's camera to analyze grocery products using Google's Generative AI. Take a photo of any grocery product to get detailed nutritional information and product details.
- Real-time camera access using device's camera
- Image capture and analysis
- AI-powered product information extraction
- Responsive design for mobile use
- Cloudflare Pages deployment support
- Node.js (LTS version)
- Google Cloud Platform account with Generative AI API access
- Cloudflare account (for deployment)
- Clone the repository
- Install dependencies:
npm install
- Copy
.env.exampleto.envand add your Google Generative AI API key:GEMINI_API_KEY=your_api_key_here
- For local development:
npm run dev
-
Install Wrangler CLI:
npm install -g wrangler
-
Login to Cloudflare:
wrangler login
-
Set up your API key as a secret:
wrangler secret put GEMINI_API_KEY
-
Deploy to Cloudflare Pages:
npm run deploy
The application is built with:
- SvelteKit for the frontend framework
- TypeScript for type safety
- Google's Generative AI for image analysis
- Cloudflare Pages for hosting and serverless functions
src/
├── app.d.ts # TypeScript declarations
├── app.html # HTML template
└── routes/
├── +page.svelte # Main page with camera interface
└── api/
└── analyze/ # Image analysis endpoint
└── +server.ts
MIT
https://developers.cloudflare.com/workers/configuration/secrets/
npx wrangler pages secret put VITE_TALK_PASSWORD
npx wrangler pages secret put VITE_REMOTE_LOGGER_PASSWORD
npx wrangler pages secret put VITE_GEMINI_API_KEY