douglas86 / nextjs-template

This is a template for nextjs
0 stars 0 forks source link

Introduction—Next.js Template

GitHub Next JS PostgresDB Prettier Prisma Swagger UI Tailwind Figma

Cypress.io


Table of content


Getting Started

What is necessary before cloning this repository?

Note: to install the above information, please see the Instructions on your preferred Operating system

Setting up Locally

engines_object.png

env_variables.png

DATABASE_URL environment variable

NEXT_APP_GOOGLE_CLIENT_ID and NEXT_APP_GOOGLE_SECRET_KEY environment variable

JWT_SECRET, DATA_ENCRYPTION_SECRET, NEXTAUTH_SECRET_IV environment variable

NEXTAUTH_ALGORITHM environment variable

NEXTAUTH_URL environment variable

Note: make sure that all environment variables are in quotes

Note: "$" symbol in front is not part of the command it is to show that it is a command meant for the terminal

Instructions for Linux

Note: "$" symbol in front is not part of the command it is to show that it is a command meant for the terminal

Instructions for Windows

Instructions for Mac

I haven't been able to test on a MacBook Yet But, strictly speaking, the setup process should be the same as Linux

Node Version Manager

Note: "$" symbol in front is not part of the command it is to show that it is a command meant for the terminal

Commands that can be used with NVM:

Note: To get the latest nvm script click here

pnpm Package Manager

To install pnpm run the following command: $ npm install -g pnpm

Commands that can be used with PNPM:

Note: pnpm uses symlinks for all node packages, which in theory is supposed to make it faster for execution and storage space

Note: If you are using windows, please use PowerShell to run pnpm as for some reason wsl didn't want to work in this regard


Features

This project has the following features

Scripts

Docker

Prisma

Cypress

How to use useFetch hook

Introduction: This hook is going to be used to fetch data from the server

fetch.png

How to use useScroll hook

Introduction: This hook uses infinite scroll to fetch data from the server

scroll.png

How to use useAppContext hook

Introduction: This hook is used to fetch and post data to the state store

What is declared in the state store?

state-store.png

How do you use the State store?

Fetching data from state store?

destructure.png

display-data.png

Posting data to your endpoint?

dispatch.png

dispatch-function.png

userReducer.png

Swagger UI

swagger.png


Branching Strategy

git-flow.png

Description of branch strategy

We will be using Git Flow as Our Branching Strategy

Note: for this project I have added two additional branch names, bug and docs

Branch Protection Rules

This repository has got certain branch protection rules applied

Block direct push

Branch name validation

Branch restrictions

There are three different criteria that fall into this category:


Atomic Design Structure

atomic-design.png

Description of atomic design

Atoms: first stage

atoms.png

Molecules: second stage

molecule.png

Organisms: third stage

organisms.png

organism-example.png

Templates: forth stage

template.png

template-example.png

Pages: fifth stage

pages.png

page-example.png


Bugs

Error invalid arg value

Explain the Problem?

Invalid-arg.png

JWT Session Error

Explain the Problem?

session-error.png


Credits