← Back to articles

Article · Building with AI

A civil engineer, an AI and 75,000 lines of code: how I built HidroLivros

I am not a software developer. I spent my career calculating river flows, designing urban drainage and preparing water-use permit studies. Today I run a platform with about 75,000 lines of TypeScript, more than 1,700 automated tests and recurring payments. The current release is 30.72.

This article tells how that happened, what worked and what went wrong. My pair programmer was an AI, Claude Code. I am writing for people who build software and want to see what this work looks like when the person who understands the problem is not the person typing the code.

Where it started: the gap between the classroom and everyday practice

The idea for HidroLivros came from the classroom. Teaching hydrology and hydraulics in technical and higher education, I kept seeing the same difficulty: students learned the formulas and methods, but could not connect them to what a professional actually does day to day. They could derive an intensity-duration-frequency equation, yet got stuck when choosing the criterion for a water-use permit study or sizing the drainage of a street.

Outside the classroom, the difficulty persists. In applied hydrology, the knowledge that drives a project is scattered: in expensive books, hard-to-find papers and the spreadsheets each firm builds its own way. A recent graduate who needs to compute a reference flow for a water-use permit, or a small town that needs to size the drainage of a neighborhood, usually faces three obstacles:

  1. not knowing which criterion their state's water agency requires;

  2. not having a reliable tool for the calculation;

  3. having nobody to ask.

HidroLivros was created to close that gap. It brings together three things: technical knowledge, everyday professional practice and the use of AI, both to build the tools and to produce and update the content. In practice, the platform offers:

  • a digital technical library, with applied-hydrology e-books;

  • web calculation tools: HidroPluvial (urban drainage), HidroOutorga (reference flows and water permits) and HidroProposta (scope and technical proposals for studies);

  • weekly articles that connect theory to what actually changes in a project;

  • the Technical Radar, a weekly curation of papers and standards;

  • live courses and an email newsletter.

Who does what

The most important decision in the project was making it clear, from day one, who does what.

What stays with me, as the domain engineer:

  • defining the technical rules: which equation, which criterion, which limit;

  • deciding what users see and in what order;

  • approving every change before it goes into the code;

  • authorizing every deployment.

What the AI does:

  • reading the existing code before proposing anything;

  • writing the code and the tests;

  • running the full test suite and the build;

  • producing a visual preview of the change;

  • packaging the release and deploying it, after my approval.

It may sound bureaucratic. In practice, it is what made the project possible. An AI writes code fast, but it does not know whether Q7,10 or Q95 is the right reference flow for a river in Minas Gerais. I do, and that is why those decisions never leave my hands.

The stack

Layer Technology
Front end React 19, Vite 7, Tailwind CSS 4
API tRPC 11 on Express, validation with Zod
Database MySQL with Drizzle ORM
Payments Asaas (Pix, bank slip, card and subscriptions) and Stripe
Tests Vitest, about 1,750 tests in more than 200 files
Hosting Node.js 22 on Hostinger, deployed as a ZIP package
Extras PWA with Workbox, in-browser PDF and Excel generation, SMTP email

Nothing exotic, on purpose. A well-known stack means more documentation, more examples and fewer surprises, for me and for the AI.

The rules we created along the way

None of these rules existed at the start. Each one came from a real problem.

1. Ask before touching the code

Early on, I would describe an idea and the code would already be there. Sometimes it was not what I wanted, and undoing it cost more than doing it. Now every change starts as a proposal, and implementation only begins after an explicit "go ahead".

2. Show a picture, not a paragraph

I cannot judge a screen from a description. Text-only proposals led to rounds of rework ("that's not it", "I can't picture it"). The rule became: every interface proposal comes with an image, either a sketch of the screen or a screenshot of the test build. Rework dropped sharply.

3. Batch changes into releases

Adjusting one thing at a time, and deploying each tweak, ate up hours. We started keeping smaller improvements on a list and shipping them together. Every release has a note saying what changed, why, and how it was validated.

4. Nothing goes live without "Yes, publish"

Deployment is the one step I always authorize explicitly, even after approving the code. Before asking, the AI shows the test results, the build and a preview of the screen. After deploying, it checks that the site responds, that the new page loads and that the server logs are clean.

5. Tests as a contract

The full suite runs before every release. A small group of old tests fails for known, documented environment reasons. The rule is simple: the number of failures cannot go up. If a change breaks something that already worked, it is fixed before anything ships.

Where domain knowledge made the difference

Some decisions no AI would make on its own:

  • State-specific criteria. The permit tools do not pick "the best" reference flow. They apply the criterion of the local water agency, because each state has its own rule, and computing several and picking the most convenient one is technically wrong.

  • Professional responsibility. Every calculation tool has terms of use, explicit acceptance and a statement that results must be checked by a licensed professional. Generated reports are logged. Engineering software does not replace the engineer.

  • A newsletter with a human in the loop. The site drafts the weekly newsletter by itself, but nothing is sent without my approval. It goes out in batches, one email per person, and every email has its own unsubscribe link.

  • Images that don't look like a classroom. Professionals and students tend to freeze in front of charts and formulas. In our marketing pieces we replaced diagrams with annotated real photos, such as an intake during a drought with the staff gauge showing the low water level.

Security and privacy (LGPD)

A small platform still stores personal data and takes payments. Some of the safeguards we adopted:

  • Consent: only people who opted in receive email, and unsubscribing takes effect immediately.

  • Personal data: sensitive delivery data for printed books is encrypted in the database.

  • Payments: payment rules live in a protected module that the tests stop from being changed by accident.

  • Security alerts: when the hosting provider flags a vulnerable dependency, the fix ships the same day. A recent alert was for a package the project did not even use, so the fix was to remove it.

  • Admin activity: my own page views are excluded from the site statistics, so they don't distort the numbers.

What went wrong

It would be dishonest to talk only about what worked.

  • Operating-system details. On Windows, a script that edited files wrote line endings in a different format and broke tests that verify file integrity. The fix was to always edit in binary mode, and that is now a rule.

  • Lost context. In long sessions, the AI has to rebuild what was already decided. We now keep a written memory of decisions: prices, access rules, writing standards and what must never change without authorization.

  • Visual haste. Some marketing images came out with overlapping or unreadable text in the first version. The rule now is to check every image zoomed in before showing it.

  • Claims instead of checks. Every task has to end by saying what was tested and what was not. "It works" without evidence doesn't count.

What I'd tell someone who wants to do the same

  1. You are still the engineer of record. The AI speeds up writing code, but it does not sign the project.

  2. Write down the rules of the game. What always needs approval, what must never change, how you want proposals presented.

  3. Ask to see it first. A sketch, a preview, a screenshot: whatever format you actually judge in.

  4. Small, documented releases. Each one with a note on what changed and how it was tested.

  5. Tests from early on. They are what lets you safely change a system you did not write line by line.

HidroLivros keeps growing, with new tools and live courses in 2027. For me, the most interesting part is not the technology. It is seeing domain knowledge become the center of the work again. Code is no longer the bottleneck; technical judgment, ethics and responsibility are still ours.

Visit the platform: hidrolivros.com.br (in Portuguese)

Instagram: @hidrolivros