ziishaned / nextjs-apollo-ts-starter

Next.js Apollo TypeScript pre-configured starter with great DX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Next.js Apollo TypeScript Starter With Docker

What you get

Features

Developer Experience

Getting started

Start development server

yarn
yarn start

Run tests

Run tests located in __tests__ directory:

yarn test

Pretty much everything you need to know you can find in Next.js documentation.

Additional Helpers

useAuth() Hook

This hook helps you to implement authentication. Here is an example how to use it:

import React from 'react';

import { useAuth } from './utils/auth';

const MyPage = () => {
  const [{ data }, logout] = useAuth();

  const handleLogout = () => {
    logout(); // Removes token from cookies
    document.location.reload();
  };

  return (
    <div>
      {data ? (
        <div>
          <div>Hello, {data.me.name}!</div>
          <button onClick={handleClick}>Log out</button>
        </div>
      ) : (
        <div>Please sign in</div>
      )}
    </div>
  );
};

Docker

Build and run Dockerized production-ready build, run:

docker-compose up --build

About

Next.js Apollo TypeScript pre-configured starter with great DX


Languages

Language:TypeScript 83.8%Language:JavaScript 12.8%Language:Dockerfile 3.1%Language:CSS 0.2%