Getting Started with prei¶
This tutorial will walk you through setting up the prei application and creating your first property analysis with the custom design system and underwriting engine.
Prerequisites¶
Before you begin, ensure you have:
- Python 3.14 or higher installed
- Git installed
- Basic familiarity with command-line interfaces
- (Optional) Docker and Docker Compose for containerized deployment
Step 1: Clone the Repository¶
First, clone the repository to your local machine:
Step 2: Set Up Your Environment¶
Option A: Local Development with Virtual Environment¶
Create and activate a Python virtual environment:
Install the required dependencies:
Option B: Docker Compose (Recommended)¶
If you prefer containerized development, you can use Docker Compose:
This starts the web application with SQLite. The entrypoint automatically runs migrations and seeds the demo user — no extra commands needed.
Step 3: Configure Environment Variables¶
Copy the example environment file and customize it:
Edit the .env file to set your configuration:
DEBUG=True
SECRET_KEY=your-secure-secret-key-here
ALLOWED_HOSTS=localhost,127.0.0.1
# For local development (SQLite)
# Leave DATABASE_URL commented out to use SQLite
# For PostgreSQL (local)
# DATABASE_URL=postgres://postgres:postgres@localhost:5432/investor_db
# For Docker Compose
DATABASE_URL=postgres://postgres:postgres@db:5432/investor_db
Important: Generate a secure SECRET_KEY using:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
Step 4: Initialize the Database¶
The entrypoint runs migrations and seeds the demo user automatically on container start.
# Local development
python manage.py migrate
python manage.py seed_data
# Docker Compose (entrypoint handles it — just start the container)
docker compose up -d
Step 5: Load Sample Data (Optional, if not auto-seeded)¶
If the entrypoint didn't run (e.g. local virtualenv), seed the demo user manually:
This creates a demo user and sample properties:
- Email: demo@prei.dev
- Password: DemoPass123!
Create a Superuser (Optional — for Django Admin access)¶
Create an admin account to access the Django admin interface:
# Local development
python manage.py createsuperuser
# Docker Compose
docker compose exec web python manage.py createsuperuser
Step 6: Start the Development Server¶
Launch the Django development server:
# Local development
python manage.py runserver
# Docker Compose (already running)
# Access at http://localhost:8000
The application will be available at http://localhost:8000.
Step 7: Explore the Application¶
- Dashboard — Visit
http://localhost:8000/to see the deal screener dashboard with KPI grid, colour-coded verdicts, and property list - Add a Property — Use the property entry form (
/properties/add/) with styled inputs and responsive form grids - BRRRR Calculator — Navigate to
/brrrr/to try the fully client-side BRRRR calculator - Markets — Browse
/markets/for market intelligence scores per ZIP - Admin Interface — Navigate to
http://localhost:8000/adminfor Django admin access
UI/UX Highlights¶
The interface is built on a custom design system with:
- CSS custom property tokens (
tokens.css) — semantic colors, spacing, typography - Component classes —
.card,.kpi-grid,.data-table,.verdict-badge,.score-bar,.tab-bar,.brrrr-banner,.empty-state - Responsive layout — 4-column → 2-column → 1-column at 640px / 400px breakpoints
- No Bootstrap — zero third-party CSS frameworks
- Widget base classes —
StyledNumberInput,StyledTextInput,StyledSelectauto-apply CSS incore/forms.py - Python-driven colors —
score.coc_color_classproperties return CSS class names; no threshold logic in templates
Step 8: Add Your First Property¶
- Click Add Property from the dashboard or navigate to
/properties/add/ - Fill in the property details:
- Address, city, state, zip code
- Purchase price and date (e.g. $200,000)
- Square footage and number of units
- Financing details (down payment %, interest rate, loan term)
- Operating expenses (taxes, insurance, HOA, maintenance, capex)
- Save the property
- The dashboard will now show the property with its underwriting score and verdict
Step 9: View Investment Analysis¶
Each property receives a full underwriting scorecard:
- Underwriting Score — 0–100 composite score
- Verdict — "Strong Buy", "Conditional", or "Pass"
- Metrics — CoC, Cap Rate, DSCR, GRM, After-Tax CoC, IRR
- Flags — Any failing criteria with explanations
- Color coding — Green (good), amber (warning), red (bad)
Next Steps¶
Now that you have the application running, explore these guides:
- Using the BRRRR Calculator
- Understanding Financial KPIs
- Importing Bulk Data
- Running Tests
- Design System Reference
Troubleshooting¶
Database Connection Issues¶
If you encounter database connection errors:
- Local: Ensure PostgreSQL is running, or remove
DATABASE_URLfrom.envto use SQLite - Docker: Verify the database service is healthy with
docker compose ps
Missing Static Files¶
If the UI appears unstyled or tests fail with Missing staticfiles manifest entry:
Migration Errors¶
If migrations fail:
# Check migration status
python manage.py showmigrations
# Reset migrations (development only!)
python manage.py migrate core zero
python manage.py migrate
Port Already in Use¶
If port 8000 is already in use:
Getting Help¶
If you encounter issues not covered here, please:
- Check the How-to Guides for specific tasks
- Review the Reference documentation
- Open an issue on GitHub