Quickstart Guide
This guide will walk you through creating your first Framefox application from scratch. You’ll have a working web app in just a few minutes.Prerequisites
Before you begin, make sure you have:- Python 3.12 or higher installed
- pip package manager
- A terminal or command prompt
Step 1: Install Framefox
Install via pip
Install Framefox using pip:This will install Framefox and all its dependencies, including FastAPI, SQLModel, Uvicorn, and Jinja2.
Step 2: Initialize Your Project
Create a new project
Use the interactive CLI to create a new project:The CLI will prompt you for:
- Project name: Enter your project name (e.g., “my-app”)
- Database type: Choose between SQLite, PostgreSQL, or MySQL
- Include examples: Choose whether to include example code
Step 3: Project Structure
After initialization, your project will have this structure:Step 4: Start the Development Server
Step 5: Create Your First Controller
Let’s create a simple controller to display a “Hello World” page.Generate a controller
Use the CLI to generate a new controller:When prompted:
- Controller name: Enter “Hello”
- Type: Choose “Templated” (for HTML views)
Step 6: Add a Database Model
Now let’s add a simple database model and perform CRUD operations.Create an entity
Generate a new entity (database model):When prompted:
- Entity name: Enter “Post”
- Add properties: Add “title” (string) and “content” (text)
Create a migration
Generate a database migration for your new entity:Enter a description like “Create post table”.
Step 7: Create a Repository
Repositories provide a clean interface for database operations.src/repository/post_repository.py
Step 8: Use the Repository in a Controller
Update your controller to work with the database:src/controllers/post_controller.py
Notice how
PostRepository is automatically injected into the controller methods through dependency injection!Next Steps
Congratulations! You’ve created your first Framefox application. Here’s what to explore next:Core Concepts
Learn about MVC architecture and how Framefox works
Controllers
Master routing, responses, and forms
Templates
Build dynamic views with Jinja2
Database & ORM
Work with entities, repositories, and migrations
Security
Add authentication and protect your app
CLI Reference
Explore all available CLI commands
Common Commands
Here are some commands you’ll use frequently:| Command | Description |
|---|---|
framefox run | Start development server |
framefox create controller | Generate a new controller |
framefox create entity | Generate a new entity |
framefox create crud | Generate full CRUD (controller + templates) |
framefox database create-migration | Create a database migration |
framefox database upgrade | Run pending migrations |
framefox debug router | List all registered routes |
Getting Help
Development server won't start
Development server won't start
- Check that port 8000 is not already in use
- Verify your
.envfile has correct settings - Run
framefox debug configto check configuration
Database connection errors
Database connection errors
- Verify database credentials in
.env - Ensure the database server is running
- Check
config/orm.yamlfor correct configuration
Import errors
Import errors
- Make sure you’re in the correct directory
- Verify all dependencies are installed:
pip install -r requirements.txt - Check Python version is 3.12 or higher
Templates not found
Templates not found
- Ensure templates are in the
templates/directory - Check template path in your controller matches the file location
- Template paths are relative to the
templates/directory
Resources
- Installation Guide - Detailed installation instructions
- Architecture Overview - Understand how Framefox works
- GitHub Repository - Source code and examples