Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Split from coop monolith. Includes: - Market/browse/product blueprints - Product sync API - Suma scraping pipeline - Templates for market, browse, and product views - Dockerfile and CI workflow for independent deployment
1.7 KiB
1.7 KiB
Market App
Product browsing and marketplace application for the Rose Ash cooperative.
Overview
The Market app is one of three microservices split from the original coop monolith:
- coop (:8000) - Blog, calendar, auth, settings
- market (:8001) - Product browsing, categories, product detail
- cart (:8002) - Shopping cart, orders, payments
Architecture
- Framework: Quart (async Flask)
- Database: PostgreSQL 16 with SQLAlchemy 2.0 (async)
- Cache: Redis (tag-based page cache)
- Frontend: HTMX + Jinja2 + Tailwind CSS
- Data: Products scraped from Suma Wholesale
Blueprints
bp/market/- Market root (navigation, category listing)bp/browse/- Product browsing with filters and infinite scrollbp/product/- Product detail pagesbp/api/- Product sync API (used by scraper)
Development
# Install dependencies
pip install -r requirements.txt
# Set environment variables
export $(grep -v '^#' .env | xargs)
# Run migrations
alembic upgrade head
# Scrape products
bash scrape.sh
# Run the dev server
hypercorn app:app --reload --bind 0.0.0.0:8001
Scraping
# Full scrape (max 50 pages, 200k products, 8 concurrent)
bash scrape.sh
# Test scraping
bash scrape-test.sh
Docker
docker build -t market .
docker run -p 8001:8000 --env-file .env market
Environment Variables
DATABASE_URL_ASYNC=postgresql+asyncpg://user:pass@localhost/coop
REDIS_URL=redis://localhost:6379/0
SECRET_KEY=your-secret-key
SUMA_USER=your-suma-username
SUMA_PASSWORD=your-suma-password
APP_URL_COOP=http://localhost:8000
APP_URL_MARKET=http://localhost:8001
APP_URL_CART=http://localhost:8002