Skip to content

Project Setup - Your First Framefox App

Alright, let’s create your first Framefox project! We’re going to build GameVault from scratch, and I promise it’s way easier than you might think.

  1. Create your project

    First, let’s create our GameVault project:

    Create and initialize project
    # Create project directory
    mkdir gamevault
    cd gamevault
  2. Set up your environment 🐍

    Let’s create a virtual environment as recommended in the installation guide:

    Create virtual environment
    # Create a virtual environment
    python -m venv venv
    # Activate it (on Linux/Mac)
    source venv/bin/activate
    # Or on Windows
    venv\Scripts\activate
  3. Install Framefox 🚀

    Now, let’s install Framefox. If you haven’t already, follow the installation guide: framefox init

    Install Framefox
    # Install Framefox
    pip install framefox

    Or if you prefer the faster uv installer:

    Install with uv (faster)
    uv add framefox

    And then,

    Terminal window
    framefox init

    That’s it! Framefox just created a complete project structure for you. Pretty cool, right?

  4. Configure the database 🗄️

    Let’s set up our database. Edit the .env file that Framefox created:

    .env
    # App environment
    APP_ENV=dev
    SESSION_SECRET_KEY=your-very-secret-key-here
    # Database - We'll use SQLite for simplicity
    DATABASE_URL=sqlite:///gamevault.db
    # Mail (optional for now)
    # MAIL_URL=smtp://username:password@host:port?tls=true

    Now create the database:

    Create database
    framefox database create

    You should see: ✓ Database created successfully

  5. Your first look at the app 👀

    Let’s see what we’ve got! Start the development server:

    Start development server
    framefox run

    You should see something like:

    Server output
    🦊 Starting Framefox development server...
    INFO: Uvicorn running on http://127.0.0.1:8000

    Now open your browser and go to http://localhost:8000. You should see the Framefox welcome page!

    🎉 Congratulations! You just created and ran your first Framefox app!

  6. Create your first controller 📝

    Let’s create a homepage for GameVault. Framefox makes this super easy with the interactive terminal:

    Create controller
    framefox create controller

    When prompted:

    • Controller name: home

    That’s it! Framefox just created:

    • A controller file: src/controller/home_controller.py
    • A template file: templates/home/index.html

    Let’s look at what Framefox generated for us:

    src/controller/home_controller.py (generated)
    from framefox.core.routing.decorator.route import Route
    from framefox.core.controller.abstract_controller import AbstractController
    class HomeController(AbstractController):
    @Route("/home", "home.index", methods=["GET"])
    async def index(self):
    return self.render("home/index.html", {"message": "Welcome to Home"})
  7. Make it your homepage 🏠

    Let’s change the URL from /home to / to make it our main homepage. Edit src/controller/home_controller.py:

    src/controller/home_controller.py (update the route)
    from framefox.core.routing.decorator.route import Route
    from framefox.core.controller.abstract_controller import AbstractController
    class HomeController(AbstractController):
    @Route("/", "home.index", methods=["GET"]) # Changed from "/home" to "/"
    async def index(self):
    return self.render("home/index.html", {"message": "Welcome to GameVault!"})

    Now your GameVault homepage will be accessible at http://localhost:8000/ (the root URL)!

  8. Make it look like GameVault 🎮

    Let’s customize that homepage to look like a gaming app! Open templates/home/index.html and replace it with:

    templates/home/index.html
    <!DOCTYPE html>
    <html>
    <head>
    <title>GameVault - Your Gaming Collection</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
    <div class="container mt-5">
    <div class="text-center">
    <h1>🎮 Welcome to GameVault!</h1>
    <p class="lead">Your personal gaming collection manager</p>
    <div class="mt-4">
    <a href="#" class="btn btn-primary btn-lg">Get Started</a>
    </div>
    </div>
    </div>
    </body>
    </html>

    Refresh your browser at http://localhost:8000/ and… boom! 🎉 Your homepage now looks like a real gaming app!

Let’s take a moment to appreciate what we did:

  1. Installed Framefox - Using pip or uv
  2. Created a project - With proper structure
  3. Set up the database - SQLite, simple and effective
  4. Made our homepage - Controller + template at the root URL
  5. Customized the look - Bootstrap for beautiful styling

And the best part? We barely wrote any code! Framefox’s interactive terminal did most of the heavy lifting for us.

In the next chapter, we’ll:

  • Create our first database entity (for storing games)
  • Learn how Framefox handles data with the ORM
  • Add our first game to the collection

But for now, take a moment to celebrate! You’ve got a working web application. Not bad for a few minutes of work! 🎉

Ready to add some games to your vault? Let’s move on to Database Design! 🎮✨