Skip to content

Getting started

Welcome to Hyperflask! In this getting started guide will cover the basics and create a simple chat app with authentication.

The result of this tutorial is available as a git repository at https://github.com/hyperflask/getting-started.

Meet Hyperflask

Hyperflask is an opiniated full stack rapid web development framework. It uses Python on the backend, powered by the Flask framework and javascript with htmx on the frontend.

Hyperflask includes everything you need to develop an app from start to finish:

  • Easy backend development
  • UI framework and components
  • Sending emails
  • Background tasks
  • Deployment

Check out the full list of technologies used in Hyperflask on the Why Hyperflask page

What you will need to install and run Hyperflask

Hyperflask simplifies development environments by standardizing everything around containers.

VS Code is also the recommended editor (and currently the only one with syntax highlighting for Jinjapy files).

What you will need:

Python is not needed on your machine, everything will be executed inside containers.

Additional VS Code extensions will be suggested when you open a project:

Info

Although VS Code with dev containers is the recommended experience, it is not mandatory. If you decide not to use dev containers, make sure you have Python 3.10, uv and nodejs >= 22. See the setup guide for more information on how to run without VS Code or dev containers

Installation

Let your coding agent do it

Using a coding agent? Simply ask it to set up Hyperflask for you:

Set up a new Hyperflask project following https://hyperflask.dev/install.md

The agent will check the requirements, ask for your project options and create the project.

We will use Hyperflask-Start to create our project.

Launch the following command to create your project:

curl -L https://start.hyperflask.dev | bash

This will prompt you for some options and create the project in a new folder.

Open your project folder in VS Code. It should prompt you to "re-open workspace in development container" which you should accept. VS Code will create and start the development container and re-launch itself.

You are now developping from the container inside which you will find Python 3.13, NodeJS 24, uv and hyperflask installed.

Running your app

In a VS Code Terminal, type the following command to start a development server:

uv run hyperflask dev

Open your browser at http://localhost:5000. Auto-reload is enabled.

Note

If you are not using dev containers, run npm install before starting the dev server.

First look at the code base

In your project folder, you will find the following files and folders:

  • app: your app code
    • assets: scripts and stylesheets that will be bundled using esbuild
      • main.css: tailwind entrypoint
    • components: components to compose your app
    • pages: your site pages
  • public: all files in this folder are publicly accessible
  • tests: tests using pytest
  • .env: environment variables
  • config.yml: your app configuration file
  • Dockerfile: Dockerfile to build your production image
  • pyproject.toml: list python dependencies and tool options
  • package.json: list javascript dependencies

Starting our chat app

First, let's create a basic chat window with some messages. Replace the content of app/pages/index.jpy with the following:

{% use_layout %}
<div id="messages">
    <{ChatBubble}>First message!</{ChatBubble}>
    <{ChatBubble}>Second message!</{ChatBubble}>
</div>

This page is made of a jinja template. We are using the {% use_layout %} directive to automatically extend from the default layout.

We are using the built-in ChatBubble component that is provided by daisyUI and comes as part of Hyperflask UI toolkit.

Components are included on the page using a special jinja syntax.

Info

Note the jpy file extension which references the jinjapy file format.

Creating a re-usable component

Now that we have the basic layout of our app, let's extract the chat bubble as an independant component that will handle posting new messages.

We are going to create a ChatMessage component to render one message. In app/components/ChatMessage.jpy:

---
from hyperflask import request

def post():
    return {"message": request.form["message"