Welcome! Today, we're going to learn how to build a fullstack GraphQL app using Apollo Server, Apollo Engine, and Apollo Client. Let's get started! 🚀
If you need to reference the slides, you can view them here.
Please take the post-workshop survey!! Your honesty is important to helping me improve for next time: https://goo.gl/forms/KHE9Ipd8u8UFg79G2
Since we have a lot of material to cover, we're going to complete all the exercises within the browser. This ensures that we minimize our time spent on environment setup and maximize our time learning cool stuff about GraphQL.
Here are the accounts you'll need for today:
You'll also need to install Apollo DevTools for Chrome. If you have all 4 of these things, then we're ready to begin!
Welcome to the server portion of the workshop! For the morning session, we will be building a GraphQL server based on the Movie DB REST API.
server.js
: Where all the magic happens to set up Apollo Serverschema.js
: Your GraphQL schema goes hereresolvers/
: Write your resolvers for each type in this foldermodels/
: Your models separate out the data fetching logic from your resolversloaders.js
: We've already created a loader function for you here. You won't need to modify this file.utils.js
: A utility function for constructing query parameters. You won't need to modify this file.store.js
: A SQLite DB created with the Sequelize ORM for storing likes and user info. You won't need to modify this file.
-
Click this button to remix the project
-
On the left hand menu in Glitch, click Logs > Console
-
Confirm you're tracking origin by running
git remote -v
. If you are, then you can skip step #4 and go to step #5 -
If you are not tracking origin, run this command:
git remote add origin https://github.com/apollographql/fullstack-workshop-server && git fetch origin && git checkout 00-start && refresh
-
If you are tracking origin, run this command:
git fetch origin && git checkout 00-start && refresh
-
Navigate to
server.js
. You should not see anyApolloServer
setup code. If that's the case, then you're good to go!
00-start
: Your starting point01-apollo-server
: Setting up Apollo Server and Apollo Engine02-schema
: Writing your schema03-resolvers
: Implementing resolvers04-final
: Includes authentication, loaders, and caching
- I didn't complete the last exercise and want to catch up: No worries! I've created branches for all the steps in the workshop so everyone can go at their own pace. To check out the completed solution for your exercise, look for the branch above. In your Glitch terminal or local terminal, replace
01-apollo-server
with the exercise you're on:
git stash
git checkout 01-apollo-server
- I'm getting errors related to the Engine proxy: You need to make a .env file in the root that contains
ENGINE_API_KEY=yourkeyhere
. Replace yourkeyhere with the Engine key you get from creating your own service.
- Clone the repo:
git clone https://github.com/apollographql/fullstack-workshop-server
- Then, make a
.env
file with anENGINE_API_KEY
environment variable. You can get one here by creating your own Engine service. - Install the dependencies:
npm i
- Start the server:
npm start
. Your server will be running on port 3000. Your GraphQL server is available atlocalhost:3000/graphql
and your GraphQL Playground is available atlocalhost:3000/graphql
.
Welcome to the client portion of the workshop! For the morning session, we will be building a React app that pulls a list of movies, filters them by type, and allows you to favorite them after you've been logged in. The app is backed by Create React App and Apollo Client.
index.js
: Where we set up Apollo Clientcomponents/
: All of the React components that you will connect to Apollodata.js
: Seed data powering the components before we switch to GraphQLApp.js
: The top-level App component. You won't need to modify this file.index.css
: Some random CSS. You won't need to modify this file.
- Click the button above to navigate to the CodeSandbox. Fork it to your account by clicking Fork in the top menu.
- That's it! CodeSandbox features HMR, a console, and a test runner. It's pretty awesome. 😍
00-start
: Your starting point01-apollo-client
: Setting up Apollo Boost and React Apollo02-queries
: Writing Query components03-pagination
: Writing Query components with Pagination04-login
: Writing Mutation components for login & authentication05-mutations
: Writing Mutation components & optimistic UI06-final
: Local state management with apollo-link-state
- I didn't complete the last exercise and want to catch up: No worries! Each branch is its own CodeSandbox so everyone can go at their own pace. To check out the completed solution for your exercise, just click the CodeSandbox links above.
- Clone the repo:
git clone https://github.com/apollographql/fullstack-workshop-client
- Install the dependencies:
npm i
- Start the server:
npm start