Skip to content

jassix/react-boilerplate

Repository files navigation

GitHub License GitHub Repo stars

React.js Boilerplate

This is a boilerplate/template project for building React.js applications, utilizing several modern technologies and libraries including Effector for state management, Farfetched for data fetching, Cypress for end-to-end testing, Bun as runtime, Vite for fast development environment, Storybook for component documentation and testing, react-testing-library and Jest for unit testing, and Emotion for styling.

Technologies Used

  • Effector: State management library for React applications.
  • Farfetched: Lightweight and composable data fetching library.
  • Cypress: End-to-end testing framework.
  • Bun: Fast JS runtime.
  • Vite: Fast, opinionated web dev build tool that serves your code via native ES Module imports during development.
  • Storybook: UI component explorer for frontend developers.
  • React Testing Library and Jest: For unit testing React components.
  • Emotion: A performant and flexible CSS-in-JS library.

Features

  • Effortless state management with Effector.
  • Simplified data fetching with Farfetched.
  • Comprehensive testing capabilities with Cypress, Jest, and React Testing Library.
  • Efficient styling using Emotion.
  • Rapid development setup with Vite.
  • Component documentation and testing facilitated by Storybook.

Getting Started

Prerequisites

Make sure you have Bun installed on your machine.

Installation

  1. Clone the repository:
git clone https://github.com/jassix/react-boilerplate.git
  1. Navigate to the project directory:
cd react-boilerplate
  1. Install dependencies:
bun install

Development

To start the development server, run:

bun dev

This will start the Vite development server.

Building

To build the project for production, run:

bun run build

This will generate a production-ready build in the dist directory.

Testing

Unit Testing

To run unit tests using Jest, execute:

bun run test

End-to-End Testing

Cypress is used for end-to-end testing. To run Cypress tests, use:

bun run test:e2e

Storybook

To start Storybook and view your components in isolation, run:

bun storybook

Folder Structure

/
β”œβ”€β”€ public/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ providers/ - Applications providers
β”‚   β”‚   β”œβ”€β”€ layouts/ - Different layouts for your pages
β”‚   β”‚   β”œβ”€β”€ router/ - Router-Component, collect your routes in one place
β”‚   β”‚   β”œβ”€β”€ styles/ - Global styles for your app
β”‚   β”‚   β”œβ”€β”€ core.tsx - Root-Component, your providers and routing must will connected there
β”‚   β”‚   └── index.tsx - Application entry-point
β”‚   β”œβ”€β”€ pages/ - Pages
β”‚   β”œβ”€β”€ widgets/ - Widgets
β”‚   β”œβ”€β”€ features/ - Features
β”‚   β”œβ”€β”€ entities/ - Entities
β”‚   └── shared/ - Shared
β”‚       β”œβ”€β”€ api/ - All requests to API
β”‚       β”œβ”€β”€ lib/ - Additional local "libraries"
β”‚       β”‚    β”œβ”€β”€ media-query
β”‚       β”‚    └── i18n
β”‚       β”œβ”€β”€ routing/ - Basement for routing, e.g. paths, or something else
β”‚       β”œβ”€β”€ config/ - General config for your app
β”‚       └── ui/ - UI-Kit, with atomic design
β”‚           β”œβ”€β”€ atom
β”‚           β”œβ”€β”€ molecules
β”‚           └── organisms
└── package.json

License

This project is licensed under the MIT License.

Acknowledgements


Feel free to contribute to this project and tailor it to your specific needs! If you encounter any issues or have suggestions for improvements, please open an issue or create a pull request. Happy coding! πŸš€