This example uses Realm-Web SDK to query a realm graphql endpoint using swr.
This example relies on MongoDB Realm for its GraphQL backend.
Deploy the example using Vercel:
Execute create-next-app
with npm or Yarn to bootstrap the example:
npx create-next-app --example with-realm-web with-realm-web-app
# or
yarn create next-app --example with-realm-web with-realm-web-app
Download the example:
curl https://codeload.github.com/vercel/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-realm-web
cd with-realm-web
Install it and run:
npm install
npm run dev
# or
yarn
yarn dev
Deploy it to the cloud with Vercel (Documentation).
To set up your app:
- Link a cluster that includes the Atlas sample data sets
- Configure permissions for the
sample_mflix.movies
collection. For this demo, you can assign ready only permissions for all authenticated users. - Generate a collection schema for the
sample_mflix.movies
collection. Add a root-level "title" field to the schema with the value set to "movie". - Enable anonymous authentication
- Once your app is set up, replace the value of NEXT_PUBLIC_REALM_APP_ID in
.env
file with your App ID