Skip to content

kennarddh/reactjs-boilerplate

Repository files navigation

React JS Boilerplate

Guide

Install Dependencies

npm install

Environment Variables

All environment variables for react application must start with APP_ prefix

To change env prefix change add or remove string from envPrefix variable in vite.config.json

Environtment variables can be accesed using env.<name> or import.meta.env.<name>. Prefix must be included.

Declare env types in src/env.d.ts in ImportMetaEnv interface

The environment variables can be found and modified in the .env file. See .env for default values.

Eslint config file will be transpiled in prepare script or during install.

In the project directory, you can run:

Start

Start development build.

npm start

Build

Type check and build for production.

npm run build

Preview

Preview production build.

npm run preview

Clean

Removes all the files generated by the build process.

npm run clean

Lint Build

Transpile eslint.config.ts into eslint.config.js because eslint cannot read Typecript config.

npm run lint:build

Lint Check

Finds linting errors.

npm run lint:check

Lint Fix

Fix linting errors.

npm run lint:fix

Prettier Fix

Fix the code formatting.

npm run prettier:fix

Prettier Check

Check the code formatting.

npm run prettier:check

Types Check

Check Typescript types.

npm run types:check

Check

Check linting, code formatting, Typescript types.

npm run check

Fix

Fix linting, code formatting, and check Typescript types.

npm run fix

Notes