# Quickstarts for other frameworks

`rezin init` sets up Next.js, Vite, SvelteKit, Nuxt, React Native and plain Node applications the same way it sets up [Expo](https://rezincore.com/docs/quickstarts/expo.md): a project for each environment, the same tables in each, your settings written the way the framework reads them, and a ready-made client file.

> These steps were checked by running `rezin init` against a sample folder for each framework and a real API. The frameworks themselves were not run.

## The same for all of them

You need the [`rezin` tool](https://rezincore.com/docs/tools/cli.md) signed in with a look-and-change token that reaches the whole company and includes **Your account and companies** and **Database**, and you must be an owner of the company.

```
cd my-app
rezin init                 # shows the plan and asks
rezin init --dry-run       # only shows the plan
rezin init --envs development,staging,production
```

It works out the framework from `package.json`. To say it yourself: `--next`, `--vite`, `--sveltekit`, `--nuxt`, `--react-native`, `--node`.

Unless you choose otherwise you get a `development` and a `production` project. It writes one settings file for each, a client file, a starter migration in `rezin/migrations`, and `rezin/config.json` (which project each environment is; commit it). Files that already exist and would change are copied aside first.

**No secret key is written.** Only the API address, the project ID and the publishable key.

Then install the library, which `rezin init` offers to do:

```
npm install https://rezincore.com/docs/downloads/rezincore-client.tgz
```

## Next.js

| | |
|---|---|
| Settings | `.env.development`, `.env.production`: `NEXT_PUBLIC_REZIN_URL`, `NEXT_PUBLIC_REZIN_PROJECT_ID`, `NEXT_PUBLIC_REZIN_KEY` |
| Client | `src/lib/rezin.ts` if you have a `src` folder, otherwise `lib/rezin.ts` |
| Allowed for sign-in | `http://localhost:3000/**` on the development project |

```tsx
'use client';
import { rezin } from '@/lib/rezin';

const orders = await rezin.table('orders').select({ limit: 20 });
```

The client keeps the session in the browser's `localStorage`, so use it in client components. For work on the server that acts for an organization, make a second client there with a secret key from your host's secret settings.

Add your site's real address to the production project under **Sign-in → Site addresses** before you launch.

## Vite (React, Vue, anything)

| | |
|---|---|
| Settings | `.env.development`, `.env.production`: `VITE_REZIN_URL`, `VITE_REZIN_PROJECT_ID`, `VITE_REZIN_KEY` |
| Client | `src/lib/rezin.ts` or `.js` |
| Allowed for sign-in | `http://localhost:5173/**` on the development project |

```js
import { rezin } from './lib/rezin';
```

## SvelteKit

| | |
|---|---|
| Settings | `.env.development`, `.env.production`: `PUBLIC_REZIN_URL`, `PUBLIC_REZIN_PROJECT_ID`, `PUBLIC_REZIN_KEY` |
| Client | `src/lib/rezin.ts`, reading them from `$env/static/public` |
| Allowed for sign-in | `http://localhost:5173/**` on the development project |

```js
import { rezin } from '$lib/rezin';
```

## Nuxt

| | |
|---|---|
| Settings | `.env.development`, `.env.production`: `NUXT_PUBLIC_REZIN_URL`, `NUXT_PUBLIC_REZIN_PROJECT_ID`, `NUXT_PUBLIC_REZIN_KEY` |
| Client | `lib/rezin.ts` or `.js` |
| Allowed for sign-in | `http://localhost:3000/**` on the development project |

Nuxt reads `.env` by default. Start it with the file for the environment you want, for example `nuxt dev --dotenv .env.development`.

## React Native without Expo

| | |
|---|---|
| Settings | `.env.<environment>`: `REZIN_URL`, `REZIN_PROJECT_ID`, `REZIN_KEY` |
| Client | `lib/rezin.ts` or `.js`, with the session kept in AsyncStorage |

React Native has no settings file of its own. Read these values with whatever your application already uses for build settings, and adjust `lib/rezin` to match. Also install `@react-native-async-storage/async-storage`.

## Node

| | |
|---|---|
| Settings | `.env.<environment>`: `REZIN_URL`, `REZIN_PROJECT_ID`, `REZIN_KEY`. `.env*` is added to `.gitignore` |
| Client | `lib/rezin.ts` or `.js` |

```
node --env-file=.env.development server.js
```

With the publishable key the client acts for whoever signs in. For a server that acts for an organization with nobody signed in, pass a secret key and `organizationId` to `createClient`, and keep that key in your host's secret settings, not in a file.

## Afterwards

- [The client library](https://rezincore.com/docs/client.md): everything it does.
- `rezin types -o src/rezin.types.ts`: types for your tables.
- [Environments](https://rezincore.com/docs/environments.md): `rezin env push` and `rezin env diff`.
