To run the project, simply run the following commands:
npm install
npm run dev
- app : routes
- api : API call functions
- styles : custom files for CSS purposes
- components : for larger components
- utils : utilities such as
formated-address
,formated-date
...
- Define interfaces for complex objects to improve type checking and readability.
- Use
readonly
keyword for properties that should not be modified after initialization.
- Break down components into smaller, reusable pieces or use Shadcn components
- Use functional components with hooks instead of class components
- Custom hooks can be used to share logic between components from
hooks
folder - Keep component logic and rendering separate.
- Use the @apply directive to keep utility classes DRY.
- Create reusable components for frequently-used patterns.
- Configure your Tailwind config file to match your project's design system.
- Each specific component must go into
/components
directory - Each generic component (as header, footer) must go into
/components/shared
directory - To create a component
card
, assume the following structure:
components
card.tsx
You can do the exact same thing for shared components:
components
shared
header.tsx
- Using a state inside is acceptable ONLY IF this state doesn't rely on a higher props.
- Do not make asynchronous calls within a component instead make calls in context or inside a page route.
- Do not handle job logic inside a component.
- Create a controller to use in the route.
To maintain consistency in naming, always use named exports:
// ✅ good
const CollectionCard = () => {};
// ⛔ bad
export default () => {};
- Each component needs an interface called Props (not IProps)
- Don't hesitate (do it in fact) to comment your code to explain what you are doing and where to find **the documentation **
Use a linter to improve the readability of classes and detect errors. Don't hesitate to run npm run lint
as needed.
- Add your new color to the
colors
entry oftailwind.config.js
- Do the same for background, custom shadow, animation, and keyframes so your changes can be used throughout the project