The SDK for ROQ BaaS currently supports the following frameworks: Next.js, Nuxt.js, RedwoodJS, SvelteKit, and Express.js.
These are common steps to install the SDK for all supported frameworks:
Create a custom application using one of the supported frameworks.
For example, to create a Next.js application, run the following command:
Copy the environment values from ROQ Console into the
.env file in the custom application. For local development, you can choose the Local Environment on Console.
After copy the environment values, create file
.env in the root directory of project and paste the environment values. It is recommended to change the
ROQ_SECRET environment value into a more secure value. The default value is
@roq/cli command line tool. This tool will help you generate a custom SDK specifically tailored to the application that you have created.
npm install --save-dev @roq/cli
Install the ROQ BaaS SDK for a specific framework using the following command:
npm install --save @roq/<framework>
To install SDK for Next.js:
npm install --save @roq/nextjs
For a practical example, please refer to the quickstart on Next.js. It covers the SDK generation using
@roq/cli, authentication using
@roq/next.js, and simple data access to ROQ BaaS.
Once the installation is complete, you can generate the SDK using the following command:
npx @roq/cli generate
You will be prompted with a few questions. The generated SDK will be placed, by default, in the
src/lib/roq folder at the root of your application, and this CLI will automatically detect
ROQ_API_URL from your
.env file. The
ROQ_API_URL is the URL for ROQ BaaS API and it's unique for each generated application.
Please provide ROQ_API_URL … https://book-story-v1-ca2b-baas.vercel.app
✔ Enter the SDK path (default: src/lib/roq): … src/lib/roq
✔ Write SDK to src/lib/roq. Proceed? … yes