You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This document outlines the current state of our frontend architecture and sets the direction for future improvements. It covers folder structure, routing, state management, component libraries, testing, forms, provider usage, and more.
Boilerplate Folder Structure
Define top-level structure.
Define categorization.
Define components, their tests, styles, and hooks or subcomponents structure.
Define regular components and reusable components colocation.
Define hooks colocation.
Define constants colocation
Define data layer colocation: everything related to API calls.
Define utils colocation
Define styles colocation if there should be one.
Define the page/screen's colocation, its name, and how a screen should be.
From now on, our go-to library will be Radix, which is not a component library but a primitives library; it is beneficial to have a set of reusable primitives to handle different behaviors.
This also allows us to explore our library using shadCN components derived from Radix.
Reusable Components
We should have some reusable unstyled components with their tests and documentation in Storybook.
Common:
Typography / Text / Headings
Button
Badge / Chip
Modal
Tooltip
Label
Loader
Controlled and Uncontrolled variants of:
Input
TextArea
Radio
Checkbox
Switch
Select / Multiselect
Datepicker
RangePicker
Dropdown
FileInput (Dropzone)
Routing Standard
Currently, we are using react-router-dom to handle the routing system.
Boilerplate Architecture
Last Update: 27/06/2024
This document outlines the current state of our frontend architecture and sets the direction for future improvements. It covers folder structure, routing, state management, component libraries, testing, forms, provider usage, and more.
Boilerplate Folder Structure
Example for top-level structure:
Components Standard
From now on, our go-to library will be Radix, which is not a component library but a primitives library; it is beneficial to have a set of reusable primitives to handle different behaviors.
This also allows us to explore our library using
shadCN
components derived from Radix.Reusable Components
We should have some reusable unstyled components with their tests and documentation in Storybook.
Common:
Controlled and Uncontrolled variants of:
Routing Standard
Currently, we are using
react-router-dom
to handle the routing system.react-router-dom
Fetching and Remote State Handling
We mainly use
axios
to create API wrappers with specific configurations andreact-query
to cache remote data.useQuery
usage and colocation and give a few examples.queryOptions
default values for each critical query field.queryKeys
and if we are going to use, for example, a query keys factory or a simple object.useMutation
usage and colocation and give a few examples.State Management Standard
We mainly use states, Context API, and Zustand.
Forms and Validation Standard
We exclusively use
react-hook-forms
andzod
for form validation.Linting
Indentation
Providers
Currently, we use Stripe and Sentry in multiple projects, to name a few.
Stripe
Sentry
Google Analytics
PostHog
Frontend Testing Standard
Define at the end of the journey.
Design System Documentation
The text was updated successfully, but these errors were encountered: