Git Product home page Git Product logo

react-template-next's Introduction

README.md banner

Package License Package Version

React Template Next

Start building modern web applications using React and Next.js.

Requirements

  • Node 18+
  • Git 2+
  • pnpm 8

Installation

  1. Get the template using npx degit:
  npx degit teo-garcia/react-template-next my_project
  1. Install the dependencies:
  pnpm install
  1. Run the project:
  pnpm dev

Tools

  • Next 14.
  • React 18.
  • Tailwind 3.
  • Typescript 4.
  • ESLint 8 + Prettier 3.
  • Husky 8 + Lint Staged 15.
  • Jest 29 + Testing Library React 14.
  • Playwright 1.
  • MSW 2.

Commands

Command Description
dev Run dev:web.
build Run build:web.
dev:web Run next in DEV mode.
build:web Run next in PROD mode.
start:web Run next server (build required).
test:unit Run jest.
test:e2e Run dev, and playwright.
lint:css Lint CSS files.
lint:js Lint JS files.
create:component Creates a component at src/components/<name>.
create:feature Creates a component at src/features/<name>.

react-template-next's People

Contributors

teo-garcia avatar github-actions[bot] avatar

Stargazers

 avatar Jeff Irwin avatar Alejandro Garcia Serna avatar Miguel Teheran avatar Juan SebastiΓ‘n avatar

Watchers

 avatar

react-template-next's Issues

[feat]: replace swr with react-query

Title: Replace useSWR with React Query

Description:

It would be nice to have React Query to perform client side requests

Type of change:

  • Client πŸ’…
  • Server ⚑️
  • Unit Testing πŸ§ͺ
  • E2E Testing πŸ€–
  • Tooling πŸ› 
  • Config πŸ“š

Images (If required):

feat: use vitest instead of jest

Title:

Description:

Type of change:

  • Client πŸ’…
  • Server ⚑️
  • Unit Testing πŸ§ͺ
  • E2E Testing πŸ€–
  • Tooling πŸ› 
  • Config πŸ“š

Images (If required):

[feat]: use playwright instead of cypress

Title: use playwright instead of cypress

Description:

Since playwright is gaining popularity, it might be a good idea to have it instead of cypress

Type of change:

  • Client ????
  • Server ??????
  • Unit Testing ????
  • E2E Testing ????
  • Tooling ????
  • Config ????

Images (If required):

feat: unify ci/cd pipelines

Title:

Description:

Type of change:

  • Client πŸ’…
  • Server ⚑️
  • Unit Testing πŸ§ͺ
  • E2E Testing πŸ€–
  • Tooling πŸ› 
  • Config πŸ“š

Images (If required):

bug: upgrade msw to fix type checking

Title:

Description:

Type of change:

  • Client πŸ’…
  • Server ⚑️
  • Unit Testing πŸ§ͺ
  • E2E Testing πŸ€–
  • Tooling πŸ› 
  • Config πŸ“š

Images (If required):

[bugfix]: Fix Playwright

Title: Fix Playwright

Description:

Right now Playwright is not running properly since it tries to run Jest tests and finds that
describe is not defined.

We need to add a specific path for e2e tests and fix the Playwright runner

Type of change:

  • Client πŸ’…
  • Server ⚑️
  • Unit Testing πŸ§ͺ
  • E2E Testing πŸ€–

Images (If required):

[feat]: add next-auth

Title: add next-auth

Description:

Since the template is getting better, it might be a good idea to install next-auth, so repos can have authentication from the beginning.

Type of change:

  • Client ????
  • Server ??????
  • Unit Testing ????
  • E2E Testing ????
  • Tooling ????
  • Config ????

Images (If required):

[feat]: Implement @next/fonts

Title:

Description:

Type of change:

  • Client πŸ’…
  • Server ⚑️
  • Unit Testing πŸ§ͺ
  • E2E Testing πŸ€–
  • Tooling πŸ› 
  • Config πŸ“š

Images (If required):

[bug]: Fix playwright runner

Right now Playwright is not running properly since it tries to run Jest tests and find that
describe is not defined.

We need to add a specific path for e2e tests and fix Playwright

[feat]: setup gh actions

Title: Setup Github Actions

Description:

Enable Github Actions on this repo

Type of change:

  • Client πŸ’…
  • Server ⚑️
  • Unit Testing πŸ§ͺ
  • E2E Testing πŸ€–

Images (If required):

[feat]: install and setup mock service worker for tests

Title: Add Mocking Working Service for testing

Description:

Add this library to enable network mocking effectively

How to (AI-Generated):

To set up MSW (Mock Service Worker) in your Jest + React Testing Library tests, follow these steps:

Install MSW and its dependencies:
sql
Copy code
npm install msw msw@next @testing-library/react-hooks --save-dev
Note: msw@next installs the latest beta version of MSW at the time of writing this.

Create a src/mocks/handlers.js file. This file will contain your mock server handlers. Here's an example:
php
Copy code
import { rest } from 'msw';

export const handlers = [
  rest.get('/api/todos', (req, res, ctx) => {
    return res(
      ctx.status(200),
      ctx.json([
        { id: 1, text: 'Buy milk' },
        { id: 2, text: 'Walk the dog' },
        { id: 3, text: 'Do laundry' },
      ]),
    );
  }),
];
Create a src/setupTests.js file. This file will configure your test environment to use MSW. Here's an example:
scss
Copy code
import { server } from './mocks/server';

beforeAll(() => server.listen());
afterEach(() => server.resetHandlers());
afterAll(() => server.close());
Note: ./mocks/server is the path to your mock server file, which we will create in the next step.

Create a src/mocks/server.js file. This file will create and export a mock server instance. Here's an example:
javascript
Copy code
import { setupServer } from 'msw/node';
import { handlers } from './handlers';

export const server = setupServer(...handlers);
Use MSW in your tests. Here's an example:
javascript
Copy code
import { render, screen } from '@testing-library/react';
import App from './App';

test('renders todos', async () => {
  render(<App />);
  const todo1 = await screen.findByText('Buy milk');
  const todo2 = screen.getByText('Walk the dog');
  const todo3 = screen.getByText('Do laundry');
  expect(todo1).toBeInTheDocument();
  expect(todo2).toBeInTheDocument();
  expect(todo3).toBeInTheDocument();
});

That's it! Now your tests will use MSW to mock your API requests.

Type of change:

  • Client πŸ’…
  • Server ⚑️
  • Unit Testing πŸ§ͺ
  • E2E Testing πŸ€–
  • Tooling πŸ› 
  • Config πŸ“š

Images (If required):

feat: migrate to eslint 9

Title:

Description:

Type of change:

  • Client πŸ’…
  • Server ⚑️
  • Unit Testing πŸ§ͺ
  • E2E Testing πŸ€–
  • Tooling πŸ› 
  • Config πŸ“š

Images (If required):

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.