Build it yourself · FastAPI

Build your first backend server.

You'll clone a small, real FastAPI app, run it on your own computer, change something, and put it online. No experience needed — just follow the steps in order.

What you're building

A tiny text-toolkit API

hibot-fastapi-starter is a small web server — a program that waits for requests and sends back answers. This one does simple text jobs (like counting words or cleaning up input). The magic part: FastAPI builds you an interactive page at /docs where you can try every feature in your browser without writing any extra code.

By the end of this page you'll have it running on your own machine, you'll have added your own feature, and you'll have it live on the internet. That's the whole shape of backend development — and you'll have done it once, for real.

FastAPI Python Your first server Open source
Before you start

Three things to have ready

  • Python 3.10 or newerGet it from python.org. To check what you have, open a terminal and type python --version.
  • A terminalThe text window where you type commands. It's called Terminal on Mac/Linux and PowerShell on Windows — both work.
  • A code editor (recommended: Cursor)Any editor opens the files. We like Cursor because its built-in AI can explain each line and help when you get stuck.
The easy-mode way to follow along

Let an AI editor sit beside you

Cursor is a code editor with an AI built in. Open the project in it and you can highlight any line and ask "what does this do?", or describe a change in plain English and watch it edit the file. New builders get 50% off their first month through our link.

The walkthrough

From clone to live, one step at a time

  1. Get the code onto your computer

    In your terminal, "clone" the repo — that just means download a copy you can edit. Then step into the new folder.

    # copy the project to your computer git clone https://github.com/Cartooli/hibot-fastapi-starter.git cd hibot-fastapi-starter

    No Git installed? On the repo page, click the green Code button → Download ZIP, then unzip it.

  2. Install what it needs

    The app depends on a few Python packages. This one command reads the included list and installs them all.

    pip install -r requirements.txt

    If pip isn't found, try pip3 or python -m pip instead.

  3. Run it on your own machine

    Start the server. It will keep running and print a web address.

    python main.py

    Now open http://localhost:8000/docs in your browser. That's your server, running on your computer. Try the buttons on that page — each one calls a real feature of the app.

  4. Look around the files

    Open the folder in your editor. You don't need to understand everything — just know where things live:

    main.py — the app itself: every feature (called a route) is defined here.
    sanitize.py — a helper that cleans up user input so it's safe.
    templates/ and static/ — the pages and styling.
    tests/ — automatic checks that prove the app still works.

  5. Make your first change

    Open main.py and find a route — a chunk that starts with @app.get(...). Copy the pattern to add a tiny one of your own:

    @app.get("/hello") def hello(): return {"message": "Hi from my first server!"}

    Save the file, stop the server (press Ctrl + C in the terminal), run python main.py again, and visit http://localhost:8000/hello. You just added a feature to a backend. That's the loop you'll repeat forever.

  6. Save your work with Git

    Lock in your change so it's never lost. Make your own empty repo on GitHub first, then:

    git add . git commit -m "Add my first route" git remote set-url origin https://github.com/YOUR-USERNAME/YOUR-REPO.git git push -u origin main

    New to this? Our guide to pull requests walks through saving and publishing work on GitHub.

  7. Put it on the internet

    Connect your GitHub repo to Vercel (it runs Python apps for free). Import the repo, click deploy, and a few seconds later you'll get a public web address anyone can open. Every time you push a change, Vercel updates the live site automatically.

    Want the full picture of where apps run? Read Vercel vs Railway →

When something breaks

Totally normal — here's the fix

Where to go next

Keep building

Try another starter, or dig into the tools you just used.

You built a backend. What's next?

Open the live sample, see how it behaves, then keep going. New builders: let Cursor write the next version with you — 50% off your first month through our link.

ⓘ Affiliate disclosure

Disclosure: The Cursor links on this page are referral links — new users get 50% off their first month when they sign up through them, and code.hibot.space may earn a commission at no additional cost to you. This helps keep these guides free. Every other link on this page is a clean URL with no referral code.