Skip to content

Instantly share code, notes, and snippets.

@pfraces
Last active October 7, 2020 08:30
Show Gist options
  • Save pfraces/4bd5d138f49f44a77dbbb029295cc5b1 to your computer and use it in GitHub Desktop.
Save pfraces/4bd5d138f49f44a77dbbb029295cc5b1 to your computer and use it in GitHub Desktop.
React Architecture

React Architecture

Starter

Preprocessors

CSS architecture

CSS layout

UI Components

JavaScript standard library

Router

State

Ajax

Business rules

Code quality

Unit testing

Backend

CI / CD

React Architecture - Folder Structure

v1 - Create React App

my-app/
 |- .storybook/
 |- .vscode/
 |- node_modules/
 |- public/
 |   |- index.html
 |   |- favicon.ico
 |- src/
 |   |- stories/
 |   |- App.module.scss
 |   |- App.test.tsx
 |   |- App.tsx
 |   |- index.scss
 |   |- index.tsx
 |   |- react-app-env.d.ts
 |   |- setupTests.ts
 |- .editorconfig
 |- .gitignore
 |- package.json
 |- package-lock.json
 |- README.md
 |- tsconfig.json

v2 - Grouping by features or routes

my-app/
 |- .storybook/
 |- .vscode/
 |- build/
 |- node_modules/
 |- public/
 |   |- index.html
 |   |- favicon.ico
 |- src/
 |   |- core/
 |   |   |- components/
 |   |   |   |- button/
 |   |   |   |   |- button.module.scss
 |   |   |   |   |- button.stories.scss
 |   |   |   |   |- button.tsx
 |   |   |   |- text-input/
 |   |- layout/
 |   |   |- components/
 |   |   |   |- header/
 |   |   |   |   |- header.module.scss
 |   |   |   |   |- header.stories.scss
 |   |   |   |   |- header.tsx
 |   |   |   |- sidebar/
 |   |   |- layout.tsx
 |   |- router/
 |   |   |- views/
 |   |   |   |- landing/
 |   |   |   |   |- landing.module.scss
 |   |   |   |   |- landing.stories.scss
 |   |   |   |   |- landing.tsx
 |   |   |   |- page-not-found/
 |   |   |- router.tsx
 |   |- routes/
 |   |   |- <route>/
 |   |   |   |- components/
 |   |   |   |- hooks/
 |   |   |   |- views/
 |   |   |   |- <route>.api.ts
 |   |   |   |- <route>.model.ts
 |   |   |   |- <route>.router.tsx
 |   |- styles/
 |   |   |- reset.scss
 |   |   |- theme.scss
 |   |- app.tsx
 |   |- index.scss
 |   |- index.tsx
 |   |- react-app-env.d.ts
 |   |- setupTests.ts
 |- .editorconfig
 |- .gitignore
 |- package.json
 |- package-lock.json
 |- README.md
 |- tsconfig.json
@pfraces
Copy link
Author

pfraces commented Sep 8, 2020

@pfraces
Copy link
Author

pfraces commented Sep 16, 2020

@pfraces
Copy link
Author

pfraces commented Sep 21, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment