balintkiraly / next-ts-apollo-starter

NextJS starterwith TypeScript, ApolloClient and ChakraUI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NextJS with TypeScript and ApolloClient

This is a Next.js project bootstrapped with create-next-app.

Getting Started

1. Clone the repository

git clone https://github.com/balintkiraly/next-ts-apollo-starter

2. Install the dependencies

yarn install

The generator script will run automaticly after the install

3. Run the development server

yarn dev

4. Open the application

Open http://localhost:3000 with your browser to see the result.

How to create a new Query/Mutation

1. Write the query/mutation

  • Create a new file in the src/graphql folder with .graphql extension.
  • Simply write your query/mutation in the file

Always use a name like in the example

query CharactersList {
  ...
}

2. Run the codegen script

yarn generate

It will create a new file next to your graphql file with .generated.ts extension.

3. Use it

You can simpli import the hook from the generated file.

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

About

NextJS starterwith TypeScript, ApolloClient and ChakraUI


Languages

Language:TypeScript 64.4%Language:JavaScript 35.6%