# Team-03-LinkBook-BE

## ๐Ÿคฒ๐Ÿป ํ”„๋กœ์ ํŠธ ์†Œ๊ฐœ

๋ถ๋งˆํฌ ๊ณต์œ  ํ”„๋กœ์ ํŠธ


> ๊ตฌํ˜„ ๊ธฐ๋Šฅ

- JWT์„ ์ด์šฉํ•œ ๋กœ์ปฌ ๋กœ๊ทธ์ธ

<br>

## ๐Ÿ‘ฌ ํŒ€ ์†Œ๊ฐœ

<table>
  <tr>
    <td>
        <a href="<https://github.com/Nnagman>">
            <img src="<https://avatars.githubusercontent.com/u/16336810?v=4>" width="100px" />
        </a>
    </td>
    <td>
        <a href="<https://github.com/suy2on>">
            <img src="<https://avatars.githubusercontent.com/u/62363580?v=4>" width="100px" />
        </a>
    </td>
    <td>
        <a href="<https://github.com/pppp0722>">
            <img src="<https://avatars.githubusercontent.com/u/60428537?v=4>" width="100px" />
        </a>
    </td>
    <td>
        <a href="<https://github.com/ChoiYeonho0903>">
            <img src="<https://avatars.githubusercontent.com/u/76257508?v=4>" width="100px" />
        </a>
    </td>
    <td>
        <a href="<https://github.com/su-pernova>">
            <img src="<https://avatars.githubusercontent.com/u/48689213?v=4>" width="100px" />
        </a>
    </td>
  </tr>
  <tr>
    <td><b>์ด์ฐฝํ˜ธ</b></td>
    <td><b>์ด์ˆ˜์—ฐ</b></td>
    <td><b>์ด์ผํ™˜</b></td>
    <td><b>์ตœ์—ฐํ˜ธ</b></td>
    <td><b>๊น€์ˆ˜๋ฏธ</b></td>
  </tr>
  <tr>
    <td><b>Product Owner</b></td>
    <td><b>Developer</b></td>
    <td><b>Developer</b></td>
    <td><b>Developer</b></td>
    <td><b>Developer</b></td>
  </tr>
</table>

<br>

## ๐Ÿ›  ๊ธฐ์ˆ  ์Šคํƒ

### BackEnd

<table>
  <tr>
    <td>
         <img src="<https://user-images.githubusercontent.com/76257508/184301901-63ae039a-87d5-4313-a1ce-a4c90badc242.png>" width="100px"/>
    </td>
    <td>
        <img src="<https://images.velog.io/images/leeseojune53/post/b6527e64-30c9-40d4-a955-ddbc647edec1/Gradle_logo.png>" width="100px" />
    </td>
    <td>
        <img src="<https://user-images.githubusercontent.com/76257508/184303436-1f388f6f-897f-4305-9435-61edd9b67fea.png>" width="100px" />
    </td>
    <td>
        <img src="<https://user-images.githubusercontent.com/76257508/184302496-44109fa5-b95b-4044-8562-27608d4ea8d5.png>" width="100px" />
    </td>
    <td>  
        <img src="<https://user-images.githubusercontent.com/76257508/184309540-f9438159-5936-4c14-af39-84913c9d751f.png>" width="100px" />
    </td>
    <td>  
        <img src="<https://user-images.githubusercontent.com/76257508/184309618-4677c412-cd2e-470a-931e-28ba10a3f63b.png>" width="100px" />
    </td>
    <td>
        <img src="<https://user-images.githubusercontent.com/76257508/184302416-34ad1a13-b691-4617-adff-8dcf917354e0.png>" width="100px" />
    </td>
  </tr>
  <tr>
    <td><b>Java 11</b></td>
    <td><b>Gradle</b></td>
    <td><b>Spring</b></td>
    <td><b>Spring Boot</b></td>
    <td><b>Spring Data JPA</b></td>
    <td><b>Spring Security</b></td>
    <td><b>MySQL</b></td>
  </tr>
</table>

### TestingTool

<table>
  <tr>
    <td>
         <img src="<https://user-images.githubusercontent.com/76257508/184303192-74eac7ec-972e-45bf-81bb-0caf7de6e3d7.png>" width="100px"/>
    </td>
    <td>
        <img src="<https://user-images.githubusercontent.com/76257508/184303203-e1589d74-9048-428c-a913-1058f268a69a.png>" width="100px" />
    </td>
  </tr>
  <tr>
    <td><b>JUnit</b></td>
    <td><b>Mockito</b></td>
  </tr>
</table>

### DevOps

<table>
  <tr>
    <td>
        <img src="<https://user-images.githubusercontent.com/76257508/184303964-343dfe04-11ba-4331-b4c1-02c117a1dd78.png>" width="100px" />
    </td>
    <td>
        <img src="<https://user-images.githubusercontent.com/76257508/184303992-5e812469-9e71-4538-9ab7-e62cba87020f.png>" width="100px" />
    </td>
    <td>
        <img src="<https://user-images.githubusercontent.com/76257508/184307814-684c586a-1aef-49ce-95aa-4db34096c803.png>" width="100px" />
    </td>
  </tr>
  <tr>
    <td><b>Docker</b></td>
    <td><b>GithubAction</b></td>
    <td><b>EC2</b></td>
  </tr>
</table>

### ๋ฌธ์„œ/ํ˜‘์—…
<table>
  <tr>
    <td>
        <img src="<https://user-images.githubusercontent.com/103566826/177922764-354c44a9-05e9-4d5c-a10c-0da6676a80a0.png>" width="100px" />
    </td>
    <td>
        <img src="<https://user-images.githubusercontent.com/103566826/177922777-83956929-35f0-4746-a51b-98c116da2651.png>" width="100px" />
    </td>
    <td>
        <img src="<https://user-images.githubusercontent.com/103566826/177922791-263bc0f1-bebc-4eee-bdb5-9954af5bbaf9.png>" width="100px" />
    </td>
    <td>
        <img src="<https://user-images.githubusercontent.com/103566826/177922794-5a47df94-fc97-4beb-a6f4-16b24e315757.png>" width="100px" />
    </td>
    <td>
        <img src="<https://user-images.githubusercontent.com/103566826/177922809-866718e0-fb19-4840-9caa-111da31795d1.png>" width="100px" />
    </td>
    <td>
        <img src="<https://user-images.githubusercontent.com/103566826/177922816-6888632c-b218-4635-98d5-189addb835ca.png>" width="100px" />
    </td>
  </tr>
  <tr>
    <td><b>Notion</b></td>
    <td><b>Slack</b></td>
    <td><b>Git</b></td>
    <td><b>GitHub</b></td>
    <td><b>RestDocs</b></td>
    <td><b>AsciiDocs</b></td>
  </tr>
</table>

<br>

## โ˜€๏ธ ARCHITECTURE
<img width="1049" alt="infra_structure" src="<https://user-images.githubusercontent.com/76257508/184298185-698ea509-3ba0-4144-9d53-070faadc5cd0.png>">

## ๐Ÿ–ผ ERD
![erd](<https://user-images.githubusercontent.com/76257508/184299245-d5d81642-1526-456d-a5c5-59034bf02f92.png>)

<br>

## ๐Ÿ’ฌ Branch ์ „๋žต, ํ”„๋กœ์ ํŠธ ํ˜•์ƒ ๊ด€๋ฆฌ, CI/CD ํŒŒ์ดํ”„๋ผ์ธ

### Branch ์ „๋žต
- GitHub flow ์‚ฌ์šฉ
    - ํŠธ๋ ํฌ ๊ธฐ๋ฐ˜ ๊ฐœ๋ฐœ(Trunk-Based Development)
- `์ด์Šˆ ๋ฐœํ–‰` โ†’ `๋ธŒ๋žœ์น˜ ์ƒ์„ฑ` โ†’ `commit` โ†’ `PR ๋ฐœํ–‰` โ†’ `main ๋ธŒ๋žœ์น˜ merge` โ†’ `์ž๋™ ๋ฐฐํฌ`

### ํ”„๋กœ์ ํŠธ ํ˜•์ƒ ๊ด€๋ฆฌ
- Github Issue + Milestone + Project ์‚ฌ์šฉ
<img width="1146" alt="project_configuration" src="<https://user-images.githubusercontent.com/76257508/184299178-86279a70-695a-48e7-9caf-2ac0a6292aea.png>">

### CI/CD ํŒŒ์ดํ”„๋ผ์ธ
- Github Action ์‚ฌ์šฉ
- **PR ์ด ๋ฐœํ–‰๋˜๋Š” ๊ฒฝ์šฐ**
    - **AWS RDS DB** ์—ฐ๊ฒฐ ๊ธฐ๋ฐ˜
    - **gradle build** ์— ์„ฑ๊ณตํ•˜๋Š” ๊ฒฝ์šฐ **Github Action** ํ†ต๊ณผ
- **PR ์ด main ๋ธŒ๋žœ์น˜์— merge ๋˜๋Š” ๊ฒฝ์šฐ**
    - **AWS RDS DB** ์—ฐ๊ฒฐ ๊ธฐ๋ฐ˜
    - **EC2** ์„œ๋ฒ„์— **main** ๋ธŒ๋žœ์น˜ ์ฝ”๋“œ ์ž๋™ ๋ฐฐํฌ
    - **gradle build** ๋ฐ **Docker image build** + **compose up(deploy ๊ณผ์ •)** ์„ฑ๊ณตํ•˜๋Š” ๊ฒฝ์šฐ
    **Github Action** ํ†ต๊ณผ

## ์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€, PR ๊ทœ์น™

### ์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€
> Type
- ๊นƒ๋ชจ์ง€ ์‚ฌ์šฉ
- ์ธํ…”๋ฆฌ์ œ์ด์—์„œ ๋‹ค์Œ ํ”Œ๋Ÿฌ๊ทธ์ธ์œผ๋กœ ์ปค๋ฐ‹์— ์‰ฝ๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Œ
> ![<https://velog.velcdn.com/images/pppp0722/post/d9e5d256-3a25-4878-b071-148ed217f1ae/image.png>](<https://velog.velcdn.com/images/pppp0722/post/d9e5d256-3a25-4878-b071-148ed217f1ae/image.png>)
- ์•„์ด์ฝ˜์€ [์—ฌ๊ธฐ](<https://gitmoji.dev>)๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ์ž‘์„ฑ
- ๊นƒ๋ชจ์ง€์™€ ์ œ๋ชฉ ์‚ฌ์ด์— ๋„์–ด์“ฐ๊ธฐ ํ•˜์ง€ ์•Š์Œ

[ ์˜ˆ์‹œ ] โ€ข โœจย ๋กœ์ปฌ ๋กœ๊ทธ์ธ ๊ธฐ๋Šฅ ์ถ”๊ฐ€ โ€ข (์ƒ๋žต ๊ฐ€๋Šฅ) ๋ถ€์—ฐ ์„ค๋ช… โ€ข (์ƒ๋žต ๊ฐ€๋Šฅ) ํ•ด๊ฒฐ: #123 / ์ฐธ๊ณ : #456, #789


> Subject

โ€ข ๊ธธ์–ด์ง€์ง€ ์•Š๋„๋ก ์ž‘์„ฑ โ€ข "~ ์ถ”๊ฐ€", "~ ์ˆ˜์ •", "~ ๋ฆฌํŒฉํ† ๋ง", ...


> Body

โ€ข ๋ถ€์—ฐ์„ค๋ช…์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ ์„ ํƒํ•˜์—ฌ ์ž‘์„ฑ


> Footer

โ€ข ๋ถ€๊ฐ€์ ์œผ๋กœ issue tracker id๋ฅผ ์ž‘์„ฑํ•  ๋•Œ ์ž‘์„ฑ


### PR ๊ทœ์น™

- `feat/์ž‘์—…`์—์„œ ๊ธฐ๋Šฅ ๊ฐœ๋ฐœ ํ›„ `develop`์— PR
- PR ์ œ๋ชฉ์€ ๋ธŒ๋žœ์น˜์—์„œ ์ž‘์—…ํ•œ ๋‹จ์œ„ โ†’ Jira ์ฐธ๊ณ 
- ๋ณธ๋ฌธ์—๋Š” ๋ฆฌ๋ทฐ์–ด๋“ค์ด ์•Œ์•„์•ผ ๋  ์‚ฌํ•ญ ๋ช…์‹œ
- PR ์ž‘์„ฑ์ž๋Š” PR ํ›„ ํฌ์ธํŠธ ๋˜๋Š” ๋ถ€๋ถ„์„ ์…€ํ”„ ์ฝ”๋“œ ๋ฆฌ๋ทฐ๋กœ ๋ช…์‹œ
- ๋‚˜๋จธ์ง€ ํŒ€์›๋“ค์€ PR ๋ฐœ์ƒ ์‹œ ์ฝ”๋“œ ๋ฆฌ๋ทฐ
- ์ฝ”๋“œ ๋ฆฌ๋ทฐ ๋ฐ˜์˜๋œ ๋ถ€๋ถ„์€ `Resolve conversation`
- ๋ชจ๋“  ๋ฆฌ๋ทฐ ๋ฐ˜์˜ ์™„๋ฃŒ ํ›„ `Merge pull request` ํ•˜๊ฑฐ๋‚˜ ์ถ”๊ฐ€์ ์ธ ์ฝ”๋“œ ๋ฆฌ๋ทฐ๊ฐ€ ํ•„์š”ํ•˜๋ฉด `Re-request review`

<br>

## โœ… ์‹คํ–‰๋ฐฉ๋ฒ•

### application-database.yaml
``` YAML
spring:
  jpa:
    properties:
      hibernate:
        default_batch_fetch_size: 1000
        format_sql: true
    show-sql: true
    generate-ddl: true
    hibernate:
      ddl-auto: update
  datasource:
    url: jdbc:mysql://linkbook-1.czvbgr7hie3i.ap-northeast-2.rds.amazonaws.com:3306/linkbook
    username:
    password: 
    hikari:
      maximum-pool-size: 10

application-jwt.yaml

jwt:
  access-header : Access-Token
  refresh-header : Refresh-Token
  issuer: prgrms
  client-secret:
  access-token-expiry-seconds: 3600
  refresh-token-expiry-seconds: 1209600

application-mail.yaml

spring:
  mail:
    host: smtp.gmail.com
    port: 587
    protocol: smtp
    default-encoding: UTF-8
    username: [email protected]
    password:
    properties:
      mail:
        smtp:
          auth: true
          starttls:
            enable: true
            required: true

๋นŒ๋“œํ•˜๊ณ  ์‹คํ–‰ํ•˜๊ธฐ

# ๋นŒ๋“œํ•˜๊ธฐ
./gradlew bootJar
# ๋นŒ๋“œ ํ›„ ์‹คํ–‰
./gradlew bootRun
# ๋˜๋Š” 
java -jar {jarํŒŒ์ผ}

- ์™„์„ฑ๋„ ๋†’์ด๊ธฐ : ๊ธฐ์ˆ ์  ๋„์ „, ์•ˆ์“ฐ๋Š” ์ฃผ์„ ๊น”๋”ํ•˜๊ฒŒ
- ๊ฐœ์„ ํ•  ์‚ฌํ•ญ ์ฐพ์•„์„œ ๋ฆฌํŒฉํ† ๋ง : ์ฑ…์ž„๋ถ„๋ฆฌ, ํ…Œ์ŠคํŠธ, ์•„ํ‚คํ…์ฒ˜.. , change log์— ํƒœ๊ทธ์™€ ๋‚จ๊ฒจ๋‘๊ธฐ, github release๊ธฐ๋Šฅ
- README ์ž˜ ์ž‘์„ฑํ•˜๊ธฐ : ์•„ํ‚คํ…์ณ, CICD, branch์ „๋žต, test, ์‹คํ–‰๋ฐฉ๋ฒ•
- ๋ฆฐํ„ฐ/ํฌ๋งคํ„ฐ๋ฅผ ์ด์šฉํ•œ ์ฝ”๋“œ ์ปจ๋ฒค์…˜ ์œ ์ง€ : pre-commit, pre-push
- ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑํ•˜๊ธฐ
- ๊ฐœ๋ฐœ/์šด์˜ ํ™˜๊ฒฝ๊ด€๋ฆฌ : DB, API, ํ™˜๊ฒฝ๋ณ€์ˆ˜โ€ฆ
- ์ž๋™ํ™” : CI, CD ๋„๊ตฌ๋“ค ์„ ํƒ
- ๋ฆด๋ฆฌ์ฆˆ : ๋ฒ„์ €๋‹(์‹œ๋ฉ˜ํŒ…), ํƒœ๊ทธ, ๋„์ปค์™€ ํ•จ๊ป˜์“ธ๋•Œ ๊ณ ๋ฏผ