rsnext/examples/with-realm-web
Nick Babcock 5629223407
Update examples to use React 17 (#26133)
[With next 11 requiring react 17](https://nextjs.org/blog/next-11#upgrade-guide), most of the examples
need to be updated, so the following snippet updated all the examples to
a compatible react version.

```bash
cd examples/
fd -g 'package.json' | xargs sed -r -i 's/"react": ".*"/"react": "^17.0.2"/
fd -g 'package.json' | xargs sed -r -i 's/"react-dom": ".*"/"react-dom": "^17.0.2"/'

# exclude experimental react version
git checkout with-reason-relay/package.json
```
2021-06-16 16:43:26 +00:00
..
lib update with-realm-web example (#24241) 2021-04-19 21:53:32 -05:00
pages [Fix] common misspelling errors (#15288) 2020-07-19 04:38:20 +00:00
.env Example with Monogdb ReamlWeb (#14555) 2020-06-30 09:50:44 +00:00
.gitignore Added .gitignore to examples that are deployed to vercel (#15127) 2020-07-16 10:52:23 -04:00
package.json Update examples to use React 17 (#26133) 2021-06-16 16:43:26 +00:00
README.md Update .now.sh to .vercel.app. (#22359) 2021-04-14 09:46:06 -05:00

Realm-Web SDK Example

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 your own

Deploy the example using Vercel:

Deploy with Vercel

How to use

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

Deploy it to the cloud with Vercel (Documentation).

Configuration

To set up your app:

  1. Link a cluster that includes the Atlas sample data sets
  2. Configure permissions for the sample_mflix.movies collection. For this demo, you can assign ready only permissions for all authenticated users.
  3. 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".
  4. Enable anonymous authentication
  5. Once your app is set up, replace the value of NEXT_PUBLIC_REALM_APP_ID in .env file with your App ID