- Latest Next.js version.
- GraphQL Apollo client with built-in JWT authentication.
- Localization via i18next.
- Configured TypeScript environment.
- Configured Sass/SCSS via next-sass for styling (plus Normalize.css included).
- Built-in helpers.
- Testing environment via Jest and @testing-library/react.
- Prettier for code formatting.
- Debug configuration for VSCode.
- Docker configuration to serve production-ready build with Nginx.
yarn
yarn start
Run tests located in __tests__
directory:
yarn test
Pretty much everything you need to know you can find in Next.js documentation.
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>
);
};
Build and run Dockerized production-ready build, run:
docker-compose up --build