Skip to content

Commit

Permalink
copy fasthtml example from vercel/vercel (#1010)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikareads authored Jan 13, 2025
1 parent 2756c58 commit 1ec2efa
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 0 deletions.
2 changes: 2 additions & 0 deletions framework-boilerplates/fasthtml/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vercel
.sesskey
40 changes: 40 additions & 0 deletions framework-boilerplates/fasthtml/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# FastHTML Boilerplate

Deploy your [FastHTML](https://fastht.ml/) project to Vercel with zero configuration.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/examples/tree/main/framework-boilerplates/fasthtml&template=fasthtml)

_Live Example: https://fasthtml-template.vercel.app_

Visit the [FastHTML documentation](https://docs.fastht.ml/) to learn more.

## Getting Started

Install the required dependencies:

```bash
pip install -r requirements.txt
```

## Running Locally

Start the development server on http://0.0.0.0:5001

```bash
python main.py
```

When you make changes to your project, the server will automatically reload.

## Deploying to Vercel

Deploy your project to Vercel with the following command:

```bash
npm install -g vercel
vercel --prod
```

Or `git push` to your repostory with our [git integration](https://vercel.com/docs/deployments/git).

To view the source code for this template, [visit the example repository](https://github.com/vercel/vercel/tree/main/examples/fasthtml).
41 changes: 41 additions & 0 deletions framework-boilerplates/fasthtml/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from fasthtml.common import *

app, rt = fast_app(hdrs=(picolink))


@rt("/")
def get():
return (
Socials(
title="Vercel + FastHTML",
site_name="Vercel",
description="A demo of Vercel and FastHTML integration",
image="https://vercel.fyi/fasthtml-og",
url="https://fasthtml-template.vercel.app",
twitter_site="@vercel",
),
Container(
Card(
Group(
P(
"FastHTML is a new next-generation web framework for fast, scalable web applications with minimal, compact code. It builds on top of popular foundations like ASGI and HTMX. You can now deploy FastHTML with Vercel CLI or by pushing new changes to your git repository.",
),
),
header=(Titled("FastHTML + Vercel")),
footer=(
P(
A(
"Deploy your own",
href="https://vercel.com/templates/python/fasthtml-python-boilerplate",
),
" or ",
A("learn more", href="https://docs.fastht.ml/"),
"about FastHTML.",
)
),
),
),
)


serve()
Binary file not shown.
3 changes: 3 additions & 0 deletions framework-boilerplates/fasthtml/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
python-fasthtml==0.4.4
sqlite_minutils==4.0.3
uvicorn==0.30.1

0 comments on commit 1ec2efa

Please sign in to comment.