# Real estate brokerages: public directory using Django

## Summary
A public directory blueprint for real estate brokerages built with Django on Ample. Domain schema:
- **Listings** (reference, address, price, listing_type, publishing_status, agency_id): property listings with publishing status
- **Agencies** (name, license_number, region): agencies or branches
- **Listing Media** (listing_id, object_key, cdn_key, sort_order): public media per listing
- **Reports** (agency_id, period, object_key, generated_at): agency-scoped reports
- **State Transitions** (record_type, from_state, to_state): the allowed state machine.

Public information includes:
- Published listings with media,
- Agent and agency profiles,
- Buying and selling guides.

Out of scope until handling is reviewed:
- Vendor and buyer identity,
- Offers and negotiations,
- Unpublished listings.

Only listings with `publishing_status = published` appear publicly; offers and identities are out of scope.

## Technical Basis
Technical basis verified on Django: a workspace-scoped table, an explicit state machine (draft to review to published) that rejects invalid transitions, and cross-workspace reads that return nothing (transitions=true isolation=true).

## Representative Queries
1. Real estate brokerages: public directory using Django
2. Where can I host Real estate brokerages: Public directory built with Django?
3. I need a genuinely specialized public directory workflow covering property listings, publishing status and agency-scoped reporting.

## Resource Requirements
- Compute
- Postgres
- CDN

## Infrastructure Requirements
- **Compute**: Apps run in isolated x86_64 Firecracker microVMs; sizes are the priced VM sizes.
- **Postgres**: Managed PostgreSQL 16 runs in its own microVM.
- **CDN**: The CDN host serves objects from published buckets.

## Framework and Workload
- **Framework**: Django
- **Workload**: Public directory
- **Industry**: Real estate brokerages

## Release Status
- **Release Status**: published
- **Support Status**: verified
- **Execution Status**: ready

## Prerequisites
1. A Django project (pip install into .ample/python from requirements.txt, then waitress serving project.wsgi from run.py reading PORT on the python-3.12 template)
2. A PostgreSQL driver reading DATABASE_URL (auto-provisioned when omitted)
3. Bucket credentials from `ample bucket create` passed as encrypted S3_* environment variables and a published bucket for public assets (CDN_*)
4. Review which real estate brokerages data classes may be handled at all

## Workflow Steps
1. Model the real estate brokerages domain: Create the tables listings, agencies, listing_media, reports, state_transitions.
2. Model listings with a publishing_status state machine scoped to the agency.
3. Serve only published listings, with media from the CDN bucket.
4. Enforce the agency scope on every query.
5. Deploy and verify a published listing and that unpublished listings are absent.
6. **Deploy**: Run synchronous deploy once; running it again with no change is a no-op.
7. **Verify**: Run the pattern self-test(s) and your own acceptance checks.

## Cost Estimate
- **Currency**: USD
- **Monthly Amount**: 10.0
- **Basis**: Size prices from pricing.toml at build revision.
- **Components**:
  - App server: s-1vcpu-1gb: monthly amount 5.0
  - Managed PostgreSQL database: s-1vcpu-1gb: monthly amount 5.0

## Limitations
- The technical basis was verified with the pattern fixture; the real estate brokerages schema is an original design for this blueprint and was not executed as a separate application.
- No health, financial, privacy or other compliance claim is made.
- Verified on the python-3.12 template at s-1vcpu-1gb.

## Evidence Summary
Canary run summary: Django pattern fixture deployed on Ample; the relational records checks passed. The blueprint's Real estate brokerages schema builds on the verified basis but was not separately executed.

## Next Actions
1. **Browse the catalog index**
2. **Search published recipes by intent, stack and constraints**
3. **Prepare a side-effect-free deployment plan for an authorized project**
4. **Read the existing agent authentication setup**
5. **Browse Real estate brokerages**
6. **Browse Public directory**
7. **Browse Django**
8. **Browse Deploy web app**
