in pratica il sito web dell'emporio del bread and roses bari
  • Python 48%
  • HTML 32.4%
  • CSS 16.5%
  • JavaScript 2.6%
  • Mako 0.3%
  • Other 0.2%
Find a file
2026-06-29 16:21:49 +02:00
alembic infra: added alembic migrations 2026-06-08 18:00:16 +02:00
src/emporio docs: fixed title 2026-06-29 16:21:49 +02:00
tests test: made some tests??? 2026-06-06 03:26:12 +02:00
.dockerignore infra: implemented build stuff 2026-06-08 17:18:56 +02:00
.env.example infra: switched to explicit .env 2026-06-08 17:48:14 +02:00
.gitignore infra: updated gitignore to avoid uploading silly images 2026-06-08 16:29:11 +02:00
alembic.ini feat: .... first commit????? lol 2026-06-05 00:16:26 +02:00
docker-compose.yml infra: switched to explicit .env 2026-06-08 17:48:14 +02:00
docker-entrypoint.sh infra: implemented build stuff 2026-06-08 17:18:56 +02:00
Dockerfile infra: implemented build stuff 2026-06-08 17:18:56 +02:00
pyproject.toml feat: email sending???????? 2026-06-08 17:24:23 +02:00
README.md infra: switched to explicit .env 2026-06-08 17:48:14 +02:00
TODO.md feat: added info pages 2026-06-29 15:51:07 +02:00
uv.lock feat: email sending???????? 2026-06-08 17:24:23 +02:00

Bread & Roses Emporio — FastAPI

il sito web del bread and roses di bari! scritto con: FastAPI + HTMX + Jinja2 + SQLAlchemy.

no cose strane no framework javascript

Stack

  • FastAPI — HTTP server
  • Jinja2 — server-rendered templates
  • HTMX — dynamic interactions (cart, inline admin forms) via CDN
  • SQLAlchemy — ORM, SQLite backend
  • Alembic — migrations
  • itsdangerous — signed cart cookie
  • Resend — transactional email (order confirmations)

Local development

# 1. Install deps
uv sync

# 2. Copy env file and edit
cp .env.example .env

# 3. Run migrations
uv run alembic upgrade head

# 4. Start dev server
uv run uvicorn emporio.main:app --reload

Open http://localhost:8000 — admin at http://localhost:8000/admin/login

Deploy with Docker Compose

# 1. Edit the environment block in docker-compose.yml
#    (ADMIN_PASSWORD, SECRET_KEY, RESEND_API_KEY at minimum)

# 2. Build and start
docker compose up --build -d

# Logs
docker compose logs -f

# Stop
docker compose down

The container runs alembic upgrade head automatically on every start before uvicorn comes up, so migrations are applied on first boot and are a no-op on subsequent restarts.

All mutable data (SQLite DB, uploaded images, settings) is stored in a named Docker volume (appdata) mounted at /data inside the container. It survives docker compose down and rebuilds.

To back up:

docker cp $(docker compose ps -q web):/data ./backup

Environment variables

Variable Default Description
DATABASE_URL ./local.db SQLite file path — use /data/local.db in Docker
ADMIN_USERNAME admin Admin login username
ADMIN_PASSWORD changeme Admin login password — change in production
SECRET_KEY dev key Signs the cart cookie and sessions — change in production
UPLOAD_DIR static/uploads/ Where uploaded images are saved — use /data/uploads in Docker
DATA_DIR .data/ Where settings.json is saved — use /data in Docker
RESEND_API_KEY (empty) Resend API key — leave empty to disable email
FROM_EMAIL noreply@breadandrosesbari.org Sender address (must be a verified domain in Resend)

For Docker, set the path variables in .env:

DATABASE_URL=/data/local.db
UPLOAD_DIR=/data/uploads
DATA_DIR=/data