Instruction file imported from mkjj/order-processing-platform (
.github/instructions/react-vite-structure.instructions.md). Copyright stays with the author.
React And Vite Structure
- Organize frontend code by responsibility. Introduce a directory only when it has a concrete owner or contains more than one related file.
- Keep Vite's
index.htmlat the frontend project root. Usepublic/only for files served directly without imports. - Place imported images, icons, and fonts in
src/assets/. - Place reusable presentation components in
src/components/, withcommon/,layout/, andui/subdirectories when they add clarity. - Place route-level components in
src/pages/<PageName>/and route definitions insrc/routes/. - Place custom React hooks in
src/hooks/, API and external integration code insrc/services/, and Context providers insrc/context/. - Use
src/store/only for actual shared application state; do not create it preemptively. - Put pure reusable helpers in
src/utils/, fixed values and route constants insrc/constants/, and global/shared CSS insrc/styles/. - Keep
App.tsxfocused on application composition andmain.tsxfocused on startup and provider mounting. - Use
.tsfor non-React modules and.tsxfor modules that render JSX. - For the current small application, keep the existing compact
src/layout until a file belongs clearly to one of these responsibilities. Avoid empty placeholder directories or premature abstractions.
- Create a
.gitignorefile at the frontend project root with at least the following content:
node_modules
dist