PTENES
MODULE 2.2

🚀 Publish and maintain your app

Your app leaves localhost and goes out into the world. Connect GitHub, deploy to Vercel, protect keys, enable analytics, debug with screenshots, and keep the app running with commits, rollback, and spending controls.

8
Topics
75
Minutes
Intermediate
Level
Practice
Type
1

🐙 GitHub MCP + Token + Docker

To publish without leaving the editor, connect AntiGravity to GitHub via MCP: this way, you manage and publish repositories directly from there. The integration requires two things: a Personal Access Token (fine-grained, with expiration) and the Docker installed.

AntiGravity the editor GitHub MCP token + Docker GitHub your repos

✓ Prerequisites

  • ✓Personal Access Token fine-grained
  • ✓Define a validity for the token
  • ✓Docker installed and running

✗ Common mistakes

  • ✗Token with no expiration or overly broad scope
  • ✗Forget to open Docker first
  • ✗Paste the token into the code (use the right place)
GitHub MCP

of the editor

Token

fine-grained

Validity

with expiration

Docker

installed

2

▲ Deploy on Vercel

A Vercel is the GitHub “bridge” to the world: it hosts your app at production. The workflow is short and visual: Add New → Project → import the repo → publish. In just a few clicks, the app is live with a public link.

1

Add New → Project

In the Vercel dashboard, start a new project.

2

Import the repo

Connect your GitHub account and select the app repository.

3

Publish

Vercel builds and deploys the app. Done: it’s live for the world to see.

💡 Localhost × production

In localhost, only you can see. In production (Vercel), anyone with the link can access it. This is the jump from "it works on my machine" to "it's live."

Bridge

GitHub → world

Import

the repo

Production

public link

Live

a few clicks

3

🔐 Environment Variables

API keys never should appear in the code. The golden rule: the agent only names the variable; you paste the key inside Vercel (Settings → Environment Variables) and gives Redeploy.

✓ Safe approach

  • ✓The agent only names: API_KEY
  • ✓You paste the value into Vercel
  • ✓Redeploy for the key to take effect

✗ Never do this

  • ✗Paste the key into the code
  • ✗Upload the key to a public repo
  • ✗Send the key in screenshots or chats
PartWho takes care of itWhere it lives
Variable namethe agentin the code (name only)
Key valueyouVercel → Settings → Env Vars
Enable changeyouRedeploy
Names

the agent

Paste

you, on Vercel

Redeploy

activate the key

Never

in the code

4

📊 Analytics & Speed Insights

Once it’s live, you want to know whether people are using it — and whether the app is fast. Vercel offers Analytics (accesses) and Speed Insights (performance). Enable it in the dashboard and install the package through the terminal (npm). The free plan is generous.

terminal
npm i @vercel/analytics @vercel/speed-insights

📈 Analytics

How many visits, where they come from, which pages. Shows whether the app is really being used.

⚡ Speed Insights

Measures the real-world performance users experience. A slow app drives people away — here you can see where to improve.

💡 Data-driven decision

Without data, you guess what to improve. With Analytics and Speed Insights, you focus on what actually affects your users.

Enable

in the dashboard

npm

install the package

Access

+ performance

Free

generous plan

5

🩺 Screenshot-based troubleshooting

When a build fails, don’t panic or try to decipher the error on your own. Take a screenshot of the error logs and send it to the agent: "there was a deployment error, fix it". For errors on the screen, use the DevTools (Console/Network) and send the screenshot.

1

Capture the error

Screenshot of the build logs in Vercel, or of the Console/Network tabs in DevTools.

2

Send it to the agent

"There was a deployment error (see screenshot). Fix it." The image provides the exact context.

3

It fixes it, and you republish

With the error in view, the agent can get the fix right much faster.

🔎 DevTools is your friend

O Console shows code errors; the tab Network shows failed requests. A screenshot of these screens is worth more than a thousand descriptions.

Screenshot

of the logs

"Fix"

with the screenshot

DevTools

Console/Network

Context

the image helps

6

💾 Commit Often

A lesson that hurts to learn in practice: commit frequently. Real story—coding 6 hours without committing and lose the best version in a misstep. Version control is your safety net.

✓ Always commit

  • ✓With every small step that works
  • ✓Short, clear messages
  • ✓Each commit = a safe return point

✗ The risk of not committing

  • ✗Hours of work in a single fragile block
  • ✗One mistake erases the best version
  • ✗Without a checkpoint, you start over

⚓ Return points

Think of each commit as a game “save.” If something goes wrong, you can go back to the last save—and never lose more than your latest work.

Frequent

each step forward

History

timeline

Save

return point

Network

security

7

⏪ Rollback

A bad deployment isn’t the end of the world — it’s just a rollback. In Vercel: Deployments → choose the previous stable version → Redeploy. It's literally "going back in time." You can also revert through GitHub.

stable v1 worked well broken v2 bad deployment Rollback → v1 Redeploy going back in time
Where toStepResult
VercelDeployments → stable version → Redeploygo back in time
GitHubrevert to the good commitundoes the change
Deployments

the history

Stable

the good version

Redeploy

go back in time

GitHub

also reverts

8

💰 API Budget + Private Repo

Two final precautions to help you sleep easy. First: define a budget of API spending so you don’t get a huge bill. Second: make the private repository after publishing, protecting your code.

💰 API Budget

Set a spending limit in your API provider’s dashboard.

  • •Helps avoid bill surprises
  • •Protects against loops or abuse

🔒 Private Repo

After publishing, change the repository’s visibility to private.

  • •Protects your code
  • •Reduces the risk of leaked keys

🛡️ Production hygiene

An API budget + private repo + environment variables form the foundation of your app’s security when it’s live. These simple habits prevent costly headaches.

Budget

spending limit

No surprises

on the bill

Private

after publishing

Safe

code + keys

🔬 Practical example

Let’s publish the price tracker from Track 2.1 and keep it alive:

  1. Publish on Vercel — Add New → Project → import the repo → publish.
  2. Protect the key — the agent names API_KEY; you paste the value into Settings → Environment Variables and click Redeploy.
  3. Simulate a bad deploy — then make a rollback: Deployments → stable version → Redeploy.

Result: app live, key secure, and peace of mind knowing you can go back in time.

🏋️ Exercise

Take the app you built in 2.1 to the world:

  1. Publish your app on Vercel and confirm that the link works.
  2. Protect a key with an env var — name it in the code, paste the value into Vercel, Redeploy.
  3. Roll back to the previous version and see the app “go back in time.”

Bonus: connect Analytics and set an API budget. In Track 3, you’ll scale production.

⚡ Ready-made prompts

Copy, paste into your AI assistant, and adapt to your use case.

create a repo and publish
Crie um repositório no GitHub chamado [nome] e publique o projeto atual.
Use o GitHub MCP. Não inclua chaves de API no código.
name an env var
Especifique como a variável de ambiente deve se chamar (ex.: API_KEY);
eu forneço a chave dentro da Vercel. Não coloque o valor no código.
fix a deploy error
Houve um erro no deploy (veja o print). Corrija.
Explique em uma frase o que causou e o que você mudou.

✅ Module summary

✓
GitHub MCP + Vercel — connect (token + Docker) and publish to production in a few clicks.
✓
Env vars — the agent names it, you paste it into Vercel and Redeploy; never in the code.
✓
Keep it alive — analytics, troubleshooting from screenshots, commit often, and roll back.
✓
Final cleanup — API budget and private repository after publishing.

Next track:

Track 3 — Scale Production