Graphql+Salesforce -based React Native Movie Application
This app is featured in a Dreamforce 2016 talk: Leverage GraphQL to Efficiently Query Data Relationships in Salesforce
MovieQL is a project handling both React Native client and the GraphQL server.
The root of the project is the React Native app, while what's in /data
is the GraphQL schema server.
You will need to setup Node 6+ and React Native first.
Then you have to choose how to run this:
- Run it from the public MovieQL heroku endpoint
- Run it from your own Salesforce Org configured for MovieQL
First, you need to get the code!
git clone https://github.com/rricard/movieql.git
cd movieql
npm install
Skip this step if you use your own Salesforce setup
You need to change the code to point to the public endpoint in every case:
app/client.js
- const GRAPHQL_ENDPOINT = __DEV__ ? 'http://localhost:3000/graphql' : 'https://movieql.herokuapp.com/graphql';
+ const GRAPHQL_ENDPOINT = 'https://movieql.herokuapp.com/graphql';
Skip this step if you use the public endpoint
You will need to setup the following custom objects in Salesforce (using the Schema Builder):
Once it is done, populate some Movie, Actor and Role in Salesforce, correctly linking them to numeric MovieDB IDS.
Example: Reservoir Dogs has the following url on MovieDB: https://www.themoviedb.org/movie/500-reservoir-dogs?language=en. In this URL, the ID is 500.
Skip this step if you use the public endpoint
Create a .env
file in the repository directory with the following contents:
MOVIE_DB_TOKEN=<Get this token on https://www.themoviedb.org/documentation/api>
SFDC_USERNAME=<enter your salesforce email used for login>
SFDC_PWD_AND_TOKEN=<enter your salesforce password><security token - help here: https://help.salesforce.com/HTViewHelpDoc?id=user_security_token.htm>
Skip this step if you use the public endpoint
Now everything is ready to start!
npm start
npm run rn-start
react-native run-ios
react-native run-android
./node_modules/.bin/flow
npm test
npm run lint