Skip to content

ServerlessReact.dev

Student Login

Deploy webapp on user actions

When using a static-first webapp approach, you have to make sure critical user actions trigger a deploy of your static app. Keeps your app fast and loading correctly the first time without waiting for live data to load.

And in the case of new pages, you have to deploy to make the URL work in the first place. Without a deploy users get a 404 page. We'll take care of faking pages on 404 errors in a bonus video.

We're using Zeit for our deploys because I like their CLI tools and approach to building developer tools. You can use the same approach with Netlify.

The basic flow works like this:

  1. User action triggers a GraphQL mutation
  2. Mutation resolver on server saves to database
  3. Resolver calls a deployment webhook
  4. Zeit re-deploys your app

Prep backend for live redeploys

Connect zeit and github

If you haven't put your project on github yet, now's a good time. You'll need that so Zeit knows which files to deploy.

Use deploy hooks to trigger deployments

Ensure deployment runs on save page

Verify deployments work

Created bySwizecwith ❤️