Run artifact

workspace/targets/ReadingList/blueprint/ARCHITECTURE.md

ARCHITECTURE: ReadingList

FieldValue
Version20261023 V1
DescriptionModules, boundaries, and technical decisions for the ReadingList Flask web application.
Depends OnNone
Providesproject tree, pytest -q

Purpose

ReadingList is a single-reader web application. A reader adds a book with a title and author, views books in the order added, and removes books. Empty titles or authors are rejected with a clear error. The application ships automated tests and a POSIX bin/test.sh.

Technology Stack

Derived from TECHNOLOGY_STACK.md; that file is the decision of record.

TechnologyWhere it applies
PythonImplementation language; project tree and environment.
FlaskWeb framework; application factory app_server.create_app().
SQLitePersistence through the generated persistence package.
pytestAutomated tests, run as pytest -q.
HTML/CSSServer-rendered pages with minimal CSS, no client-side JavaScript.

Project Layout

PathRole
pyproject.toml, uv.lockDependency manifest (Flask, pytest) and committed lockfile.
.venvEnvironment created by uv venv.
app_server/__init__.pycreate_app() -> Flask.
app_server/testing.pyweb_client() plain callable.
app_server/routes/Flask blueprints: JSON routes (books.py) and page routes (pages.py).
app_server/services/books.pyBook service: add_book, list_books, remove_book, validate_book_input.
app_server/templates/Jinja templates (base layout, reading list page).
persistence/Generated by Drydock from DATABASE.md; never hand-written.
tests/pytest suite with conftest.py exposing the web_client and db_session fixtures.
bin/test.shPOSIX test runner.

Module Ownership

BoundaryOwning moduleAllowed low-level access
Persistencepersistence (generated)The only module that touches SQLite.
Book rules and orchestrationapp_server.services.booksCalls db.books.<verb>(...) only.
HTTP routesapp_server.routesCall the service; never the database.
Configurationapp_server.__init__Resolves DATABASE_URL, then DATABASE_PATH, then data/app.db.
File stores / external servicesNoneNot used.

Layering

Routes call services; services call db.<table>.<verb>(...). SQL, sessions, table names, and column names never cross the persistence boundary. Books are always returned ordered by id ascending, which is the order added.

Technical Decisions

Programmatic Acceptance

=== AC architecture-manifest ===
Intent: pyproject.toml parses and declares Flask and pytest as dependencies.
Requires: executable=python3; scope=test

import tomllib from pathlib import Path

with open(Path("pyproject.toml"), "rb") as handle: data = tomllib.load(handle)

project = data["project"] declared = list(project.get("dependencies", [])) for group in data.get("dependency-groups", {}).values(): declared.extend(entry for entry in group if isinstance(entry, str)) declared.extend( entry for group in project.get("optional-dependencies", {}).values() for entry in group ) names = [entry.lower() for entry in declared] assert any(name.startswith("flask") for name in names) assert any(name.startswith("pytest") for name in names) === END AC architecture-manifest ===

=== AC architecture-tree ===
Intent: The lockfile, tests directory, and conftest exist at the application root.

from pathlib import Path

assert Path("uv.lock").is_file() assert Path("tests").is_dir() assert Path("tests/conftest.py").is_file() === END AC architecture-tree ===

=== AC architecture-pytest ===
Intent: The pytest runner is installed and starts from the application root.
Requires: python-package=pytest; scope=test

import subprocess import sys

result = subprocess.run( [sys.executable, "-m", "pytest", "--version"], capture_output=True, text=True, ) print(result.stdout) print(result.stderr, file=sys.stderr) assert result.returncode == 0 === END AC architecture-pytest ===

User Acceptance

Guardrails