# Migrating from Convex

Two options: keep your Convex deployment, or switch to Percher's managed PocketBase.

Option 1, keep Convex (easiest):
```toml
[data]
mode = "convex"
[data.convex]
deployment_url = "https://your-project.convex.cloud"
```
`CONVEX_URL` and `VITE_CONVEX_URL` are injected. Your app must read those names; set `NEXT_PUBLIC_CONVEX_URL` explicitly for Next.js browser clients. Deploy Convex functions through Convex and configure authentication redirects for your final app URL. See the [connection guide](https://percher.app/docs/external-databases#convex).

Option 2, switch to PocketBase. Concept mapping:
- `useQuery(api.tasks.list)` -> `pb.collection('tasks').getList()`
- `useMutation(api.tasks.create)` -> `pb.collection('tasks').create({})`
- Convex schema (schema.ts) -> PocketBase collections (admin UI or API)
- Convex functions (convex/) -> API routes in your app
- Convex auth (Clerk/Auth0) -> PocketBase built-in auth
- Convex file storage -> PocketBase file fields
- Realtime (automatic) -> `pb.collection('x').subscribe('*', fn)`

Key difference: Convex runs server functions in their cloud. With PocketBase your API routes run in your app container, so move Convex functions to Express/Hono/Next.js API routes.

Full guide: https://percher.app/docs/migrate-convex
