diff --git a/apps/docs/content/features/coding-agents.mdx b/apps/docs/content/features/coding-agents.mdx index dca29ed04..d956ab9c6 100644 --- a/apps/docs/content/features/coding-agents.mdx +++ b/apps/docs/content/features/coding-agents.mdx @@ -36,7 +36,7 @@ Most coding-agent platforms went agent-first, then bolted on infrastructure — ### Your agent, your subscription -Bring whichever agent you already use. Claude Code today; Codex, Gemini CLI, opencode, and any MCP-capable client next. The container is a regular Ubuntu — install your own CLI tools, drop in your `.claude` / `.cursor` configs, attach your IDE over SSH. **Zerops doesn't resell tokens or proxy your model calls** — sign in with your own Anthropic / OpenAI / Google subscription and the agent talks to its provider directly. +ZCP supports multiple coding agents including Claude Code (Anthropic), Codex (OpenAI), Antigravity, and Grok Build. The container is a regular Ubuntu — install your own CLI tools, drop in your `.claude` / `.cursor` configs, attach your IDE over SSH. **Zerops doesn't resell tokens or proxy your model calls** — sign in with your own Anthropic / OpenAI / Google subscription and the agent talks to its provider directly. ### An ordinary Zerops project underneath @@ -56,7 +56,7 @@ Runtimes for Bun, Deno, Node.js, Go, Python, Rust, Java, .NET, PHP, Elixir, Glea The agent reaches your project's private network one of two ways: -- **Remote** — a `zcp` service deployed into the project runs the agent. You attach to it with Claude Code's IDE extension, with any IDE that supports remote development (Cursor, Windsurf, VS Code Remote), or by running [`zcli vpn up`](/references/networking/vpn) and ssh-ing into `zcp` to drive the rest of the project from a shell. +- **Remote** — a `zcp` service deployed into the project runs the agent. You attach to it with your agent's IDE extension or terminal, with any IDE that supports remote development (Cursor, Windsurf, VS Code Remote), or by running [`zcli vpn up`](/references/networking/vpn) and ssh-ing into `zcp` to drive the rest of the project from a shell. - **Local** — install the `zcp` MCP on your machine and run `zcli vpn up` to join the network. From there your IDE, agent, and shell can ssh directly into any container. Either way, the agent reaches [managed services by hostname](/references/networking/internal-access) (`db:5432`, `cache:6379`), deploys through the [Zerops pipeline](/features/pipeline), and reads logs and events the same way you would. @@ -173,7 +173,7 @@ With the model clear, here's where ZCP sits among adjacent tools. People say "ag Aider Cline -

Cursor · Windsurf · Zed · Claude Code · Codex CLI · Aider · Cline

+

Cursor · Windsurf · Zed · Claude Code · Codex · Antigravity · Grok Build · Aider · Cline

The agent runs on your machine, edits your local checkout, runs local commands. Excellent at code changes. **MCP** is now native across these tools, so external reach — databases, networking, deploy targets, runtime logs — comes through plugins instead of bare hands. The agent still lives on your laptop, though: anything off-machine has to be reached, not *inhabited*. Install the ZCP MCP locally and run `zcli vpn up`, and any of these agents can now reach a real Zerops project alongside your local code: services addressed by hostname, deploys, logs, events.

@@ -211,7 +211,7 @@ With the model clear, here's where ZCP sits among adjacent tools. People say "ag ## Where to start { + const client = new Client({ + host: config.db.host, + port: config.db.port, + user: config.db.username, + password: config.db.password, + database: config.db.database, + }); + + await client.connect(); + + await client.query(` + CREATE TABLE IF NOT EXISTS clicks ( + id SERIAL PRIMARY KEY, + seed INTEGER NOT NULL, + clicked_at TIMESTAMPTZ DEFAULT NOW() + ) + `); + + return client; +}; +``` + +**Replace `src/app.ts`** with this: + +```ts +import express from 'express'; +import path from 'path'; +import { connectDB } from './db'; + +const app = express(); + +app.use(express.static(path.join(__dirname, '../public'))); + +app.get('/count', async (_, res) => { + const client = await connectDB(); + const result = await client.query( + 'SELECT seed FROM clicks ORDER BY id ASC LIMIT 20' + ); + const countResult = await client.query('SELECT COUNT(*) FROM clicks'); + await client.end(); + res.json({ + count: parseInt(countResult.rows[0].count), + seeds: result.rows.map((r) => r.seed), + }); +}); + +app.post('/click', async (_, res) => { + const client = await connectDB(); + const seed = Math.floor(Math.random() * 1000000); + await client.query('INSERT INTO clicks (seed) VALUES ($1)', [seed]); + const countResult = await client.query('SELECT COUNT(*) FROM clicks'); + await client.end(); + res.json({ count: parseInt(countResult.rows[0].count), seed }); +}); + +app.get('/status', (_, res) => { + res.status(200).send({ status: 'UP' }); +}); + +export default app; +``` + +**Create a `public/` folder** at the repo root and add `public/index.html`: + +
+ +```html + + + + + + Zerops Quickstart + + + + +

You made it. 🎉

+

+ You just deployed a real app: managed database, private network, + auto-deploy. Let us know you made it through. +

+ +

+ ... + +

+
+
+
+ Node.js 20 + PostgreSQL 16 + Zerops +
+ + + + +``` + +
+ +The `zerops.yml` already exists in the repo. Update `deployFiles` to include the `public` folder: + +```yaml +zerops: + - setup: app + build: + base: nodejs@20 + prepareCommands: + - npm install -g typescript + buildCommands: + - npm i + - npm run build + deployFiles: + - ./dist + - ./node_modules + - ./public + - ./package.json + run: + base: nodejs@20 + ports: + - port: 3000 + httpSupport: true + envVariables: + NODE_ENV: production + DB_NAME: db + DB_HOST: ${db_hostname} + DB_USER: ${db_user} + DB_PASSWORD: ${db_password} + # or use the full connection string: + # DB_CONNECTION_STRING: ${db_connectionString} + start: npm run start:prod + healthCheck: + httpGet: + port: 3000 + path: /status +``` + +:::tip How Zerops env variables work +Zerops automatically generates credentials for every managed service. The variable names are derived from the service hostname — so if your database service is named `db`, the variables are `${db_hostname}`, `${db_user}`, `${db_password}`, and `${db_connectionString}`. If you named it `postgres` instead, they'd be `${postgres_hostname}`, `${postgres_password}`, and so on. +::: + +Push to your repo and connect GitHub in the next section. + +```bash +git add . +git commit -m "add feedback app" +git push +``` + +:::note Want to build something else instead? +Skip the feedback app. Pick the recipe matching your stack from [app.zerops.io/recipes](https://app.zerops.io/recipes), add a `zerops.yaml` to your repo root copying the structure from the recipe, and adjust `buildCommands`, `deployFiles`, and `start` for your stack. The database env variables (`${db_hostname}`, `${db_user}`, `${db_password}`) stay the same regardless of what you're building. +::: + +### Connect GitHub and auto-deploy + +1. Click into your **app** service +2. Scroll down to **Pipelines & CI/CD settings** +3. Click **GitHub** to connect your repo +4. Select your repo and set **Trigger on** to **Push to Branch**, pick `main` +5. In the **"Which `setup` from zerops.yml to use"** field, type `app` +6. Click **Activate pipeline trigger** + +That's it. Every push to main now builds and deploys automatically. Zero downtime, Zerops runs the new version alongside the old one, waits for a health check, then switches traffic over. + +You can also trigger deploys manually with the Zerops CLI: `zcli push`. + +### Add yourself to the list + +Deployed the feedback app? Open your live app URL and click **"I followed the Zerops quickstart"**. You'll show up alongside everyone else who's made it through. + +Check out everyone who's already made it: [app-25be-3000.prg1.zerops.app](https://app-25be-3000.prg1.zerops.app/) + +### If something breaks + +Got a 502 or an app crash on startup? Start here. + +**Check the runtime logs first.** Dashboard, click your app service, click the three-dot menu, then **Runtime log**. The error will be there, usually in the last few lines. + +Two things come up most often on a first deploy: + + + + +Your `node_modules` aren't being deployed. Either: + +- Add `node_modules` to `deployFiles` in `zerops.yaml` (quick fix) +- Or use `output: standalone` in `next.config.mjs` (better for Next.js, bundles everything you need) + + + + +Your environment variables aren't set correctly in `zerops.yaml`. Copy this exactly: + +```yaml +DB_HOST: ${db_hostname} +DB_USER: ${db_user} +DB_PASSWORD: ${db_password} +DB_NAME: db +``` + +Variable names are derived from your database service hostname. If your db service is named `db`, use `${db_hostname}`, `${db_user}`, `${db_password}`. If you named it something else, swap `db_` for that name. + + + + +:::tip Debug locally with VPN +Install zcli first (see [CLI reference](/references/cli)), then run `zcli vpn up [your-project-id]` and your machine joins the project's private network. You can connect to `db:5432` directly from your local machine using TablePlus, psql, or any database client. You can disable SSL when connecting over VPN - the tunnel itself handles security either way. If `db` doesn't resolve, try `db.zerops` instead. +::: + +### What's next + +- **[SSH into your container](/references/networking/ssh)**: `zcli service shell [service-name]` for full Linux access +- **[Custom domain](/references/networking/public-access)**: add your domain, SSL is automatic +- **[Autoscaling](/features/scaling)**: set min and max CPU and RAM, Zerops scales within that range automatically +- **[Add more services](/features/infrastructure)**: queues, search engines, object storage, just add them to your project +- **[Try ZCP](/zcp/quickstart)**: Zerops' AI agent that can deploy, debug, and operate your project + +:::note Stuck? +Jump into the [Zerops Discord](https://docs.zerops.io/discord). The community is active and the team is there. +::: diff --git a/apps/docs/content/quickstart/quickstart.mdx b/apps/docs/content/quickstart/quickstart.mdx new file mode 100644 index 000000000..da99298f9 --- /dev/null +++ b/apps/docs/content/quickstart/quickstart.mdx @@ -0,0 +1,116 @@ +--- +title: Quickstart +description: Deploy a live app with a managed database and a public URL. Takes about 5 minutes. +sidebar_label: Quickstart +sidebar_position: 1 +custom_edit_url: null +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import Video from '@site/src/components/Video'; +import Image from '/src/components/Image'; + +In the next 5 minutes, we'll go from zero to a live app: a managed database, a public URL, and auto-deploy on every git push, all set up for you. + +Here's what we're building together: a page with a button that says **"I followed the Zerops quickstart"**. Every developer who finishes this guide and clicks it gets added to the wall. It's a real app, Express backend, PostgreSQL database, static frontend, running entirely on **Zerops**. + +Curious what you'll end up with? Here it is, live: [app-25be-3000.prg1.zerops.app](https://app-25be-3000.prg1.zerops.app/) + +