This is a starter kit for Gatsby.js websites written in TypeScript. It leverages GraphQL Code Generator to enable typesafe GraphQL queries.
- Type safety with TypeScript
- Typesafe GraphQL with graphql-codegen
- Best practices with ESLint
- Styling with styled-components
Install the Gatsby CLI
yarn global add gatsby-cli
Create a new site
gatsby new <PROJECT_NAME> https://github.com/spawnia/gatsby-starter-typescript-graphql
By default, this starter adds the GitHub GraphQL API as a source. This can be quite useful for personal sites or blogs to show off your projects.
To connect with the GitHub API, you will need to add a personal access token to your environment:
cp .env.development.example .env.example
If you do not want to try this feature, remove src/components/repositories.tsx
and its usages.
Start a dev server
yarn start
Create a production build
yarn build
Serve the production build locally
yarn serve
Generate GraphQL type definitions
yarn codegen