Build your first database app.
You'll clone a small guestbook app, run it on your own computer, leave a message that's saved for real, change something, and put it online. Step by step — no experience needed.
A guestbook that remembers
hibot-flask-guestbook is a web app where visitors leave a message and see everyone else's. The new idea here is a database: the messages are saved to a file with SQLite, so they're still there after you close the app or refresh the page. Flask is the small Python framework that ties the web page and the database together.
This is the moment an app stops being a toy and starts remembering things — the core of almost every real product. By the end you'll have it running, saving data, and live online.
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.
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.
From clone to live, one step at a time
-
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-flask-guestbook.git cd hibot-flask-guestbookNo Git installed? On the repo page, click the green Code button → Download ZIP, then unzip it.
-
Install what it needs
The app depends on a few Python packages (Flask among them). This one command installs them all.
pip install -r requirements.txtIf
pipisn't found, trypip3orpython -m pipinstead. -
Run it on your own machine
Start the app. It will keep running and print a web address.
python app.pyOpen
http://localhost:5000in your browser. Type a message and submit it — then refresh the page. It's still there. That's your database at work. -
Look around the files
Open the folder in your editor. The important pieces:
app.py— the app: the routes, plus the code that reads from and writes to the database.
templates/— the HTML pages Flask fills in with your data.
sanitize.py— cleans up messages so they're safe to store and show.
guestbook.db— the SQLite database file, created automatically. This is where messages live. -
Make your first change
Open
templates/and find the page heading. Change the guestbook's title to your own:<!-- before --> <h1>Guestbook</h1> <!-- after --> <h1>Alex's Guestbook</h1>Save, then refresh
http://localhost:5000— your title is live. (Flask reloads automatically while running.) For a bigger step, look at howapp.pysaves a message and try adding a second field, like the visitor's city. -
Save your work with Git
Lock in your change. Make your own empty repo on GitHub first, then:
git add . git commit -m "Make the guestbook mine" git remote set-url origin https://github.com/YOUR-USERNAME/YOUR-REPO.git git push -u origin mainNew to this? Our guide to pull requests walks through saving and publishing work on GitHub.
-
Put it on the internet
Because this app keeps a database file on disk, the cleanest home is Railway — it runs always-on Python apps and gives you persistent storage. Connect your GitHub repo, deploy, and you'll get a public address. Want to understand the difference between hosts? Read Vercel vs Railway →
Totally normal — here's the fix
- "command not found: python"Try
python3instead ofpython. If neither works, Python isn't installed yet — grab it from python.org. - "port 5000 is already in use"On Mac, AirPlay sometimes uses port 5000. Turn off "AirPlay Receiver" in System Settings, or stop the other program using it.
- "ModuleNotFoundError: flask"The packages didn't install. Re-run
pip install -r requirements.txtand watch for errors. - My messages vanishedIf you deleted
guestbook.db, the app makes a fresh, empty one. That's expected — the data lives in that file.
Keep building
Try another starter, or dig into the tools you just used.
You built a database app. 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.