Skip to content

hectorvh/beleaf

Repository files navigation

Group 6 — BeLeaf (Tea Tracker)

BeLeaf is a vintage-inspired tea-tracking app that helps you record, discover, and map your tea journey. Save tasting notes, rate teas, and visualize both origin and tasting locations on an interactive map.

Stack: React (Vite, TypeScript, Tailwind, shadcn-ui) + FastAPI (Python) + Supabase.


Project structure

beleaf/
├── src/              # Frontend (pages, components, lib, integrations)
├── backend/          # FastAPI app (main.py, requirements.txt)
├── supabase/         # SQL migrations (tables, PostGIS, RLS)
├── public/           # Static assets
├── notebooks/        # Jupyter notebook (manual DB entry, maps)
└── app.py            # Streamlit data-entry UI (optional)

Prerequisites

  • Node.js 18+
  • Python 3.11 or 3.12
  • Supabase project

First Prototype

python -m streamlit run app.py

Run locally

1. Clone

git clone https://zivgitlab.uni-muenster.de/cvmls/itsp-2025/group-6.git
cd group-6

2. Database (Supabase)

In Supabase Dashboard → SQL Editor, run the migrations in order:

  • supabase/migrations/001_initial_schema.sql — PostGIS, origin_teas, tasted, RLS
  • supabase/migrations/002_un_countries_and_tea.sql — reference data (optional)
  • supabase/migrations/003_origin_teas_link_un_countries_geom.sql — linking (optional)

3. Backend

cd backend
python -m venv venv
# Windows: venv\Scripts\activate
# macOS/Linux: source venv/bin/activate
pip install -r requirements.txt

Create backend/.env:

SUPABASE_DB_URL=postgresql://postgres:YOUR_PASSWORD@YOUR_PROJECT_REF.supabase.co:5432/postgres

Start (run from the backend directory):

cd backend
uvicorn main:app --reload --port 8000

API: http://localhost:8000 — Docs: http://localhost:8000/docs

4. Frontend

From project root:

npm install

Create .env in the project root:

VITE_SUPABASE_URL=https://YOUR_PROJECT.supabase.co
VITE_SUPABASE_ANON_KEY=your_anon_key
VITE_API_BASE_URL=http://localhost:8000

Start:

npm run dev

Open http://localhost:8080 (Vite is configured for port 8080). Sign up or log in via the app.


API endpoints

All require Authorization: Bearer <token> (Supabase session token).

Method Path Description
POST /api/teas Create tea
GET /api/teas List teas (query: tea_type, rating, from_date, to_date)
GET /api/teas/{tea_id} Get one tea
PUT /api/teas/{tea_id} Update tea
DELETE /api/teas/{tea_id} Delete tea
GET /api/map/origin Origin points for map
GET /api/map/tasted Tasted points for map

Environment variables

Frontend (root .env)

Variable Description
VITE_SUPABASE_URL Supabase project URL
VITE_SUPABASE_ANON_KEY Supabase anon (public) key
VITE_API_BASE_URL Backend base URL (e.g. http://localhost:8000)
VITE_APP_URL (Optional) App URL for OAuth redirect; e.g. https://beleaf-pro.netlify.app. If unset, uses current origin.

Backend (backend/.env)

Variable Description
SUPABASE_DB_URL Postgres connection string (Supabase Dashboard → Settings → Database)

Use the anon key in the frontend; never expose the service_role key in client code.


Other commands

  • Build frontend: npm run build
  • Preview build: npm run preview
  • Seed UN countries and tea data: npm run seed:un-tea
  • Streamlit data entry (writes to DB): streamlit run app.py (requires DB password in sidebar)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors