Wauplin's picture
Wauplin HF Staff
Space metadata
3a43ebf verified
|
raw
history blame
2.02 kB
metadata
title: FastAPI + React Template
emoji: 💻
colorFrom: blue
colorTo: green
sdk: docker
app_port: 8000
pinned: false
license: mit
short_description: Template to vibe code a demo running on FastAPI + React
tags:
  - docker-space-fastapi-react

docker-space-fastapi-react

This repo is a template to run a FastAPI server hosting a React+Tailwind app in a Hugging Face Space.

Spaces are very well suited to vibe-code demos using Cursor, Lovable, Claude Code, etc. The hardest past is often to correctly configure the tooltip to make it work in the first place. This repo is intended to solve that.

Getting started

The backend (Python + FastAPI) and the frontend (TS + React + Tailwind) are located respectively in the backend/ and frontend/ folder.

Backend

To run the backend, you'll need uv and Python3.12 installed. Install dependencies with:

uv venv
make install

And then run the backend server with:

make dev

For more details about backend development, check out this README.

Frontend

To run the frontend, you'll need nodeJS + pnpm installed.

Install dependencies with:

pnpm install

And then run the frontend app with:

pnpm dev

Once both parts are running, go to the frontend URL. You should see a green "Backend Online" message in the top-right corner. Note that this message is only visible in development mode. When running in a Space, it won't be shown to your end users.

For more details about frontend development, check out this README.

Deploy

This repo is meant to be run in a Docker Space. Configuration should be automatically done if you clone the on the Hugging Face Hub.

If you want to run it on your own, you can use Docker:

docker build -t fastapi-react-space .
docker run -p 8000:8000 fastapi-react-space

Note that when running in Docker, the app runs in production mode without hot-reloading.