Getting started
Customer support automation
Automate the customer support of an e-commerce company with Gmail, Supabase, and Anthropic models through Pydantic AI, then deploy it with Docker on your own Hostinger VPS.
In this course you automate the entire customer support of an e-commerce company. A backend checks a Gmail inbox, an AI pipeline reads each email, searches a knowledge base, and then replies or hands the email to a person. It runs on your own server, and nothing on that server is reachable from the internet except SSH from your IP address.
It is a full-stack GenAI project, from an empty folder to a deployed system with a dashboard. This guide accompanies a video made in collaboration with Hostinger.
The company
Harbor & Pine is a fictional home and outdoor seller on Amazon. It sells many products, but two best-sellers cause most of the tickets.
| Inflatable paddle boards | Flat-pack shelving | |
|---|---|---|
| Range | Three sizes, 10'6", 11', and 12'6", picked by rider weight | 3-shelf, 5-shelf, cube 2x2, and cube 3x3, each in four finishes |
| Typical emails | "Which size for 90 kg?" "It loses air." "The pump is missing." | "Panel 4 is cracked." "Screws are missing." "Wrong color." |
Most of these emails have an answer in a short policy document. That makes support a good first AI project. The work is repetitive, the rules are written down, and you can check every reply.
How it works
A poller asks Gmail for new mail on a fixed interval. Every email and every event is saved in Supabase. Guards in plain Python stop the bot from answering itself. A small model classifies the email, a larger model drafts the answer with tools that read the knowledge base, and Python makes the final call. The model proposes, code decides.
What you will build
- A Python project with FastAPI and uv, and Gmail access through OAuth 2.0.
- A poller that picks up new mail and labels what it handled.
- A Supabase database for events, tickets, messages, and the knowledge base.
- An AI pipeline with Anthropic models through Pydantic AI, with structured output and tools.
- An eval set of golden emails that checks every decision.
- A deployment with Docker Compose on a Hostinger VPS, with a firewall and SSH hardening.
- A small React dashboard, opened through an SSH tunnel.
What you need
- Python 3.13, uv, Node 22 or later, Git, and a GitHub account.
- A code editor with a coding agent, such as Cursor, Claude Code, or Codex.
- A new Gmail account for the demo. Do not use your personal inbox.
- A Supabase account (the free plan is enough) and an Anthropic API key.
- A Hostinger VPS. KVM 1 is enough because the database runs on Supabase. KVM 2 gives you headroom for other projects. Use the code
DAVEVPSat checkout for 10% off. The code works on your first purchase with a yearly plan, and the yearly plan is the best deal.
How to use this guide
There is no starter repo. You build the whole project from these pages.
- Every step names a file and gives its full code. Copy it with the copy button on the code block.
- Replace means overwrite the whole file. The highlighted lines are the ones that changed. Add to the end of means append the code to the existing file.
- Every page ends with a check. Do not move on until it passes.
Keep a coding agent such as Cursor, Claude Code, or Codex open for small things along the way, such as explaining a line, fixing an error, making a small tweak, or checking a file against the guide. The build itself is copy and paste.
Explain what start_event in app/db.py does.I get this error when I run the poller: <paste the error>. Fix it.Not a beginner course
You should be comfortable with Python and the command line. If you are new to Python, start with the free Python course first.
Kept simple on purpose
There are no webhooks, queues, or workflow engines in this build. The server polls Gmail, so it only makes outgoing calls and needs no domain, no reverse proxy, and no open web port. The last page covers what a production version adds.