Skip to content

Latest commit

ย 

History

History
179 lines (132 loc) ยท 6.84 KB

README.md

File metadata and controls

179 lines (132 loc) ยท 6.84 KB

๐Ÿ“Œ Aladin Study Cafe

์Šคํ„ฐ๋””์นดํŽ˜ ์ด์šฉ, ๊ด€๋ฆฌ์•ฑ

๐Ÿš€ v2.0 ๋ฆฌํŒฉํ„ฐ๋ง

ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋ฉด์„œ ์ฝ”๋“œ ์ •๋ฆฌ์— ์–ด๋ ค์›€์„ ๊ฒฉ์–ด ์•„ํ‚คํ…์ฒ˜ ๊ด€๋ จ ํ•™์Šต ํ›„ ๋ฐฐ์šด ์ ์„ ์ ์šฉํ•˜์—ฌ ๋ฆฌํŒฉํ„ฐ๋ง ์ค‘์ž…๋‹ˆ๋‹ค.

v1.0 ๊ธฐ์กด ํ”„๋กœ์ ํŠธ ๋งํฌ

https://github.com/ch-yang1273/StudyCafe_SpringBoot/tree/v1.0

๋ฆฌํŒฉํ„ฐ๋ง ๋ฐฉํ–ฅ

  • ๊ฐ ๋ ˆ์ด์–ด์˜ ์—ญํ• ์„ ๊ตฌ๋ถ„ (Controller, Service, Repository, Domain)
  • ํŒจํ‚ค์ง€ ๊ฐ„ ์ˆœํ™˜์ด ๋ฐœ์ƒํ•˜์ง€ ์•Š๋„๋ก ์˜์กด์„ฑ์„ ์ •๋ฆฌ
  • ํ…Œ์ŠคํŠธํ•˜๊ธฐ ์ข‹์€ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๊ณ , ๋‹จ์œ„ ํ…Œ์ŠคํŠธ ์ž‘์„ฑ
  • GitHub Actions๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ CI/CD ์ ์šฉ

๊ธฐ๊ฐ„

  • 2023๋…„ 3์›” 11์ผ ~ 2023๋…„ 5์›” 31์ผ

์ฐธ๊ณ  ์ž๋ฃŒ

  • ๋„๋ฉ”์ธ ์ฃผ๋„ ๊ฐœ๋ฐœ ์‹œ์ž‘ํ•˜๊ธฐ (์ตœ๋ฒ”๊ท )
  • 190620 ์šฐ์•„ํ•œ๊ฐ์ฒด์ง€ํ–ฅ (์กฐ์˜ํ˜ธ)
  • ๋‹จ์œ„ ํ…Œ์ŠคํŠธ (๋ธ”๋ผ๋””๋ฏธ๋ฅด ์ฝ”๋ฆฌ์ฝ”ํ”„)

[์•„ํ‚คํ…์ฒ˜ ๊ด€๋ จ ์ˆ˜์ • ๋‚ด์šฉ]

โœ‚ ํŒจํ‚ค์ง€ ๊ตฌ์กฐ ์ •๋ฆฌ

ํŒจํ‚ค์ง€ ์—ฐ๊ด€ ๊ด€๊ณ„

  • layer ๋‹จ์œ„๋กœ ๊ตฌ๋ถ„ํ–ˆ๋˜ ํŒจํ‚ค์ง€ ๊ตฌ์กฐ๋ฅผ ๋„๋ฉ”์ธ ๋‹จ์œ„๋กœ ๋ณ€๊ฒฝ
  • Entity์˜ ์—ฐ๊ด€ ๊ด€๊ณ„์— ๋งž์ถฐ ํŒจํ‚ค์ง€ ๊ฐ„ ์˜์กด์„ฑ ์ œํ•œ

โœ‚ ํŒจํ‚ค์ง€ ์˜์กด์„ฑ ์ˆœํ™˜ ํ•ด๊ฒฐ

  • Follow ๋„๋ฉ”์ธ ์ถ”๊ฐ€

    User๊ฐ€ ์‚ฌ์šฉ ์ค‘์ธ Cafe ์ •๋ณด๋ฅผ User Entity๊ฐ€ ๊ฐ–๊ณ  ์žˆ๊ณ , Cafe ๋Œ€๋ถ€๋ถ„ ์„œ๋น„์Šค๋Š” User๋ฅผ ์˜์กด

    -> User๊ฐ€ ์‚ฌ์šฉ ์ค‘์ธ Cafe ์ •๋ณด๋ฅผ Follow Entity์— ์ด๊ด€ํ•˜์—ฌ Cafe์— ๋Œ€ํ•œ ์˜์กด์„ฑ์„ ์ œ๊ฑฐ

  • ์ขŒ์„ ์˜ˆ์•ฝ ๊ธฐ๋Šฅ์„ Seat์—์„œ Reservation์œผ๋กœ ์ด๋™

    Reservation์ด ์˜ˆ์•ฝํ•œ Seat ์ •๋ณด๋ฅผ ํฌํ•จํ•˜๊ณ , Seat์˜ ์„œ๋น„์Šค๊ฐ€ Reservation์„ ์ƒ์„ฑํ•˜๋ฉด์„œ ์˜์กด์„ฑ์ด ์ˆœํ™˜

    -> Reservation ์„œ๋น„์Šค์—์„œ ์˜ˆ์•ฝ์„ ์ง„ํ–‰ํ•˜๊ณ , Seat์˜ ์ƒํƒœ๋ฅผ ์—…๋ฐ์ดํŠธํ•˜๋ฉด์„œ ๋‹จ๋ฐฉํ–ฅ ์˜์กด์„ฑ์œผ๋กœ ๋ณ€๊ฒฝ

โœ‚ CQRS ํŒจํ„ด ์ ์šฉ

  • ๋ช…๋ น์€ void๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ณ , ์กฐํšŒ๋Š” DTO๋ฅผ ๋ฐ˜ํ™˜
  • Read์™€ CUD๋ฅผ ๋ถ„๋ฆฌํ•˜์ง€๋Š” ์•Š์•˜์Œ

[ํ…Œ์ŠคํŠธ ๊ด€๋ จ ์ˆ˜์ • ๋‚ด์šฉ]

โœ‚ ํ…Œ์ŠคํŠธํ•˜๊ธฐ ์ข‹์€ ์ฝ”๋“œ ์ž‘์„ฑ

โœ‚ ์‹œ๊ฐ„ ๋ฉ”์„œ๋“œ ํ…Œ์ŠคํŠธ (์ƒ์„ฑ์ž, ์ •์  ๋ฉ”์„œ๋“œ)

// ๊ธฐ์กด ์ฝ”๋“œ (v1.0 JwtTokenProvider.java) 
public String createAccessToken(String subject) {
    Date now = new Date();
    Date expireDate = new Date(now.getTime() + expireTime);
    ...
}
  • ์ฝ”๋“œ์˜ new Date()์™€ ๊ฐ™์€ ์‹œ๊ฐ„ ๋ฉ”์„œ๋“œ๋Š” ํ…Œ์ŠคํŠธ์—์„œ ์ œ์–ด๊ฐ€ ์–ด๋ ค์›€
  • ์ƒ์„ฑ์ž์™€ Static ๋ฉ”์„œ๋“œ๋Š” Mocking์—๋„ ์ถ”๊ฐ€์ ์ธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ(mockito-inline, PowerMokito)๊ฐ€ ํ•„์š”
// ์ˆ˜์ • ์ฝ”๋“œ (v2.0 JwtTokenService.java)
public String createAccessToken(TokenPayload payload, Date now) {
        Date expireDate = new Date(now.getTime() + expireTime);
        ...
}
  • ์‹œ๊ฐ„ ๋ฉ”์„œ๋“œ ์˜์กด์„ฑ์„ ์ƒ์œ„ ๋ ˆ์ด์–ด๋กœ ๋นผ๋‚ด์–ด, Mocking ์—†์ด ๋‹จ์œ„ ํ…Œ์ŠคํŠธ ๊ฐ€๋Šฅ
  • ์‹œ๊ฐ„ ๋ฉ”์„œ๋“œ๋Š” CurrentTimeProvider ์ธํ„ฐํŽ˜์ด์Šค๋กœ ์ถ”์ƒํ™”ํ•˜์—ฌ ์‚ฌ์šฉ
  • ํ†ตํ•ฉ ํ…Œ์ŠคํŠธ์—์„œ๋Š” mockito-inline ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์—†์ด CurrentTimeProvider๋ฅผ Mocking

[Github Actions๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ CI/CD ์ ์šฉ]

Github Actions๋ฅผ ์ด์šฉํ•˜์—ฌ CI/CD๋ฅผ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

  • Master Branch ์™ธ์˜ Branch์— Push ์‹œ, Github Actions๋ฅผ ํ†ตํ•ด ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰
  • Master Branch์— Push ์‹œ, ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๊ณ , AWS CodeDeploy๋ฅผ ํ†ตํ•ด ๋ฐฐํฌ

๐Ÿ”จ CI (All branch)

flowchart LR
    A[Push] --> B[Container Init] --> C[๋นŒ๋“œ ํ™˜๊ฒฝ ๊ตฌ์„ฑ] --> D[๋นŒ๋“œ ํ™˜๊ฒฝ Caching] --> E[๋‹จ์œ„/ํ†ตํ•ฉ ํ…Œ์ŠคํŠธ]
Loading
  • MariaDB, Redis Container๋ฅผ Init ํ•˜์—ฌ ๋‹จ์œ„/ํ†ตํ•ฉ ํ…Œ์ŠคํŠธ ์ง„ํ–‰
  • ๋นŒ๋“œ ํ™˜๊ฒฝ Caching๋ฅผ ํ†ตํ•ด ๋นŒ๋“œ ์†๋„๋ฅผ ๋†’์ž„
  • ci.yml

๐Ÿ”จ CI/CD (master branch)

flowchart LR
    A[Push] --> B([CI: Test & Build]) --> C[๋นŒ๋“œ ํŒŒ์ผ ์••์ถ•] --> D[AWS ์ธ์ฆ ์ •๋ณด ์„ค์ •] --> E[S3 ์—…๋กœ๋“œ] --> F[S3์—์„œ EC2๋กœ ๋ฐฐํฌ]
Loading
  • Master Branch์—์„œ๋Š” CI์— ์ถ”๊ฐ€๋กœ ๋ฐฐํฌ(CD)๊นŒ์ง€ ์ง„ํ–‰
  • ๋นŒ๋“œ ํŒŒ์ผ์„ S3์— ์—…๋กœ๋“œํ•˜๊ณ , CodeDeploy๋ฅผ ํ†ตํ•ด ๋ฐฐํฌ
  • ๋ฐฐํฌ ํ›„ application.properties๋ฅผ Production ์šฉ์œผ๋กœ ๊ต์ฒดํ•˜๊ณ  ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์žฌ์‹œ์ž‘
  • cicd.yml
  • application-start.sh

๋‚จ์€ ์ž‘์—…

  • ๋‹จ์œ„ ํ…Œ์ŠคํŠธ ์ถ”๊ฐ€
  • Ticket ๋„๋ฉ”์ธ ์ฝ”๋“œ ์ •๋ฆฌ
  • Orders, Product ๋„๋ฉ”์ธ ์ฝ”๋“œ ์ •๋ฆฌ
  • ๊ฐ ๋„๋ฉ”์ธ์—์„œ VO ์„ธ๋ถ„ํ™”
  • Repository Entity์˜ User์™€ Cafe์— ๋Œ€ํ•œ ์˜์กด์„ฑ ์ œ๊ฑฐ (์—ฐ๊ด€ ๊ด€๊ณ„๊ฐ€ ๋งŽ์Œ)
  • Admin ๊ธฐ๋Šฅ๊ณผ User ์„œ๋น„์Šค ๊ธฐ๋Šฅ์€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋ถ„๋ฆฌํ•˜๋Š” ๊ฒƒ์ด ์ข‹๊ฒ ์Œ

๐ŸŒŸ v1.0

1. ์ œ์ž‘ ๊ธฐ๊ฐ„ & ์ฐธ์—ฌ ์ธ์›

  • 2022๋…„ 11์›” 01์ผ ~ 2023๋…„ 2์›” 9์ผ
  • ch-yang1273
  • padonan

2. ์‚ฌ์šฉ ๊ธฐ์ˆ 

๐Ÿ“ Back-end

  • springBoot โ€˜2.7.5โ€™
  • jdk 11
  • gradle '7.5.1'
  • h2 โ€˜2.1.214โ€™
  • QueryDsl '5.0.0'
  • jwt '0.11.5'
  • swagger '1.6.13'
  • bootpay.backend.java // ๊ฒฐ์ œ ๋ชจ๋“ˆ
  • junit '5'

๐Ÿ“ Front-end

Git : (https://github.com/padonan/asc_flutter)

  • flutter โ€˜3.3.4โ€™
  • dart โ€˜2.18.2โ€™
  • flutter_native_splash: ^2.2.13
  • intl: ^0.17.0
  • qr_flutter: ^4.0.0
  • dio: ^4.0.6
  • flutter_secure_storage: ^6.0.0
  • jwt_decoder: ^2.0.1
  • bootpay: ^4.4.3
  • flutter_form_builder: ^7.7.0
  • toast: ^0.3.0
  • url_launcher: ^6.1.7
  • logger: ^1.1.0
  • flutter_local_notifications: ^12.0.4
  • build_runner: ^2.3.2
  • json_serializable: ^6.5.4

3. ERD ๊ตฌ์กฐ

20221227_194215

4. ํ•ต์‹ฌ ๊ธฐ๋Šฅ

โœจ ํ•ต์‹ฌ ์„œ๋น„์Šค๋Š” ์Šคํ„ฐ๋””์นดํŽ˜ ์ด์šฉ, ๊ฒฐ์ œ๊ถŒ ๊ตฌ์ž…, ADMIN์˜ ์Šคํ„ฐ๋””์นดํŽ˜ ๊ด€๋ฆฌ์ž…๋‹ˆ๋‹ค.

๋กœ๊ทธ์ธ,ํšŒ์›๊ฐ€์ž… ezgif-2-cdb0ac2ff9 ๊ฒฐ์ œ1

๋งค์ถœ