All Projects → uruha → next-with-ts

uruha / next-with-ts

Licence: MIT License
Next.js for boiler plate to easy development.

Programming Languages

typescript
32286 projects
perl
6916 projects
Raku
181 projects
javascript
184084 projects - #8 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to next-with-ts

cafecito
Cafecito es un proyecto hecho en Next.JS con Express.JS y MongoDB para recibir cafés ☕️ a modo de donaciones.
Stars: ✭ 95 (+331.82%)
Mutual labels:  nextjs
blog
Tech Blog (moved to zenn.dev/hellorusk)
Stars: ✭ 29 (+31.82%)
Mutual labels:  nextjs
saving-goal
React.js, Next.js and TypeScript studies. In this project I tried to apply knowledges from some courses I've taken. Testing with react testing library, styling with styled components, etc.
Stars: ✭ 15 (-31.82%)
Mutual labels:  nextjs
boilerplate
Fullstack boilerplate using Typescript, React, Node & GraphQL
Stars: ✭ 738 (+3254.55%)
Mutual labels:  nextjs
kami
🍰 Kami is mx-space's web frontend theme. Cute and lovely.
Stars: ✭ 92 (+318.18%)
Mutual labels:  nextjs
moveit
Move.it is a project that combines the pomodoro (🍅 ) technique with some challenges (⚔️ ) for the well-being (🥰 ) of those who spend many hours (⏳ ) using the computer 🖥
Stars: ✭ 12 (-45.45%)
Mutual labels:  nextjs
next-pwa-template
Next.js progressive web app template
Stars: ✭ 266 (+1109.09%)
Mutual labels:  nextjs
scriptified.dev
A weekly newsletter with insightful tips, tools, resources & more on React and JavaScript. Made with NextJS && TailwindCSS. Curated by @gupta-ji6 && @prateek3255.
Stars: ✭ 18 (-18.18%)
Mutual labels:  nextjs
inaba-jinja
因幡神社へようこそ!
Stars: ✭ 14 (-36.36%)
Mutual labels:  nextjs
nextly-template
Nextly Landing Page Template built with Next.js & TailwindCSS
Stars: ✭ 48 (+118.18%)
Mutual labels:  nextjs
shici
使用 next.js 与 graphql 做一个诗词小站
Stars: ✭ 79 (+259.09%)
Mutual labels:  nextjs
wrapped
GitHub Wrapped, inspired by Spotify Wrapped
Stars: ✭ 159 (+622.73%)
Mutual labels:  nextjs
next-rest
Typesafe REST APIs for Next.js
Stars: ✭ 17 (-22.73%)
Mutual labels:  nextjs
static-template-nextjs
A Next.js based template of a blog built using the Collected Notes API
Stars: ✭ 19 (-13.64%)
Mutual labels:  nextjs
nativesintech.org
The repository for the Natives in Tech website
Stars: ✭ 37 (+68.18%)
Mutual labels:  nextjs
site
限界開発鯖公式サイト
Stars: ✭ 25 (+13.64%)
Mutual labels:  nextjs
harshhhdev.github.io
Harsh Singh's personal blog and portfolio ⚡ built with Next.js
Stars: ✭ 23 (+4.55%)
Mutual labels:  nextjs
epic-react-exercises
Practical React exercises with detailed solutions.
Stars: ✭ 126 (+472.73%)
Mutual labels:  nextjs
javelin
❤️ app to arrange notes in columns
Stars: ✭ 18 (-18.18%)
Mutual labels:  nextjs
swr-examples
SWR is a React Hook library for remote data fetching. Here are some simple examples.
Stars: ✭ 14 (-36.36%)
Mutual labels:  nextjs

Next.js with Typescript

Next.js simple boiler plate.

Motivation

1. Practical

Most of Web FrontEnd App need a web server.
This project deferred node.js (Koa.js) web server is prepared.

2. Simple

As mush as possible simple archtecture.
It is clear what you are doing by looking at the code.

Flux

No business logic is brought into Action and Reducer.
Business logic concentrates on Saga tasks.

Action
  • Naming "actually happend"
    • As a result, REST-like naming
  • No operation payload
  • Action has two opreration
    1. Start any redux-saga task
    2. Deliver Action type and payload to reducer
Reducer
  • Only do the work of updating which state for each Action
  • No operation payload
Middleware (Redux-saga)
  • Always start a task with an Action
  • End the task with Action, or let the routing process finish the task
  • Asynchronous processing uses the call API
  • Can operation payload (※ keep the following promise)
    1. It is possible to take a value from State (using select API)
    2. It is also possible to manipulate the value retrieved from State in the task
    3. However, state must be updated via Action => Reducer (does not update State directly with the manipulated value)

flux flow

3. Type annotation

  • Use typescript

Spec

Directory

    .
    ├─ docker           # 
    │   ├─ app          # FrontEnd App (multi stage build)
    │   └─ web          # nginx (proxy)
    │
    ├─ pages            # web pages
    │   └─ api          # BFF api
    │
    ├─ server           # web server
    │
    └─ src              # 
        ├─ actions      # redux: action
        ├─ components   # react: component
        ├─ hooks        # react: hooks
        ├─ pages        # only next.js pages testing
        ├─ reducers     # redux: reducer
        ├─ sagas        # redux[middleware]: redux-saga
        ├─ service      # libs | utils
        └─ store        # redux: configure store

The testing directory is distributed in parallel with the directory that has each function.

    .
    ├─ hoge
    │   ├─ __test__ # hoge testing directory

Environment

- node.js >= 12.14.1
- next.js >= 9.3.1
- docker
  - engine >= 19.03.x
  - compose >= 3.6

How to use

Quick development start

1. npm i install
2. docker-compose up

> http://localhost(:80)

This project use nginx for reverse proxy and static resource cache control.

   localhost:80      localhost:3000
    -----------     ----------------
--> |  nginx  | --> |     app      |
    | [proxy] |     | [next + koa] |
    -----------     ----------------

Code Generator

you may create React Component / Redux Action, Reducers from Hygen template.

npm run gen component
npm run gen redux

Deployment to ECR

You can choose from two methods

  • Github Actions
  • CircleCI

Test policy

Component

Mainly use testing-library/react, react-hooks.

Checkpoints

  1. After fire event, compare target state or props differences
  2. With or without props, examine the state of the output HTMLElement contained by Component

Redux / Redux-saga

Action [priority: LOW]

Normaly simple unit testing. Because of actions is pure function and have types for I/O, If types is safe, there is without having to do little testing.

Reducer [priority: MIDDLE]

Reducer testing have two types, unit and snapshot testing. Unit testing is compare initial state to updated state. Snapshot testing is check the difference visually for target state.

Why do snapshot testing ?

The reducer updates the state (object) on the defined reducer scope for any action.
In other words, it is necessary to check the change of state only for the variation of action, and it is not realistic to cover by comparing the values.
Therefore, we propose to perform a regression test for any action. If it is a regression, you can always check the state of the state visually with a pull request.
If the specs change, the team will be able to discuss the changes in the PR.
No need to consider values in regression tests. Just see what the reducer changes the state with the code.

Redux-saga [priority: HIGH]

Redux-saga testing is integration test using redux-saga-test-plan.
If there is a unit test that can be separately performed during the task, let's do that as a separate test.
Since the I/O of the task is guaranteed by the benefits of TypeScript, it is recommended that you evaluate whether the actual processing of the task is as intended.

Others

Basically, do a unit test.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].