Python 1,315 FILES 13 FINDINGS

HOW REFLEX
ACTUALLY WORKS

Build full-stack web apps in pure Python. Conventions, patterns, and architecture extracted from the reflex-dev/reflex repository by sourcebook.

QUICK_REF:
Validation: @dataclass Testing: pytest Database: SQLAlchemy Framework: FastAPI

WHAT_MATTERS

  • FastAPI project — use Pydantic models for request/response schemas, not raw dicts

  • reflex/__init__.py is a hub file (imported by 53 files) — changes here ripple everywhere

  • This is both a monorepo and a publishable library — check workspace dependencies and avoid breaking the public API

KEY_FINDINGS

FastAPI project. Use Pydantic models for request/response schemas, not raw dicts.

HIGH

Uses SQLAlchemy/SQLModel for ORM. Database sessions must be properly closed (use dependency injection).

HIGH

Uses pytest. Test files should be named test_*.py or *_test.py.

HIGH
16 test files

This is a monorepo. Changes may affect multiple packages.

HIGH

Tests live in a separate test/ directory, mirroring src/ structure. New tests go there, not next to source files.

HIGH

This is a publishable library. Focus changes on the public API surface.

HIGH

Uses __init__.py as barrel exports. Import from the package, not from internal modules.

HIGH
14 non-empty __init__.py files

Use @dataclass for data structures.

HIGH
14 files use dataclasses

Database access uses SQLAlchemy. Look for schemas in models/.

HIGH
2 files

UI components live in: docs/app/assets/components.

HIGH
1 component directory

Hub files: reflex/__init__.py (53 files); reflex/vars/base.py (33 files); reflex/utils/__init__.py (29 files); reflex/components/component.py (29 files); reflex/event.py (22 files). Changes here have the widest blast radius.

HIGH

Circular imports: experimental/__init__.py; reflex_components_react_player/__init__.py; el/__init__.py. Avoid adding to these cycles.

HIGH
GENERATED IN ~3 SECONDS WITH

npx sourcebook init

VIEW ON GITHUB star

FROM_THE_BLOG

RELATED_REPOS