νκ΅μ΄ μ€λͺ μλ μ¬κΈ°μμ λ³Ό μ μμ΅λλ€.
- ποΈ Project Structure (FSD Perspective)
- π Project Overview
- π οΈ Tech Stack
- β‘ Installation & Run
- ποΈ State Management Structure
- π¨ Theme & Color Settings
- π·οΈ Action Naming Convention
- π Reducer Usage (Sync/Async)
- π§ Dynamic Routing Structure
- π§© SS Components & shadcn Library Issues
- π§Ή Code Style (Prettier) Usage
- π Other TODOs & Improvements
This project is structured based on the Feature-Sliced Design (FSD) pattern.
Each folder is separated by responsibility, aiming for maintainability and scalability as follows:
src/
app/ # App entry point, global settings, store, router, etc.
api/ # API client and global API settings
router/ # Router and related utils, types
store/ # Global state management (redux, etc.)
assets/ # Static assets like fonts, images, locales
features/ # Business domain/feature-specific folders
[feature]/ # e.g., sample, user, etc.
[Feature].tsx # UI/logic for the feature
[feature]Reducer.ts # Reducer for the feature
pages/ # Route-level page components (including dynamic routing)
[route]/ # e.g., url, extra, etc.
[Page].tsx # Page component for the route
shared/ # Components, utils, layouts shared across features/pages
components/ # Common UI components (button, toast, theme, etc.)
lib/ # External library wrappers, common hooks, styles, etc.
utils/ # Common utility functions
layouts/ # Common layout components (header, footer, etc.)
stories/ # Storybook, documentation, test components
styles/ # Global styles, variables, reset, etc.
main.tsx # App entry point
App.tsx # Root component
- app/: Global layer for settings, store, router, etc.
- assets/: Static resources like fonts, images, locales
- features/: Business domain-specific features (each feature can have its own UI, state, business logic)
- pages/: Route-level page components, supports dynamic routing
- shared/: Common elements reused across features/pages (components, utils, layouts, etc.)
- stories/: Storybook, documentation, test components
- styles/: Global styles, CSS variables, reset, etc.
- A boilerplate project based on React + TypeScript.
- Designed for fast development, scalability, and maintainability.
- React 19
- TypeScript 5
- Redux Toolkit (state management)
- Redux
- Redux-Saga
- Typesafe-Actions
- React-Redux
- React-Router v7
- Vite 6 (bundler)
- Storybook 8 (UI documentation)
- Cypress 14 (E2E testing)
- Vitest 3 (unit testing)
- Playwright (browser testing)
- TailwindCSS 4
- Prettier 3 & prettier-plugin-tailwindcss
- shadcn/ui (UI components)
- i18next (internationalization)
- Framer Motion (animation)
- Lucide-react (icons)
yarn install
yarn dev # Start development server
yarn build # Build for production
yarn preview # Preview production build
yarn lint # Run ESLint
yarn storybook # Start Storybook
yarn build-storybook # Build Storybook static site
yarn test # Run unit tests (Vitest)
yarn test:run # Run all tests in CI mode
yarn cypress # (if configured) Run Cypress E2E tests
- Uses Redux Toolkit for global state management.
- Store, hooks, and utils are located in
src/app/store/redux/
. - Each feature has its own slice (reducer).
- Async operations are handled with createAsyncThunk or redux-saga (if needed).
// src/app/store/redux/reduxStore.tsx
import { configureStore } from '@reduxjs/toolkit';
import sampleReducer from 'src/features/sample/sampleReducer';
export const store = configureStore({
reducer: {
sample: sampleReducer,
// ...other reducers
},
});
- Supports dark mode/light mode
- Theme colors are managed in
src/shared/components/lib/shadcn/styles/shadcn.pcss
andcolorConstants.tsx
- For color customization, use shadcn-ui-theme-generator and apply to
src/shared/components/lib/shadcn/styles/shadcn-variables.css
- TailwindCSS is used for utility-first styling.
- Basic Rule
- Use verb+target format:
get~~
,edit~~
,del~~
,create~~
, etc. - If state change is needed, append
Status
at the end
- Use verb+target format:
- Local Reducer
- Action names should NOT end with
Fail
orSuccess
(due to auto-generation/recognition issues) - If needed, use a
todo
prefix or similar for improvement
- Action names should NOT end with
- Managed as a regular slice reducer
- Example:
reducers: { setValue: (state, action) => { state.value = action.payload; } }
- Use
createAsyncThunk
for async actions - Or use redux-saga for more complex side effects
- Handle pending/fulfilled/rejected in extraReducers
- Example:
extraReducers: (builder) => { builder .addCase(fetchData.pending, (state) => { state.loading = true; }) .addCase(fetchData.fulfilled, (state, action) => { state.data = action.payload; }) .addCase(fetchData.rejected, (state) => { state.error = true; }); }
- Dynamic routing is implemented in the
src/pages/url/
folder using[param]
syntax - Example:
/url/[aid]/Sample.tsx
β/url/123/Sample
- File Naming Rule: To distinguish from features, it is recommended (not required) to use the
Page
suffix for page components
- When using the shadcn library, there may be issues with the
cn
path after download - You may need to manually fix the path in
components.json
- SS components and shadcn components can be used together
- Format all code:
yarn exec prettier . --write
- Auto-formatting settings
- WebStorm:
File | Settings | Languages & Frameworks | JavaScript | Prettier
jetbrains://WebStorm/settings?name=Languages+%26+Frameworks--JavaScript--Prettier
Enable auto-format or format on save
- WebStorm:
File | Settings | Languages & Frameworks | JavaScript | Prettier
- TODO: Apply Prettier automatically on commit (e.g., with husky)
- TailwindCSS is auto-sorted with prettier-plugin-tailwindcss
- Add recommended color application feature
- Change label to input feature
- JS performance improvements
- Apply Prettier automatically on git commit (e.g., husky)
- Improve local reducer action naming (e.g., todo prefix)
- Feel free to ask questions, report bugs, or contribute to this project!
If you need more detailed examples or explanations for any section, please let me know!