Skip to content

Commit 4909198

Browse files
committed
Updated docs, added blog
1 parent 0670d3e commit 4909198

File tree

15 files changed

+167
-56
lines changed

15 files changed

+167
-56
lines changed

docs/blog/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
hide: [navigation, footer]
3+
---
4+
# Blog
5+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
date: 2025-09-24
3+
pin: true
4+
---
5+
# Launch annoncement
6+
7+
After 2 years of working on & off on Hyperflask, I'm happy to finally announce a working version that can be used to create actual production apps ! Although it is still in beta, all the desired features are present and working.
8+
9+
In reality, Hyperflask is more than 10 years in the making ! My previous attempt at a comprehensive framework went nowhere but some of its ideas survived. The rise of [htmx](https://htmx.org/) and the revival of backend driven apps led me to get excited again.
10+
11+
Backend-driven apps using something like htmx are not an answer to all type of web development. However, I'm convinced that they provide a solution for 80% of use cases (if not more) while simplying greatly the development experience, the cognitive load and the many footguns that frontend-heavy frameworks bring.
12+
13+
I love [Flask](https://flask.palletsprojects.com/) as a framework but unfortunately, a lot of Flask extensions are barely maintained. In the meantime, other frameworks have introduced amazing innovations that greatly simplify the developer experience. Hyperflask is my attempt at synthetizing all the parts I like across various technologies and frameworks in a coherent stack. Integration between each chosen technology should be completely seamless.
14+
15+
Among these innovations, notable ones are:
16+
17+
- [File-based routing](/guides/pages/) with a [new file format](https://github.com/hyperflask/jinjapy) that combines some python code and a jinja template, inspired by [Astro pages](https://docs.astro.build/en/basics/astro-pages/#astro-pages)
18+
- [A component system](/guides/components/) inspired by frontend frameworks and [Astro islands](https://docs.astro.build/en/concepts/islands/). It can be used to create frontend or backend components. Components can have their own endpoints.
19+
- Using streaming content to [display loaders](/guides/suspense/), inspired by [React Suspense](https://react.dev/reference/react/Suspense)
20+
- [Static content](/guides/static/) generation with collections, inspired by [Jekyll](https://jekyllrb.com/)
21+
22+
More than just a framework, **Hyperflask is a truly full stack solution**. From dev environments, to UI framework to deployments.
23+
On top of the previously mentionned features, Hyperflask provides:
24+
25+
- Deep integration with [htmx](https://htmx.org/)
26+
- An easy to use and [powerful ORM](https://github.com/hyperflask/sqlorm) that stays close to SQL
27+
- A large library of [UI components](/components/) powered by [Tailwind](https://tailwindcss.com/), [DaisyUI](https://daisyui.com/) and [Bootstrap Icons](https://icons.getbootstrap.com/)
28+
- A modern assets pipeline using [esbuild](https://esbuild.github.io/) with image optimizations
29+
- [Server push](/guides/push/) for realtime updates using SSE, based on the [Mercure protocol](https://mercure.rocks/)
30+
- [Template based emails](/guides/emails/) powered by [MJML](https://mjml.io/)
31+
- Background tasks
32+
- Translations
33+
- Dev environments based on [dev containers](https://containers.dev/)
34+
- Deployments using containers
35+
36+
All the technologies used by Hyperflask have been carefully selected for their quality, developer experience, ease of use, feature set and popularity.
37+
38+
The framework is optimized to limit "magic" features while ensuring ease of use. React Server Components or Phoenix LiveView are impressive but they hide too many things, often leading to many footguns and hacks around them. In Hyperflask, everything is just Python, standard Flask and Jinja with jinjapy files and htmx as the binding agent.
39+
40+
One of my side goals with Hyperflask is to revive and modernize the Flask ecosystem. As a result, **almost all of the features listed before have been developed as independent Flask extensions**. Hyperflask itself is mostly glue code to make them work together. [Pick and choose the extensions](https://github.com/hyperflask) you want for your own projects.
41+
42+
In the same spirit, there are some projects developed as part of Hyperflask that can be used indepently of Flask:
43+
44+
- [sqlorm](https://github.com/hyperflask/sqlorm), a performant and straighforward ORM that does not attempt to hide SQL
45+
- [jinjapy](https://github.com/hyperflask/jinjapy), a new file format that combines python code and a jinja template
46+
- [jinja-super-macros](https://github.com/hyperflask/jinja-super-macros), a new syntax to call macros in jinja
47+
- [uilib-spec](https://github.com/hyperflask/uilib-spec), a specification to generate bindings for UI component libraries (see [uilib-spec-daisyui](https://github.com/hyperflask/uilib-spec-daisyui) for a use case)
48+
- [docker-web-deploy](https://github.com/hyperflask/docker-web-deploy), a CLI tool to deploy containers to various platforms, including VPS
49+
50+
All these projects are available on the [Hyperflask Github organization](https://github.com/hyperflask).
51+
52+
Check out the [Getting Started](/getting-started) tutorial, read more about the [goals, technologies and reasoning](/why) behind the project or [deep dive into the guides](/guides/setup).
53+
54+
PS: I've already used Hyperflask to build [SQLify](https://sqlify.me/) as part of my job at [Digicoop](https://digicoop.io) and the experience was very satisfying.
55+
56+

docs/getting-started.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ What you will need:
3535

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

38+
!!! info
39+
Although VS Code with dev containers is the recommended experience, it is not mandatory. Hyperflask apps are standard python apps and you can install their requirements in a virtualenv and start a server using the CLI. See the [setup guide for more information on how to run without VS Code or dev containers](/guides/setup/#advanced)
40+
3841
## Installation
3942

4043
We will use [Hyperflask-Start](https://github.com/hyperflask/hyperflask-start) to create our project.
@@ -47,10 +50,7 @@ This will prompt you for some options and create the project in a new folder.
4750

4851
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.
4952

50-
You are now developping from the container inside which you will find Python 3.11, Node & npm and hyperflask installed.
51-
52-
!!! info
53-
Although VS Code with development containers is the recommended experience, it is not mandatory. Hyperflask apps are standard python apps and you can install their requirements in a virtualenv and start a server using the CLI.
53+
You are now developping from the container inside which you will find Python 3.13, NodeJS 24, uv and hyperflask installed.
5454

5555
## Running your app
5656

docs/guides/components.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Components are essentials pieces of Hyperflask apps. They can be interactive, ar
88
## HTML components
99

1010
HTML components are re-usable pieces of HTML. Define them in the *app/components* folder. The filename is the component name.
11+
They are rendered on the backend.
1112

1213
Components can recieve parameters named *props*.
1314

@@ -26,7 +27,7 @@ For example, to create a dropdown component, let's create the file *app/componen
2627

2728
Here, the component must be provided 2 parameters: label and items.
2829

29-
To call this component, we use a special syntax in our templates:
30+
To call this component, we use a [special syntax](https://github.com/hyperflask/jinja-super-macros?tab=readme-ov-file#new-macro-tags-syntax) in our templates:
3031

3132
- `<{ComponentName prop1=value prop2=value }/>` : to call a component without providing children
3233
- `<{ComponentName prop1=value }>...</{ComponentName}>` : to provide children

docs/guides/deploy.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
!!! info
44
This feature is provided by [Docker Web Deploy](https://github.com/hyperflask/docker-web-deploy)
55

6-
## Build & deploy
6+
## Build & deploy using Hyperflask-Start
77

88
Run the following command:
99

@@ -13,12 +13,25 @@ $ uv run hyperflask deploy
1313

1414
## Static site generation
1515

16-
TODO
16+
Run `hyperflask build`. You site will be generated in the `_site` folder.
1717

18-
## Only build the image
18+
!!! tip
19+
Use `hyperflask csp-header` to print the CSP policy to properly configure your web server.
20+
21+
## Building for production
22+
23+
### Only building the docker image
1924

2025
When using Hyperflask-Start, the app is containerized. Run `docker build .` to build the image.
2126

27+
### Without docker
28+
29+
Run `hyperflask build` to build assets and static content.
30+
31+
In production, assets will not be built and nodejs is not required. Ensure that the file `app/assets.json` and the `public` directory are shipped.
32+
33+
If you have static content, it will be generated in the *_site* folder. You can use a proxy server like nginx to serve urls from this folder first or fallback to your app for hybrid content mode.
34+
2235
## Monitoring
2336

2437
Check out the [recipe on monitoring](/recipes/monitoring).

docs/guides/for-flask-users.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ The `flask` module can be replaced by `hyperflask` for all your Flask related im
88

99
The `hyperflask` command should be used instead of `flask` to run and manage your app.
1010

11+
!!! warning
12+
Hyperflask loads its configuration from files. Configuration happens as part of the Hyperflask constructor. This means once you have created your app, it is already configured and extensions are already initialized. To provide configuration at app creation time, use `app = Hyperflask(__name__, config={"key": "value"})`
13+
1114
```py
1215
# app.py
1316
from hyperflask import Hyperflask, request

docs/guides/interactive-apps.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Hyperflask can be used to create interactive apps thanks to HTMX.
66

77
HTMX has [comprehensive documentation](https://htmx.org/docs/) but this section will cover the essential.
88

9+
TODO
910

1011
## Interactive components
1112

@@ -150,4 +151,8 @@ You can also add out of band elements in your template using the `<{HtmxOob}>` c
150151

151152
```
152153
<{HtmxOob}><{Sidebar}/></{HtmxOob}>
153-
```
154+
```
155+
156+
## Realtime apps
157+
158+
Add realtime updates to your app using [push messages](/guides/push).

docs/guides/metadata.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Metadata
22

3+
Hyperflask can manage a page metadata for you. This is necessary for SEO.
4+
35
TODO

docs/guides/push.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,34 @@ current_app.sse.publish("messages", current_app.components.ChatMessage(msg="hell
2121

2222
## Listening for events
2323

24-
Use htmx [sse extension](https://htmx.org/extensions/sse/) to connect to the SSE stream. Retrieve the stream URL for an event using `mercure_hub_url(event_names)`. Use `mercure_authentified_hub_url(event_names)` to create authentified URLs that can receive private events.
25-
26-
```html
27-
<div hx-ext="sse" sse-connect="{{mercure_authentified_hub_url('messages')}}" sse-swap="message" hx-swap="beforeend">
28-
</div>
29-
```
30-
31-
Hyperflask also provides a component that encapsulates the previous html:
24+
Hyperflask provides some components to leverage the htmx [sse extension](https://htmx.org/extensions/sse/).
3225

3326
```
3427
<{MercureStream topic="messages"}>
28+
{# default content #}
3529
</{MercureStream}>
3630
```
3731

38-
| Property | Required | Type | Description |
39-
|----------|----------|------|-------------|
32+
| Property | Required | Type | Description | Default |
33+
|----------|----------|------|-------------|---------|
4034
|topic|Yes|string|The topic name|
41-
|private|No|bool|Whether to use an authentified url|
42-
|hx_swap|string|The swap strategy (default: beforeend)|
43-
|type|string|The type of event to listen to (default: message)|
44-
|auto_scroll|bool|Whether to keep the div scrolled at the bottom when receiving new items|
45-
|Any additional properties|No|any||
35+
|private|No|bool|Whether to use an authentified url|False
36+
|hx_swap|No|string|The swap strategy|beforeend
37+
|type|No|string|The type of event to listen to|message
38+
|auto_scroll|No|bool|Whether to keep the div scrolled at the bottom when receiving new items|False
39+
|Any additional properties|||Will be used as attributes of the div|
40+
41+
To create a div which content will be replaced on each new message, use `hx_swap="innerHTML"`.
42+
43+
!!! info
44+
Using Hyperflask components is optional and htmx sse extension or any EventSource can be used directly.
45+
46+
Retrieve the stream URL for an event using `mercure_hub_url(event_names)`. Use `mercure_authentified_hub_url(event_names)` to create authentified URLs that can receive private events.
47+
48+
```html
49+
<div hx-ext="sse" sse-connect="{{mercure_authentified_hub_url('messages')}}" sse-swap="message" hx-swap="beforeend">
50+
</div>
51+
```
4652

4753
## Using with models
4854

docs/guides/scaling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Scaling
22

3-
Hyperflask is a standard Flask app. It is made of 4 different processes:
3+
Hyperflask is made of different processes. It uses [honcho](https://honcho.readthedocs.io/en/latest/) as process manager.
44

55
| Process | Description | Defaut port | Can be multiplied
66
| --- | --- | --- | --- |

0 commit comments

Comments
 (0)