# Self-hosting

Apizie is open source and has zero runtime dependencies.

bashCopy
```
git clone https://github.com/nafadza14/zieapi
cd zieapi
npm start
```

## Deploy to Vercel with Supabase
- In Supabase, open the SQL editor and run `supabase/migrations/0001_apizie.sql` once. It creates one locked table (`apizie_kv`) and two functions only the server can call.
- Supabase → Authentication → Sign In / Providers → enable **Google** with your Google OAuth client. In Google Cloud the authorized redirect URI is `https://<project>.supabase.co/auth/v1/callback`.
- Supabase → Authentication → URL Configuration: add `https://<your-domain>/auth/supabase/callback` to Redirect URLs.
- Vercel → Settings → Environment Variables: `SUPABASE_PROJECT_ID`, `SUPABASE_PUBLISHABLE_KEY`, `SUPABASE_SECRET_KEY` (Supabase → Project Settings → API Keys → secret key), `APIZIE_SESSION_SECRET`, `APIZIE_ADMIN_EMAILS`, `APIZIE_PUBLIC_URL`.
- Deploy. `/healthz` shows `"storage":"SupabaseKV"` when the database is connected.

Upstash Redis (`KV_REST_API_URL`/`KV_REST_API_TOKEN`) also works instead of Supabase. Without either, data lives in memory and is lost on restart.

## Upstream adapter
Endpoints that are in the catalog but not implemented locally can be forwarded to a compatible gateway with `APIZIE_UPSTREAM_URL`, `APIZIE_UPSTREAM_KEY` and `APIZIE_UPSTREAM_HEADER`. Check that provider's terms before reselling access.
