Skip to main content
Navigation
HomeTechnical ReferenceJournalGitHubGitHub
Sidebar — toggle document categories via the logo
React Apollo Starter — TypeScript + GraphQL Template

React Apollo Starter — TypeScript + GraphQL Template

April 23, 2021

Overview

React Apollo Starter eliminates the boilerplate of setting up a new React + Apollo project. It comes pre-configured with TypeScript, Apollo Client for GraphQL data fetching, React Router for client-side navigation, and a working CRUD interface against a Todo model backed by a Django GraphQL API.

The starter is designed to pair with the Django GraphQL Starter — together they form a complete full-stack GraphQL template. It is also the reference frontend used by the Terraform AWS CI/CD infrastructure project.


Key Features

  • TypeScript throughout: Full type safety for component props, GraphQL responses, and routing
  • Apollo Client integration: Pre-configured client with caching, error handling, and query/mutation hooks
  • Todo CRUD demo: Working example of all four CRUD operations via GraphQL against a Django backend
  • React Router: Client-side routing with react-router-dom v5
  • Cookie-based token storage: JWT tokens stored in cookies via js-cookie for authenticated requests
  • Pre-configured testing: Jest + React Testing Library setup ready for writing component tests
  • SCSS styling: Sass preprocessing configured out of the box

Architecture

LayerRole
ReactUI components with Apollo hooks
Apollo ClientGraphQL data fetching, caching, state
React RouterClient-side navigation
TypeScriptStatic type checking across the app

The starter uses Create React App as its build system with TypeScript template. Apollo Client manages all data operations with the GraphQL endpoint, using an in-memory cache and automatic cache normalization.


Tech Stack

LayerTechnology
FrameworkReact 17
LanguageTypeScript 4
GraphQL ClientApollo Client 3
RoutingReact Router DOM v5
StylingSCSS (node-sass)
TestingJest + React Testing Library
BuildCreate React App (react-scripts)
Auth Tokensjs-cookie