Web & CMS

What is FastAPI

What it is

A fast way to write a server side in Python: order intake, cart calculation, an admin panel. Works the same with websites and with bots.

How we use it

The online store server, the crash-report receiver for apps, APIs for Telegram cabinets. Runs in a container next to the site.

Where FastAPI helps a business

  • A website needs its own logic: stock by size and colour, wholesale prices, orders, not just pages of text.
  • The owner needs an admin panel built around their tasks rather than a generic one.
  • A bot needs a web dashboard with charts on the same data.
  • Several programs (a website, a bot, an app) must work with one database through one entry point.

How we use it

  • An online store. In the shirt store the storefront is Nuxt, and a FastAPI REST API serves the catalogue, takes orders and stores the site settings. The database is accessed through async SQLAlchemy 2, and the schema is applied by Alembic migrations on startup. The server rotates phone photos by their camera tag, shrinks them and converts them to webp by itself.
  • A dashboard for a bot. In the finance assistant FastAPI feeds the dashboard, and all analytics live in one layer shared with the bot, so the numbers in Telegram and on the charts match. For a Telegram ID that is not on the list, the API answers 401.

We build websites with their own back end under Websites and online stores.

Common problems

  • Trusting the browser. The cart lives in the browser, and a buyer can edit it however they like. So at checkout the server recalculates prices and the total from the database, and applies the wholesale price itself.
  • Open write routes. Every route that changes something checks sign-in. Otherwise anyone who finds the API address can edit the catalogue.
  • Password guessing from many addresses. A per-IP request limit on nginx does not stop it. In the store, five wrong passwords in a row lock sign-in for that username for 15 minutes, whatever the address.
  • A database schema without migrations. Without them a version can be rolled back only from a database copy. With migrations the schema changes step by step without losing data.

When you do not need it

If the website is pages of text, cases and a request form, a separate back end is not needed: Nuxt with content in files, or WordPress, is enough. FastAPI pays off once the site has products, orders, customer accounts or data shared with a bot.

← All terms

Need a website, a bot or automation?

Terms explained — now let's get to work: tell us about the task and we'll turn it into a clear work plan.