[5팀 오새듬] Chapter 3-3 기능 중심 아키텍처와 프로젝트 폴더 구조 #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://toeam.github.io/front_7th_chapter3-3/
과제 체크포인트
기본과제
목표 : 전역상태관리를 이용한 적절한 분리와 계층에 대한 이해를 통한 FSD 폴더 구조 적용하기
체크포인트
심화과제
목표: 서버상태관리 도구인 TanstackQuery를 이용하여 비동기코드를 선언적인 함수형 프로그래밍으로 작성하기
체크포인트
최종과제
과제 셀프회고
src/
├── shared/
│ ├── api/
│ │ └── client.ts # 공통 API 클라이언트
│ ├── config/
│ │ └── constants.ts # 공통 상수
│ ├── lib/
│ │ ├── queryClient.ts # QueryClient 설정 (TanStack Query 준비)
│ │ ├── queryKeys.ts # 쿼리 키 팩토리 (TanStack Query 준비)
│ │ ├── dateUtils.ts # 날짜 포맷팅 유틸리티
│ │ ├── highlightText.tsx # 텍스트 하이라이트 유틸리티
│ │ └── urlUtils.ts # URL 파라미터 관리 유틸리티
│ └── ui/ # 공통 UI 컴포넌트 (Button, Card, Dialog, Input, Select, Table, Textarea, Avatar, Badge, Text 등)
│
├── entities/
│ ├── post/
│ │ ├── api/
│ │ │ └── postApi.ts # Post API 함수
│ │ ├── model/
│ │ │ ├── store.ts # PostStore (Zustand) - 서버 상태 관리
│ │ │ └── types.ts # Post, PostAuthor 타입
│ │ └── ui/ # PostAuthor, PostRow, PostTag
│ ├── comment/
│ │ ├── api/
│ │ │ └── commentApi.ts # Comment API 함수
│ │ ├── model/
│ │ │ ├── store.ts # CommentStore (Zustand) - 서버 상태 관리
│ │ │ └── types.ts # Comment 타입
│ │ └── ui/ # CommentItem
│ └── user/
│ ├── api/
│ │ └── userApi.ts # User API 함수
│ ├── model/
│ │ ├── store.ts # UserStore (Zustand) - 서버 상태 관리
│ │ └── types.ts # User 타입
│ └── ui/
│
├── features/
│ ├── post/
│ │ ├── model/
│ │ │ ├── usePostList.ts # 게시물 목록 조회 (Store 사용)
│ │ │ ├── usePostSearch.ts # 게시물 검색 (Store 사용)
│ │ │ ├── usePostSort.ts # 게시물 정렬 (로컬 상태 + 정렬 로직)
│ │ │ ├── useTagFilter.ts # 태그 필터링 (Store 사용)
│ │ │ ├── usePostCreate.ts # 게시물 생성 (Store 사용)
│ │ │ ├── usePostUpdate.ts # 게시물 수정 (Store 사용)
│ │ │ ├── usePostDelete.ts # 게시물 삭제 (Store 사용)
│ │ │ ├── usePostFilters.ts # URL 파라미터 및 필터 상태 관리
│ │ │ ├── usePostPagination.ts # 페이지네이션 로직
│ │ │ ├── usePostCreateModal.ts # 게시물 생성 모달 상태 관리
│ │ │ ├── usePostEditModal.ts # 게시물 수정 모달 상태 관리
│ │ │ └── usePostDetailModal.ts # 게시물 상세 모달 상태 관리
│ │ └── ui/ # PostSearchInput, PostSortControls, PostTagFilter, PostPagination
│ ├── comment/
│ │ └── model/
│ │ ├── useCommentList.ts # 댓글 목록 조회 (Store 사용)
│ │ ├── useCommentCreate.ts # 댓글 생성 (Store 사용)
│ │ ├── useCommentUpdate.ts # 댓글 수정 (Store 사용)
│ │ ├── useCommentDelete.ts # 댓글 삭제 (Store 사용)
│ │ └── useCommentLike.ts # 댓글 좋아요 (Store 사용)
│ └── user/
│ └── model/
│ ├── useUserDetail.ts # 사용자 상세 조회 (Store 사용)
│ └── useUserModal.ts # 사용자 모달 상태 관리
│
├── widgets/
│ ├── post-list/
│ │ └── ui/
│ │ └── PostList.tsx # 게시물 목록 위젯
│ ├── post-detail/
│ │ └── ui/
│ │ └── PostDetail.tsx # 게시물 상세 위젯
│ ├── post-create-modal/
│ │ └── ui/
│ │ └── PostCreateModal.tsx # 게시물 생성 모달 위젯
│ ├── post-edit-modal/
│ │ └── ui/
│ │ └── PostEditModal.tsx # 게시물 수정 모달 위젯
│ ├── comment-list/
│ │ └── ui/
│ │ └── CommentList.tsx # 댓글 목록 위젯
│ └── user-modal/
│ └── ui/
│ └── UserModal.tsx # 사용자 정보 모달 위젯
│
└── pages/
└── PostsManagerPage.tsx # 게시물 관리 페이지
// 이건 Molecule? Organism?
const ProductCard = () => (
atomic design은 ui를 기준으로 잡다보니 경계가 모호하고 도메인 간 의존성을 찾기가 힘들다.
entities
이번 과제를 통해 이전에 비해 새롭게 알게 된 점이 있다면 적어주세요.
본인이 과제를 하면서 가장 애쓰려고 노력했던 부분은 무엇인가요?
아직은 막연하다거나 더 고민이 필요한 부분을 적어주세요.
이번에 배운 내용 중을 통해 앞으로 개발에 어떻게 적용해보고 싶은지 적어주세요.
챕터 셀프회고
클린코드: 읽기 좋고 유지보수하기 좋은 코드 만들기
결합도 낮추기: 디자인 패턴, 순수함수, 컴포넌트 분리, 전역상태 관리
응집도 높이기: 서버상태관리, 폴더 구조
리뷰 받고 싶은 내용이나 궁금한 것에 대한 질문
feature에 구성을 엔티티 파일 명을 작성하고 그 하위에 model,ui로 분류를 했는데 model에서 UsePostList이렇게 기능을 명시해주는 파일만 생성했는데 하위에 post-list폴더를 만들고 그안에 usePostList를 만드는 방법과 고민을 했는데 현재 프로젝트는 작은 프로젝트니 굳이 하위 폴더를 생성안해도 될 것 같아서 이런 방식으로 했는데 막상 만들고 나니 폴더를 만들걸 그랫나? 하는 생각이 들었는데 다시 생각해보면 기능이 커져도 폴더가 늘어나는 것 뿐인데 기능을 명시적으로 파일명을 작성하는 거랑 크게 차이가 있을까? 하는 생각이 듭니다. 머리로는 폴더를 생성하는게 맞는 것 같은데 굳이 라는 생각이 듭니다