Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
cache-dependency-path: frontend/pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm exec tsc --noEmit
- run: pnpm typecheck
- run: pnpm build

containers:
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Cookable turns the ingredients you already have into a recipe. Enter what's in y

| Layer | Technologies |
|---|---|
| Frontend | Next.js 15 (static export), React 19, TypeScript, Tailwind CSS 4 |
| Frontend | React 19, TypeScript, Vite, Tailwind CSS 4 |
| Backend | Python 3.12, FastAPI, Pydantic, SQLAlchemy, SQLite |
| AI | Google Gemini (`gemini-2.5-flash`) via LangChain |
| Testing | pytest with a fake LLM (no API key or network needed) |
Expand All @@ -27,13 +27,13 @@ Cookable turns the ingredients you already have into a recipe. Enter what's in y

```mermaid
flowchart LR
U[Browser] -->|static files| F[Frontend<br/>Next.js static export<br/>served by nginx]
U[Browser] -->|static files| F[Frontend<br/>React SPA built with Vite<br/>served by nginx]
U -->|REST /api/v1| B[Backend<br/>FastAPI]
B -->|structured output| G[Google Gemini]
B --> D[(SQLite)]
```

The frontend is a fully client-side Next.js app exported to static files, so it can be served by any static host. All AI work happens in the FastAPI backend, which keeps the API key on the server.
The frontend is a fully client-side React app that Vite builds to static files, so it can be served by any static host. All AI work happens in the FastAPI backend, which keeps the API key on the server.

## Quick Start (Docker / Podman)

Expand Down Expand Up @@ -79,7 +79,7 @@ pnpm install
pnpm dev
```

The frontend calls `http://localhost:8000/api/v1` by default. Set `NEXT_PUBLIC_API_URL` (see `frontend/.env.example`) to point it elsewhere.
The frontend calls `http://localhost:8000/api/v1` by default. Set `VITE_API_URL` (see `frontend/.env.example`) to point it elsewhere.

## Configuration

Expand Down Expand Up @@ -143,7 +143,7 @@ Cookable/
│ └── Dockerfile
├── frontend/
│ ├── src/
│ │ ├── app/ # Next.js App Router pages
│ │ ├── App.tsx # Root component
│ │ ├── components/ # React components
│ │ ├── services/ # API client
│ │ └── types/ # TypeScript types
Expand Down
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
context: ./frontend
args:
# Called from the browser, so it must be reachable from the host
NEXT_PUBLIC_API_URL: http://localhost:8000/api/v1
VITE_API_URL: http://localhost:8000/api/v1
ports:
- "3000:8080"
depends_on:
Expand Down
4 changes: 1 addition & 3 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
node_modules/
.next/
out/
dist/
.env*
!.env.example
*.tsbuildinfo
2 changes: 1 addition & 1 deletion frontend/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1
VITE_API_URL=http://localhost:8000/api/v1
25 changes: 3 additions & 22 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,42 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# build output
/dist

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*
!.env.example

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
13 changes: 6 additions & 7 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
# Build stage: install dependencies and produce the static export in out/
# Build stage: install dependencies and produce the static build in dist/
FROM docker.io/library/node:22-alpine AS build

RUN npm install -g pnpm@12.15.0

WORKDIR /app

COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile

COPY . .

# NEXT_PUBLIC_* variables are inlined into the JavaScript bundle at build time
ARG NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL \
NEXT_TELEMETRY_DISABLED=1
# VITE_* variables are inlined into the JavaScript bundle at build time
ARG VITE_API_URL=http://localhost:8000/api/v1
ENV VITE_API_URL=$VITE_API_URL
RUN pnpm build

# Runtime stage: serve the static files with an unprivileged nginx
FROM docker.io/nginxinc/nginx-unprivileged:1.29-alpine

COPY --from=build /app/out /usr/share/nginx/html
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 8080
22 changes: 22 additions & 0 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import js from "@eslint/js";
import { defineConfig, globalIgnores } from "eslint/config";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import globals from "globals";
import tseslint from "typescript-eslint";

export default defineConfig([
globalIgnores(["dist"]),
{
files: ["**/*.{ts,tsx}"],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],
languageOptions: {
globals: globals.browser,
},
},
]);
16 changes: 0 additions & 16 deletions frontend/eslint.config.mjs

This file was deleted.

17 changes: 17 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="/favicon.ico" />
<title>Cookable – AI Recipe Recommender</title>
<meta
name="description"
content="Turn the ingredients you already have into a recipe, powered by Google Gemini."
/>
</head>
<body class="antialiased">
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
9 changes: 0 additions & 9 deletions frontend/next.config.ts

This file was deleted.

29 changes: 18 additions & 11 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,34 @@
"version": "0.1.0",
"private": true,
"license": "AGPL-3.0-or-later",
"type": "module",
"packageManager": "pnpm@12.15.0",
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "eslint src"
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"lint": "eslint .",
"typecheck": "tsc -b"
},
"dependencies": {
"next": "^15.5.28",
"@fontsource-variable/geist": "^5.3.0",
"react": "^19.3.1",
"react-dom": "^19.3.1"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@eslint/js": "^10.0.1",
"@tailwindcss/vite": "^4.3.3",
"@types/node": "^22.20.5",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "^15.5.28",
"@vitejs/plugin-react": "^6.1.2",
"eslint": "^10.13.0",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.7",
"globals": "^17.13.0",
"tailwindcss": "^4",
"typescript": "^5"
"typescript": "^5",
"typescript-eslint": "^8.72.0",
"vite": "^8.3.5"
}
}
Loading
Loading