{"id":21857350,"url":"https://github.com/stringbuckwheat/aletheia","last_synced_at":"2026-04-11T09:37:31.742Z","repository":{"id":256321329,"uuid":"854007992","full_name":"stringbuckwheat/aletheia","owner":"stringbuckwheat","description":"금 판매/구입 서비스 (인증/자원 서버 분리) ","archived":false,"fork":false,"pushed_at":"2024-10-10T06:07:30.000Z","size":156,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T19:29:07.079Z","etag":null,"topics":["grpc","jpa-hibernate","mariadb","querydsl","redis","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stringbuckwheat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-08T06:32:16.000Z","updated_at":"2024-10-10T06:07:33.000Z","dependencies_parsed_at":"2025-01-26T14:21:31.651Z","dependency_job_id":null,"html_url":"https://github.com/stringbuckwheat/aletheia","commit_stats":null,"previous_names":["stringbuckwheat/aletheia"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stringbuckwheat/aletheia","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stringbuckwheat%2Faletheia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stringbuckwheat%2Faletheia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stringbuckwheat%2Faletheia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stringbuckwheat%2Faletheia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stringbuckwheat","download_url":"https://codeload.github.com/stringbuckwheat/aletheia/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stringbuckwheat%2Faletheia/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31676209,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T08:18:19.405Z","status":"ssl_error","status_checked_at":"2026-04-11T08:17:08.892Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grpc","jpa-hibernate","mariadb","querydsl","redis","spring-boot"],"created_at":"2024-11-28T02:27:40.770Z","updated_at":"2026-04-11T09:37:31.724Z","avatar_url":"https://github.com/stringbuckwheat.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Aletheia 👑🛍️🏅\n\n목차\n\n1. Aletheia?\n    * [API 문서](https://documenter.getpostman.com/view/31325959/2sAXqmA4tP)\n    * 기술 스택\n    * ERD\n2. 주요 기능\n    * gRPC 기반 MSA 아키텍처\n    * 금 구매/판매\n    * QueryDsl 동적 쿼리를 사용한 거래 통계\n3. 트러블 슈팅\n    * Shell Script\n        * 통합 테스트 효율성을 위해 Shell Script 작성\n    * 로깅 AOP\n4. 구현 상세\n\n# Aletheia 👑🛍️🏅?\n\n금을 판매/구매하는 서비스 Aletheia의 백엔드 서버  \n인증 서버, 자원 서버를 분리하여 `gRPC`를 통해 통신합니다.\n\nPostman API 문서는 [이곳](https://documenter.getpostman.com/view/31325959/2sAXqmA4tP)에서 확인하실 수 있습니다.\n\n## 기술 스택\n\n![SpringBoot](https://img.shields.io/badge/Spring_boot(3.3)-%236DB33F?style=for-the-badge\u0026logo=springboot\u0026logoColor=white)\n![gRPC](https://img.shields.io/badge/gRPC-244C5A?style=for-the-badge\u0026logo=grpc\u0026logoColor=white)\n![Hibernate](https://img.shields.io/badge/JPA/Hibernate-59666C?style=for-the-badge\u0026logo=Hibernate\u0026logoColor=white)\n![QueryDsl](https://img.shields.io/badge/QueryDsl-000000?style=for-the-badge\u0026logo=QueryDsl\u0026logoColor=white)\n![MariaDB](https://img.shields.io/badge/MariaDB(10.3)-003545?style=for-the-badge\u0026logo=mariadb\u0026logoColor=white)\n![Redis](https://img.shields.io/badge/Redis-FF4438?style=for-the-badge\u0026logo=redis\u0026logoColor=white)\n\n## ERD\n\n![aletheia_erd](https://github.com/user-attachments/assets/bdff6236-1d3d-4711-8167-07859f92b87b)\n(간편한 설명을 위한 ERD이며, 실제 `user` 테이블은 Auth 서버와 통신하는 DB에, `purchase`, `sales` 테이블은 Resource 서버와 통신하는 DB에 위치합니다)\n\n# 주요 기능🛠️\n\n## 1) gRPC 기반 MSA 아키텍처\n\n![aletheia_flow](https://github.com/user-attachments/assets/9baaafc4-b63e-4878-bcff-3587c5d83588)\n\n### - 서버 아키텍처 분리\n\n* **Auth 서버**: 사용자 **인증/인가**를 전담하는 독립적인 서버\n* **Resource** 서버: **리소스 처리와 데이터 제공** 기능 담당\n    * 인증이 필요한 요청이 도착하면 `gRPC`를 사용하여 Auth 서버로 인증 요청 수행\n\n## 2) 금 구매/판매\n\n![스크린샷 2024-10-10 14 08 30](https://github.com/user-attachments/assets/7ecdc673-b97e-4808-b3e5-d894c50edb26)\n\n* 금 구매/판매 시 사용자 ID와 함께 **Human Readable한 주문 번호**를 생성하여 관리를 용이하게 구현\n* Spring Validation과 enum, `Custom Annotation`을 사용해 입력 데이터 유효성 검증\n\n```java\n@Schema(description = \"수량\", example = \"3.75\")\n@NotNull(message = \"수량은 필수입니다.\")\n@DecimalMin(value = \"0.01\", message = \"수량은 최소 0.01g 이상이어야 합니다.\")\n@Digits(integer = 10, fraction = 2, message = \"수량은 최대 소수점 둘째 자리까지 입력 가능합니다.\")\nprivate BigDecimal quantity;\n\n@IsValidSalesState\nprivate String salesStatus;\n```\n\n## 3) 통계\n\n* 금 판매/구매 데이터를 필터링 하여 각 기간 동안의 거래 통계 제공\n    * `시작일`, `종료일`, `구매/판매/전체`, 페이징 등\n* QueryDsl 동적 쿼리를 사용하여 유연한 데이터 조회 구현\n\n![스크린샷 2024-10-10 14 24 42](https://github.com/user-attachments/assets/9fadb9f1-0708-42d1-91bd-ccb1c9063f6b)\n\n# 💡 트러블 슈팅\n\n## 1) Shell Script를 통한 서버 빌드 자동화\n\n* 배경, 문제\n    * 인증 서버, 자원 서버는 독립적으로 실행되며 gRPC와 RESTful API를 통해 상호작용\n    * 개발 과정에서 **빈번히 gRPC 프로토콜 파일 생성, 프로젝트 빌드, 테스트**해야 하는데 이를 수동으로 관리하기는 **비효율적**\n* 해결: `자동화 스크립트` 작성\n    * `quick_start.sh`와 `stop_servers.sh` 두 개의 Shell Script를 통해 서버 관리, 빌드 자동화\n    * `quick_start.sh` 상세\n        * (기존) 빌드 디렉토리 삭제\n        * gRPC 프로토콜 파일 생성\n        * 인증 서버, 자원 서버 빌드\n        * 서버 실행\n        * 실행 로그는 각각 auth.log, resource.log 파일에 기록\n\n## 2) AOP를 사용하여 예외 로깅 자동화\n\n* 배경\n    * 기존 코드: `log.info()` 등의 메서드를 사용해 수동으로 로그 기록\n        * 개발자가 직접 로깅을 하지 않으면 예외가 발생해도 로그가 남지 않는 문제\n        * 메서드명이나 인수 정보가 일관되지 않아 예외 원인 추적 어려움\n        * 각 서비스 클래스마다 별도의 try-catch 블록을 추가하여 예외를 처리하고 로그를 남기는 방식은 코드 중복\n* 해결: `AOP`를 도입하여 예외 로깅 자동화\n    * `@AfterThrowing` 어노테이션을 사용하여 서비스 메서드에서 발생하는 모든 예외를 캐칭\n    * 예외 발생 시 메서드명, 클래스명, 전달된 인수, 예외 메시지를 자동으로 로깅\n\n## 🏃‍♂️‍➡️ Quick Start\n\n### 1. yml 파일 등록\n\n`application.yml` 파일을 `{auth 혹은 resource}/src/main/resource` 디렉토리에 적절히 생성해주세요\n\n### 3. Shell Script를 통한 실행\n\n```shell\ncd aletheia\n\nchmod +x quick_start.sh\n./quick_start.sh\n```\n\n### 4. 서버 종료\n\n```shell\nchmod +x stop_servers.sh\n./stop_servers.sh\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstringbuckwheat%2Faletheia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstringbuckwheat%2Faletheia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstringbuckwheat%2Faletheia/lists"}