← Writing

From idea to live in one afternoon: how we shipped the "Motion Machine"

An honest account of how an internal AI tool went from an empty folder to production, including the moment we took the site down and how we fixed it.

From idea to live in one afternoon: how we shipped the "Motion Machine"

What the Motion Machine is

An internal web tool for the creative team. You give it a reference video (from which it extracts only the style: colour, light, camera, rhythm, typography) and your script, and it returns the ready-made prompts for each scene for Google Flow (Veo) and Gemini Omni Flash. Underneath, it uses the Claude API (Anthropic): vision analyses the keyframes and builds a style profile, then the model splits the script into scenes of 8s or less, with direction in English and lines in Portuguese. All behind a login.

The mission

Get the application live inside the company infrastructure, with three rules: nothing exposed, access only with login + HTTPS, and a simple way to manage users.

The architecture

Containerised with Docker on the company server. The container listens on one IP only. Nobody reaches it directly; access has to go through Nginx. Built-in login (passwords with bcrypt, session as a JWT in a secure cookie), user data on a persistent volume, and the API key only on the server.

The scare: we took the site down (and brought it back in seconds)

To enable HTTPS, we did the textbook "force HTTPS", and the whole site went down (ERR_TOO_MANY_REDIRECTS). The cause was an invisible piece: HTTPS is terminated by a firewall in front, which talks HTTP to the server. The "force HTTPS" became an infinite loop. What saved us: automatic backup plus validation before applying. We restored in seconds. Then we found the cause in the logs and applied the right fix (the server never redirects to HTTPS; internal redirects are relative).

Adjustments that made it actually work

  • Stubborn cache → file versioning (?v=2, ?v=3) punches through any cache.

  • "Could not generate" → a more robust response parser plus a "heartbeat" on the connection so long generations are not cut off by the firewall (60s now completes).

Product improvements

  • "Motion only" mode (no avatar), with the script becoming a voiceover narration.

  • Save project (.txt with config, script, style and all the prompts).

  • Final prompt to paste straight into Flow with Omni Flash.

What I learned

  1. Know the terrain before you touch it: the worst problem was in the network, not in the app.

  2. Backup and validation are not bureaucracy: they turned an outage into a 30-second scare.

  3. Iterate with real use: the real errors (cache, timeout, parser) revealed what was missing.

If you are curious to see the first video it generated, just click

Curtiu? Reage aí — é um toque: