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.
Files
blog/README.md
giles 45b748eb6d
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 46s
README: replace vague cross-app section with actual code dependencies
List specific model imports, glue services, internal APIs, and
domain events that blog code actually references.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 19:47:45 +00:00

81 lines
3.1 KiB
Markdown

# Blog App (Coop)
Blog, authentication, and content management service for the Rose Ash cooperative platform. This is the primary "coop" app — it handles Ghost CMS integration, user auth, and admin settings.
## Architecture
One of four Quart microservices sharing a single PostgreSQL database:
| App | Port | Domain |
|-----|------|--------|
| **blog (coop)** | 8000 | Auth, blog, admin, menus, snippets |
| market | 8001 | Product browsing, Suma scraping |
| cart | 8002 | Shopping cart, checkout, orders |
| events | 8003 | Calendars, bookings, tickets |
## Structure
```
app.py # Application factory (create_base_app + blueprints)
path_setup.py # Adds project root + app dir to sys.path
config/app-config.yaml # App URLs, feature flags, SumUp config
models/ # Blog-domain models
ghost_content.py # Post, Tag, PostTag
ghost_membership_entities.py # GhostNewsletter, UserNewsletter
user.py # Re-export of shared User model
magic_link.py # Re-export of shared MagicLink model
kv.py # Re-export of shared KeyValue model
menu_item.py # MenuItem
snippet.py # Snippet
tag_group.py # TagGroup, TagGroupTag
bp/ # Blueprints
auth/ # Magic link login, account, newsletters
blog/ # Post listing, Ghost CMS sync
post/ # Single post view and admin
admin/ # Settings admin interface
menu_items/ # Navigation menu management
snippets/ # Reusable content snippets
coop_api.py # Internal API (/internal/coop/*)
templates/ # Jinja2 templates
entrypoint.sh # Docker entrypoint (runs alembic + starts server)
Dockerfile
shared/ # Submodule → git.rose-ash.com/coop/shared.git
glue/ # Submodule → git.rose-ash.com/coop/glue.git
```
## Dependencies
**Cross-app model imports:**
- `events.models.calendars.Calendar` — post routes and Ghost sync use calendars attached to pages
- `market.models.market_place.MarketPlace` — post admin manages marketplaces on pages
- `cart.models.page_config.PageConfig` — post admin manages per-page SumUp config
**Glue services:**
- `glue.services.navigation.get_navigation_tree` — context processor builds site nav
- `glue.services.relationships.attach_child / detach_child` — post admin attaches/detaches calendars and marketplaces to pages
**Internal APIs:**
- Calls `GET /internal/cart/summary` — context processor for cart widget
- Exposes `/internal/coop/*` — serves blog data to other apps
**Domain events:**
- `auth/routes.py` emits `user.logged_in` via `shared.events.emit_event`
## Running
```bash
export DATABASE_URL_ASYNC=postgresql+asyncpg://user:pass@localhost/coop
export REDIS_URL=redis://localhost:6379/0
export SECRET_KEY=your-secret-key
alembic -c shared/alembic.ini upgrade head
hypercorn app:app --bind 0.0.0.0:8000
```
## Docker
```bash
docker build -t blog .
docker run -p 8000:8000 --env-file .env blog
```