# Move to GizStack

Each section maps what you use today to its GizStack equivalent. Your clients and tools keep
working where GizStack speaks their protocol: PostgreSQL, Redis, S3 and Kafka.

## From Node.js or Bun

| You use | In Gizlang |
| --- | --- |
| `node app.js`, `bun run app.ts` | `giz run main.giz` |
| `npm test`, `bun test` | `giz test` |
| `tsc --noEmit` | `giz check main.giz` |
| Prettier | `giz fmt` |
| `node --watch`, nodemon | `giz live main.giz`, which also keeps state |
| `throw` and `try` | `Result` and `try`. A failure is a value. |
| `async`, promises | Tasks and channels (`gizlang:task`) |
| `http.createServer`, `Bun.serve` | `Http.serve` (`gizlang:http`) |
| `fetch` | `gizlang:http` and `gizlang:tls` |
| A bundler and a runtime | `giz build main.giz -o app`: one native executable |

Your `.ts` files and npm packages compile with the same compiler: [TypeScript and npm](javascript-python.md).

## From Next.js

| Next.js | GizWeb |
| --- | --- |
| Pages and the App Router | Routes are data: `router` and typed targets |
| React components | Typed component functions in TSX syntax |
| Server actions | Actions: typed functions that forms, the API and agents call |
| Hydration | None. Server HTML is the state; a 1.2 KB kernel adds interaction. |
| An ORM (Prisma, Drizzle) | One record type for the table, the queries and the forms ([Model your data](model.md)) |
| A realtime service | Live views that follow the database |
| `next build && next start` | `giz build` and one process for each CPU |

The same comments app on both: 66 ms against 271 ms to the first page, 1,739 req/s
against 197 req/s on one CPU ([benchmarks](../benchmarks.md#web-a-whole-app-against-next-js-and-rust-react)).

## From PostgreSQL

:::status{of="gizdb-server"}
:::

GizDB speaks the PostgreSQL protocol. `psql`, `pg_dump`, pgbench and the drivers (node-postgres,
psycopg, JDBC, `gizlang:postgres`) connect unchanged.

```sh
pg_dump --no-owner "$OLD_DATABASE_URL" > dump.sql
gizdb serve --dir data --port 5432 &
psql -h 127.0.0.1 -U postgres -f dump.sql
```

To copy a running database with checks, use `gizdb migrate copy`, then `verify` and `compare`.

## From Redis

:::status{of="gizdb-kv"}
:::

Start GizDB with `--kv-port 6379`. `redis-cli` and the Redis clients connect. Strings, hashes,
lists, sets, sorted sets and TTLs are on the same durable database as your tables: a write reply
waits for the log sync.

## From S3

:::status{of="storage"}
:::

Point your S3 SDK or tool at the GizStack Storage endpoint with SigV4 keys. Buckets, objects,
versions and presigned URLs work as before. The same bytes are also a POSIX mount and back the
files of [Giz Drive](https://gizstack.com/drive).

## From Vercel

| Vercel | GizStack |
| --- | --- |
| `vercel deploy` | `curl …/deploy` with your [terminal token](https://gizstack.com/docs/platform/deploy#deploy-from-the-terminal) |
| Preview deployments | Previews at `NAME-HASH.giz.sh` |
| `*.vercel.app` | `*.giz.sh` |
| Environment variables | Write-only secrets |
| Serverless functions | One native process for each CPU, or WebAssembly at the edge |
| Vercel Postgres, KV, Blob | GizDB (PostgreSQL and Redis protocols) and Storage, in the same project |

A change goes live in about 2 s and open pages keep their state ([Deploy](https://gizstack.com/docs/platform/deploy)).

## From Supabase

| Supabase | GizStack |
| --- | --- |
| Postgres | GizDB, with a connection string |
| PostgREST, `supabase-js` `.from()` and `.rpc()` | The Data API of a team Database: change the URL and the key ([guide](https://gizstack.com/docs/platform/data-api)) |
| Row-level security | The same: `GRANT` and `CREATE POLICY` in the Database, or the access Policy in GizWeb |
| Auth (`signUp`, `signInWithPassword`, `getUser`, `signOut`) | The sign-in service of a team Database (same guide); other flows are not offered |
| Realtime | One WebSocket (`/db/TEAM/NAME/live`), `changes(...)` live queries and GizWeb live views; not the Phoenix protocol |
| Storage | GizStack Storage, with the S3 API |
| Edge functions | GizWeb apps compiled to WebAssembly |
