BeerCat Website
Website and internal platform for BeerCat, the IT startup we started among family and friends: quotes with versioned PDFs and AI drafts, projects by stage, Webpay payments and a client portal. I built it end to end with Flask, MySQL, Celery + Redis and Gemini.
BeerCat: the website and management platform of an IT startup
BeerCat is a Chilean tech startup we started among family and friends. It offers tech support, networking, custom software development, artificial intelligence and cloud services. Since June 2026 I have been building its platform: the public website, where clients come in, and the internal system the team uses to run the whole operation, from the first message to the last payment.
The goal is that nothing gets lost between scattered tools. A message from the website form becomes a quote. The quote goes out as a versioned PDF with open tracking. Once it is accepted, a project is created, moves through stages and collects its payment milestones through a Webpay link. The client follows everything from their own portal.

| Overview | |
|---|---|
| Role | Part of the founding team. I built the platform end to end: backend, frontend and infrastructure (106 of 106 commits) |
| Period | June 2026 – present |
| Type | Company website + internal ERP/CRM + client portal |
| Status | Public website live at beercat.cl; the platform is still in active development |
| Code | Private; this case study uses screenshots and selected snippets |
Stack
| Layer | Technologies |
|---|---|
| Backend | Python, Flask 3.1, SQLAlchemy 2, MySQL, Flask-Login, Gunicorn |
| Frontend | Jinja templates, framework-free JavaScript, custom CSS with tokens (dark and red theme), Chart.js, Cropper.js, Font Awesome |
| Redis queue + Celery worker as a separate service, SMTP with retries, HTML templates | |
| Payments | Webpay Plus (Transbank SDK), with integration and production modes |
| AI | Google Gemini (google-genai) to draft proposals and replies |
| Files | Swappable local / Amazon S3 storage with presigned URLs, CloudFront for static assets, ReportLab for PDFs |
| Security | Roles, Cloudflare Turnstile, Google sign-in through explicit linking, audit log, UUIDv7 as the public identifier |
| Deployment | Linux with two systemd services: the web app and the email worker |
Architecture
Visitors and clients BeerCat team (admin, sales, support)
| |
v v
+---------------------------------------------------------------+
| Flask (Gunicorn) |
| public site | client portal | dashboard | /pago/<token> |
+---------------------------------------------------------------+
| | | | |
v v v v v
MySQL Redis (queue) Gemini API Webpay Plus S3 / CloudFront
|
v
Celery worker ---> SMTP
- A Flask monolith with one blueprint per module (quotes, projects, inventory, purchases, portal, payments…). For a small team, a single deployment is easier to run than several services.
- External services sit behind a manager with a swappable provider.
storage,ai,paymentsandmail_queueare all initialized the same way (init_app), and the rest of the code doesn't know whether a file lives on disk or in S3, or which AI model is answering. - The web app never speaks SMTP. It renders the email, drops it in Redis and moves on. If the worker is down, emails wait in the queue until it comes back.
Features by area
| Area | What it covers |
|---|---|
| Public website | Home, services, how we work, FAQ and a contact form with categories; custom legal and error pages |
| Contacts | Inbox for website messages, email alert to admins and sales, AI-assisted reply and turning the message into a quote |
| Quotes | Source channel, discovery, proposal (objective, scope, exclusions, timeline, price, payment terms), line items, versioned PDF and sending with open tracking |
| Projects | Kickoff → Development → Delivery → Support → Completed stages, activity log with notes visible or hidden to the client, payment milestones |
| Payments | Public page per milestone, Webpay checkout, manual recording of transfers and cash |
| Clients | Companies and people with Chilean RUT and phone formatting; portal accounts created from their record |
| Client portal | Projects, quotes, pending payments and automatic notices based on progress |
| Operations | Hardware inventory, cash or installment purchases, support contracts and monthly recurring revenue (MRR) |
| Dashboard | Metrics per role: sales pipeline, pending payments, MRR, equipment, website visits |
| System | Users with roles, profiles with a croppable photo, audit log, password recovery |
| Downloads | Page for Sys Bootstrapper (another project of mine) with installers published from a command-line script |

Deep dive
1. From message to quote, with AI as the first draft
Messages from the form land in an inbox. From there, one click turns the contact into a draft quote: the client's message becomes the problem to solve, and if no company has that email yet, one is created. The quote brings together everything that used to be scattered: discovery (the problem, who decides, the deadline, whether data needs migrating) and the proposal (objective, what's included, what's not, timeline, price, payment terms and conditions).

Every proposal field has a "Generate with AI" button. The browser sends the task and the context that already exists (title, company, problem, the salesperson's idea), and Gemini returns a draft for that field. I built it as a task registry: adding a new button on another screen means adding one entry to the dictionary and a button in the template, with no new endpoint.
# Simplified: each task defines its system instruction and how to build the prompt.
TASKS = {
'quote_scope_excludes': {
'system_instruction': _SALES_PERSONA,
'build_prompt': _build_scope_excludes, # uses what's already under "includes"
'temperature': 0.6,
},
# quote_objective, quote_payment_terms, contact_reply, project_kickoff_summary…
}
There are eight tasks: six quote fields, the project kickoff summary and the reply to a contact. Tasks that depend on others receive what's already written; for example, "excludes" reads what's under "includes" so it doesn't contradict it. The AI only fills in the form. The team reviews, edits and decides what gets sent.

2. Versioned PDFs and open tracking
Sending a quote generates a PDF with ReportLab and stores it as a new version (quotes/<code>/v<n>.pdf). If nothing changed since the last send, the previous version is reused instead of creating an identical one. Comparing the PDF bytes doesn't work for this, because ReportLab embeds the creation date and every file comes out different. So the hash is computed over the fields that appear in the document.
The email goes out with the PDF attached and a tracking pixel. When the client opens it, the system records the first open, how many times it was opened and from where, and the salesperson sees it on the quote.
3. From accepted quote to project
Accepting a quote creates the project with its sequential code, the client, the owner, the scope and the start date. The conversion is idempotent: if the quote already has a project, it returns that one instead of creating a duplicate. That way a double click or a retry never creates two projects.
The project moves through five stages, with "cancelled" as a side exit. The activity log mixes notes, calls, meetings, emails and stage changes, and each entry is marked as visible or hidden to the client. Whatever is visible is what the client sees in their portal.

4. Webpay payments that hold up in the real world
Each payment milestone has a public page with an unguessable token. The team copies the link from the project page, and the client also finds it in their portal behind a "Pay" button. From there they pay with Webpay Plus. The money status only changes after the transaction is confirmed server to server with Transbank, never based on what the browser says.

The edge cases took the most work:
- Double returns. An F5, or a duplicated POST and GET, can arrive at the same time. The transaction is locked with
SELECT … FOR UPDATEand the confirmation happens only once. - A confirmation that fails but went through anyway. If the confirmation errors out, the system checks the real status with Transbank before giving the payment up for lost.
- Cancellation, timeout and form errors. Webpay returns different parameters in each case (
TBK_TOKEN, only the purchase order, or both tokens). Each one leaves the transaction in its own state and the milestone goes back to "pending". - A stuck attempt never blocks. A new attempt marks any earlier ones that were left open as timed out.
- Manual payment and Webpay at the same time. If a Webpay charge arrives for a milestone someone already marked as paid, the manual record isn't overwritten: an alert goes to the activity log and the audit log to check for a possible double charge.
- Amounts in pesos. Webpay in CLP requires whole amounts, so a milestone with decimals can't be paid online.
Once paid, the milestone is recorded as debit or credit based on the card type, and if the project was still in Kickoff it moves to Development.
5. A client portal with notices that never go stale
Client accounts are created from a person's or company's record and receive their credentials by email. In the portal, clients see their projects, quotes and payments, plus a news panel: "you have a pending payment", "your project is ready for delivery", "we received your payment".
Those notices aren't stored in the database: they are computed on every visit from the projects, quotes and payments. That way no dashboard route has to remember to "emit" a notice, and they never fall out of sync with what the team did. The only thing stored is which notices each account dismissed, keyed per event. A new event (another stage change, another payment attempt) brings a new key, and the notice shows up again. Notices are sorted by urgency, with whatever needs the client's action first.

6. Email in the background
The web app renders the email (HTML, text and attachments) and publishes it to a Redis queue. A Celery worker, running as a separate systemd service with the same code, delivers it over SMTP. Only transient failures are retried (network, timeouts, 4xx replies): up to six times, with exponential backoff and jitter from 30 seconds to 10 minutes. A nonexistent recipient or an invalid payload fails right away.
I documented the known limits instead of hiding them: delivery is "at least once", and an email that runs out of retries only leaves a trace in the log. The queue and SMTP code have 23 tests, with a fake SMTP server and no Redis needed.
7. Security without overdoing it
- UUIDv7 as the public identifier. URLs, forms and JSON only expose a UUIDv7. The integer id is still the internal key, but it never leaves the server, so nobody can enumerate records or count clients by looking at a URL. Since the first 48 bits of a UUIDv7 are a timestamp, the index grows at the end like an auto-increment one, and it's stored as
BINARY(16), half the size of aCHAR(36). I migrated every model in a single change. - Changing the password ends other sessions. The identifier stored in the cookie carries a fingerprint of the current password. If the password changes, sessions open in other browsers stop working. Links to set or reset a password use the same fingerprint, so they stop working as soon as they're used.
def get_id(self):
# What Flask-Login stores in the cookie; changes with every new password.
return f'{self.uuid}:{self.password_fingerprint()}'
- Google sign-in only through linking. You first sign in with a BeerCat username and password and, once inside, link your Google account from your profile. From then on, the login looks up the Google identifier, never the email. If the Google email doesn't match the account's, it has to be confirmed before anything is saved.
- Private files kept out of public reach. The
/mediaproxy only serves public folders (profile photos and installers). Quote PDFs have predictable paths, so they only travel as email attachments. There are tests for this. - Small things that add up. Cloudflare Turnstile on login,
SameSite=Laxcookies that areSecureunder HTTPS, the app refuses to start without aSECRET_KEY, a reset link lasts one hour with at least one minute between requests (tracked in Redis), and temporary passwords avoid ambiguous characters (0/O, 1/l/I) because they're sometimes read off a screen and spoken aloud. - Audit log. Key business actions are recorded with the actor, entity, field diff, IP and route. The actor's name is copied into the row, so the record survives even if the user is deleted. The log doesn't record page views or reads, so it doesn't grow out of control.

8. A visual identity with cats
We wanted a brand that was serious but had personality, so BeerCat is dark and red, and it has cats. The home page has a Roman cat with a laptop, "A normal day at BeerCat" shows cats coding and another one asleep on the servers, and the login screen has a cat between beer tanks and server racks. The dashboard and the portal follow the same dark and red palette as the website. Heavy assets (images, the hero video) are served from CloudFront and fall back to /static in development.


Challenges that taught me something
- A hash that would change on its own. To avoid creating identical PDF versions, comparing the files doesn't work: ReportLab stores the creation date inside and every PDF comes out different. You have to compare the data, not the file.
- A payment isn't over when the browser comes back. The clean return is only one of the paths. There are also double returns, cancellations, timeouts and simultaneous manual payments, and each one needed its own handling.
- Celery on macOS. The worker received the tasks, but the child process crashed: on a Mac the
preforkpool usesspawn, notfork. In development I use--pool=solo, and I wrote it down in the queue's README. - Integer ids say more than they seem to.
/proyectos/7tells anyone how many projects there are and invites them to try 8. Moving to UUIDv7 touched 43 files, but it closed that door without losing index ordering.
By the numbers
| Metric | Value |
|---|---|
| Commits (June – October 2026) | 106, all mine |
| Models | 24 (plus 2 association tables) |
| Routes | ~90 across 17 blueprints |
| Jinja templates | 62 |
| Python (app) | ~8,200 lines |
| Tests | 33 (email queue, SMTP, sessions, /media, release publishing) |
| Roles | 4 (admin, sales, support, client) |
| AI tasks | 8 |
What I take away
BeerCat is the project where I made the most decisions on my own, because there was no other developer to ask. I learned to pick the simple option when it's enough (a monolith, templates with no frontend framework, a single queue just for email) and to spend the effort where money or client data is at stake: payments, sessions, private files. I also take away that an internal system has to be designed around the people who use it every day: if the team has to remember to tell the client something, sooner or later they'll forget.
All screenshots use demo data; names, companies and amounts are fictitious.
Project screenshots