A Finnish food diary app powered by the Fineli food database. Log meals via natural language (e.g. "kaurapuuroa ja maitoa"), get nutrient summaries, and export to Excel.
- Tech: Next.js 16, React 19, Drizzle ORM, PostgreSQL, Tailwind CSS
- Privacy: Tietosuojaseloste / Privacy Policy
- License: MIT
- Node.js 20+
- pnpm (or npm / yarn)
- Docker (for PostgreSQL)
-
Clone and install
git clone https://github.com/YOUR_USERNAME/fineli-ai.git cd fineli-ai pnpm install -
Environment variables
Copy the example env and edit as needed:
cp .env.example .env.local
Required:
SESSION_SECRET— secret for signing session cookies (e.g.openssl rand -hex 32)DATABASE_URL— PostgreSQL connection string (Render sets this automatically when you add a Postgres instance)
Optional:
NEXT_PUBLIC_APP_URL— public app URL (defaulthttp://localhost:3000)FINELI_API_BASE_URL— Fineli API base (defaulthttps://fineli.fi/fineli/api/v1)- AI: set
AI_PROVIDERandOPENAI_API_KEYorANTHROPIC_API_KEYfor AI-powered parsing/ranking
-
Database
Start PostgreSQL via Docker and push the schema:
docker compose up -d pnpm db:push pnpm db:seed
-
Run
pnpm dev
Open http://localhost:3000.
| Command | Description |
|---|---|
pnpm dev |
Start dev server |
pnpm build |
Production build |
pnpm start |
Start production server |
pnpm db:push |
Push schema to database |
pnpm db:seed |
Seed export template |
pnpm test:run |
Run unit tests |
Render offers a free PostgreSQL instance and free-tier web services.
A render.yaml in the repo defines a Web Service and a free PostgreSQL database. After connecting the repo to Render:
- In the Render Dashboard, go to Blueprints and create a new Blueprint from this repo.
- Render will create the PostgreSQL database and the Web Service, and link
DATABASE_URLautomatically. - Set SESSION_SECRET in the Web Service environment (e.g. generate with
openssl rand -hex 32). - Deploy. The build runs
pnpm db:pushandpnpm db:seedbeforepnpm build.
- Create a PostgreSQL database (Dashboard → New → PostgreSQL). Copy the Internal Database URL.
- Create a Web Service, connect the repo, set:
- Build:
pnpm install && pnpm db:push && pnpm db:seed && pnpm build - Start:
pnpm start - Env:
SESSION_SECRET(required),DATABASE_URL= the Internal Database URL from step 1.
- Build:
After deploy, set NEXT_PUBLIC_APP_URL to your service URL if you use auth callbacks or absolute links.
When deployed, you can allow only magic link login (no anonymous users):
-
In the Web Service environment, set:
REQUIRE_MAGIC_LINK=trueNEXT_PUBLIC_REQUIRE_MAGIC_LINK=trueNEXT_PUBLIC_APP_URL= your Render service URL (e.g.https://fineli-ai.onrender.com)
-
Sending email: Render's free tier blocks outbound SMTP. Use an HTTP-based provider instead:
- Resend (recommended): free tier 3,000 emails/month. Sign up, create an API key, add
RESEND_API_KEYto the Web Service. Optionally setRESEND_FROM(e.g.Ruokapäiväkirja <noreply@yourdomain.com>); otherwise Resend's default sender is used. - Alternatives: SendGrid, Mailgun, Postmark (each has a free tier and HTTP API).
- Resend (recommended): free tier 3,000 emails/month. Sign up, create an API key, add
Without RESEND_API_KEY, magic link emails are only logged in development; in production the API returns 503 until email is configured.
src/app/— Next.js App Router (pages, API routes)src/components/— React UI componentssrc/lib/— DB client, auth, Fineli client, conversation engine, AI, utilssrc/types/— Shared TypeScript types
MIT. See LICENSE.