This repository has been archived on 2026-02-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
giles 25fc3a933c
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m10s
Replace shared_lib submodule with shared for decoupling deploy
- Swap shared_lib submodule → shared (tracking decoupling branch)
- Dockerfile: shared_lib/ → shared/, remove bp symlink hack
- CI: trigger on decoupling branch, use dynamic ref_name

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 13:29:28 +00:00

Cart App

Shopping cart, checkout, and order management service for the Rose Ash cooperative marketplace.

Overview

This is the cart microservice, split from the Rose Ash monolith. It handles:

  • Shopping cart - Add/remove products, view cart, cart summary API
  • Checkout - SumUp payment integration with hosted checkout
  • Orders - Order listing, detail view, payment status tracking
  • Calendar bookings - Calendar entry cart items and checkout integration

Architecture

  • Framework: Quart (async Flask)
  • Database: PostgreSQL 16 via SQLAlchemy 2.0 (async)
  • Payments: SumUp Hosted Checkout
  • Frontend: HTMX + Jinja2 templates + Tailwind CSS

Directory Structure

app.py                  # Quart application factory
bp/
  cart/                 # Cart blueprint (add, view, checkout, webhooks)
    routes.py
    api.py              # Internal API (server-to-server, CSRF-exempt)
    login_helper.py     # Cart merge on login
    services/           # Business logic layer
  order/                # Single order detail blueprint
    routes.py
    filters/qs.py       # Query string helpers
  orders/               # Order listing blueprint
    routes.py
    filters/qs.py
templates/
  _types/cart/          # Cart templates
  _types/order/         # Single order templates
  _types/orders/        # Order listing templates
entrypoint.sh           # Docker entrypoint (migrations + server start)
Dockerfile              # Container build
.gitea/workflows/ci.yml # CI/CD pipeline

Running

# Set environment variables
export APP_MODULE=app:app
export DATABASE_URL_ASYNC=postgresql+asyncpg://user:pass@localhost/coop
export REDIS_URL=redis://localhost:6379/0
export SECRET_KEY=your-secret-key

# Run the server
hypercorn app:app --reload --bind 0.0.0.0:8002

Cross-App Communication

The cart app exposes internal API endpoints at /internal/cart/ for other services:

  • GET /internal/cart/summary - Cart count and total for the current session/user
  • POST /internal/cart/adopt - Adopt anonymous cart items after user login

Docker

docker build -t cart:latest .
docker run -p 8002:8000 --env-file .env cart:latest
Description
No description provided
Readme 417 KiB
Languages
Python 60%
HTML 38.2%
Dockerfile 0.9%
Shell 0.9%