/TOASTER-Server

๐ŸŒฑ System.out.println("ํž9")

Primary LanguageJava

TOASTER-SERVER

Frame 31

๋” ์ด์ƒ ๋งํฌ๋ฅผ ํƒœ์šฐ์ง€ ๋งˆ์„ธ์š”. ํ† ์ŠคํŠธ ๋จน๋“ฏ์ด ๊ฐ„๋‹จํ•˜๊ฒŒ!

  • 33๊ธฐ DO SOPT APP-JAM (2023.12.17 ~ )

๐ŸŽ Server Developer

๋ฏธํ˜œ ์ˆ˜ํ˜„
๋ฏธํ˜œ ์ˆ˜ํ˜„

๐Ÿ“š Tech Stack

Category Used
Java version Java 17
Spring version 3.2.0
Cloud Computing AWS EC2 (Ubuntu 22.04 LTS)
Database AWS RDS (MySQL 8.0.33)
File Upload AWS S3
MessageQueue AWS SQS
CI/CD Github Actions, Docker, Nginx
Notification Firebase Cloud Messaging
Monitoring Sentry, Slack
API Docs Swagger, Notion

๐Ÿ“ฆ ERD

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2024-01-19 แ„‹แ…ฉแ„’แ…ฎ 10 31 57



๐Ÿงฌ Architecture

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2024-01-19 แ„‹แ…ฉแ„’แ…ฎ 10 11 03



๐Ÿ“‚ ํด๋” ๊ตฌ์กฐ๋„

โ”œโ”€โ”€ ๐Ÿ“‚.github
โ”œโ”€โ”€ ๐Ÿ“‚ main
	โ”œโ”€โ”€ ๐Ÿ“‚ java
		โ”œโ”€โ”€ ๐Ÿ“‚ com.app.toaster
			โ”œโ”€โ”€ ๐Ÿ“‚ controller(์ปจํŠธ๋กค๋Ÿฌ ํŒŒ์ผ)
				โ”œโ”€โ”€ ๐Ÿ—‚๏ธ dto
					 โ”œโ”€โ”€๐Ÿ—‚๏ธ request
					 โ”œโ”€โ”€๐Ÿ—‚๏ธ response
					 โ”œโ”€โ”€๐Ÿ—‚๏ธ valid(valid custom์–ด๋…ธํ…Œ์ด์…˜ ๊ด€๋ฆฌ ํด๋”)

			โ”œโ”€โ”€ ๐Ÿ“‚ domain(์—”ํ‹ฐํ‹ฐ ํŒŒ์ผ)
			
			โ”œโ”€โ”€ ๐Ÿ“‚ infrastructure(๋ ˆํฌ์ง€ํ† ๋ฆฌ ํด๋”)
			
			โ”œโ”€โ”€ ๐Ÿ“‚ service(์„œ๋น„์Šค ํŒŒ์ผ)
				โ”œโ”€โ”€ ๐Ÿ—‚๏ธ auth
				โ”œโ”€โ”€ ๐Ÿ—‚๏ธ parse
				โ”œโ”€โ”€ ๐Ÿ—‚๏ธ search
				โ”œโ”€โ”€ ๐Ÿ—‚๏ธ toast
				โ”œโ”€โ”€ ๐Ÿ—‚๏ธ timer
			
			โ”œโ”€โ”€ ๐Ÿ“‚ exception(Exception enum, Exception class ํŒŒ์ผ)
				โ”œโ”€โ”€ ๐Ÿ—‚๏ธ model
			
			โ”œโ”€โ”€ ๐Ÿ“‚ external(์„œ๋น„์Šค ํŒŒ์ผ)
				โ”œโ”€โ”€ ๐Ÿ—‚๏ธ slack
				โ”œโ”€โ”€ ๐Ÿ—‚๏ธ client.aws
					โ”œโ”€โ”€ ๐Ÿ—‚๏ธ AWSConfig
					โ”œโ”€โ”€ ๐Ÿ—‚๏ธ S3Service
			
			โ”œโ”€โ”€ ๐Ÿ“‚ common(๊ณต์šฉ ํด๋ž˜์Šค ๊ด€๋ฆฌ)
				โ”œโ”€โ”€๐Ÿ—‚๏ธ advice
				โ”œโ”€โ”€๐Ÿ—‚๏ธ dto	
			
			โ”œโ”€โ”€ ๐Ÿ“‚ config(๊ณต์šฉ ํด๋ž˜์Šค ์„ค์ • ๊ด€๋ฆฌ)
				โ”œโ”€โ”€๐Ÿ—‚๏ธ user
				โ”œโ”€โ”€๐Ÿ—‚๏ธ jwt			

		โ”œโ”€โ”€ ๐Ÿ—‚๏ธ resources
			โ”œโ”€โ”€ ๐Ÿ“• application.yml



๐Ÿค Code Convention

โœ“ File Naming

  • ํŒŒ์ผ ์ด๋ฆ„ ๋ฐ ํด๋ž˜์Šค, ์ธํ„ฐํŽ˜์ด์Šค ์ด๋ฆ„: ํŒŒ์Šค์นผ ์ผ€์ด์Šค(Pascal Case)
  • Entity์—์„œ ์‚ฌ์šฉ๋˜๋Š” ์†์„ฑ๊ฐ’๋“ค์€ ? ์นด๋ฉœ ์ผ€์ด์Šค(camel Case)
  • ๋‚ด๋ถ€์—์„œ ์‚ฌ์šฉ๋˜๋Š” ํ•จ์ˆ˜ ๋ฐ ๊ธฐํƒ€ ์‚ฌ์šฉ: ์นด๋ฉœ ์ผ€์ด์Šค(camelCase)

โœ“ ์ธํ„ฐํŽ˜์ด์Šค ์ด๋ฆ„์— ๋ช…์‚ฌ/ํ˜•์šฉ์‚ฌ ์‚ฌ์šฉ [interface-noun-adj]

์ธํ„ฐํŽ˜์ด์Šค(interface)์˜ ์ด๋ฆ„์€ ๋ช…์‚ฌ/๋ช…์‚ฌ์ ˆ๋กœ ํ˜น์€ ํ˜•์šฉ์‚ฌ/ํ˜•์šฉ์‚ฌ์ ˆ๋กœ ์ง“๋Š”๋‹ค.

โœ“ ํด๋ž˜์Šค ์ด๋ฆ„์— ๋ช…์‚ฌ ์‚ฌ์šฉ [class-noun]

ํด๋ž˜์Šค ์ด๋ฆ„์€ ๋ช…์‚ฌ๋‚˜ ๋ช…์‚ฌ์ ˆ๋กœ ์ง“๋Š”๋‹ค.

โœ“ ๋ฉ”์„œ๋“œ ์ด๋ฆ„์€ ๋™์‚ฌ/์ „์น˜์‚ฌ๋กœ ์‹œ์ž‘ [method-verb-preposition]

๋ฉ”์„œ๋“œ๋ช…์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๋™์‚ฌ๋กœ ์‹œ์ž‘ํ•œ๋‹ค.

๋‹ค๋ฅธ ํƒ€์ž…์œผ๋กœ ์ „ํ™˜ํ•˜๋Š” ๋ฉ”์„œ๋“œ๋‚˜ ๋นŒ๋” ํŒจํ„ด์„ ๊ตฌํ˜„ํ•œ ํด๋ž˜์Šค์˜ ๋ฉ”์„œ๋“œ์—์„œ๋Š” ์ „์น˜์‚ฌ๋ฅผ ์“ธ ์ˆ˜ ์žˆ๋‹ค.

โœ“ ์ƒ์ˆ˜๋Š” ๋Œ€๋ฌธ์ž์™€ ์–ธ๋”์Šค์ฝ”์–ด๋กœ ๊ตฌ์„ฑ[constant_uppercase]

"static final"๋กœ ์„ ์–ธ๋˜์–ด ์žˆ๋Š” ํ•„๋“œ์ผ ๋•Œ ์ƒ์ˆ˜๋กœ ๊ฐ„์ฃผํ•œ๋‹ค.

์ƒ์ˆ˜ ์ด๋ฆ„์€ ๋Œ€๋ฌธ์ž๋กœ ์ž‘์„ฑํ•˜๋ฉฐ, ๋ณตํ•ฉ์–ด๋Š” ์–ธ๋”์Šค์ฝ”์–ด'_'๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋‹จ์–ด๋ฅผ ๊ตฌ๋ถ„ํ•œ๋‹ค.

โœ“ ๋ณ€์ˆ˜์— ์†Œ๋ฌธ์ž ์นด๋ฉœํ‘œ๊ธฐ๋ฒ• ์ ์šฉ [var-lower-camelcase]

์ƒ์ˆ˜๊ฐ€ ์•„๋‹Œ ํด๋ž˜์Šค์˜ ๋ฉค๋ฒ„๋ณ€์ˆ˜/์ง€์—ญ๋ณ€์ˆ˜/๋ฉ”์„œ๋“œ ํŒŒ๋ผ๋ฏธํ„ฐ์—๋Š” ์†Œ๋ฌธ์ž ์นด๋ฉœํ‘œ๊ธฐ๋ฒ•(Lower camel case)์„ ์‚ฌ์šฉํ•œ๋‹ค.

โœ“ ์ž„์‹œ ๋ณ€์ˆ˜ ์™ธ์—๋Š” 1 ๊ธ€์ž ์ด๋ฆ„ ์‚ฌ์šฉ ๊ธˆ์ง€ [avoid-1-char-var]

๋ฉ”์„œ๋“œ ๋ธ”๋Ÿญ ๋ฒ”์œ„ ์ด์ƒ์˜ ์ƒ๋ช… ์ฃผ๊ธฐ๋ฅผ ๊ฐ€์ง€๋Š” ๋ณ€์ˆ˜์—๋Š” 1๊ธ€์ž๋กœ ๋œ ์ด๋ฆ„์„ ์“ฐ์ง€ ์•Š๋Š”๋‹ค.

๋ฐ˜๋ณต๋ฌธ์˜ ์ธ๋ฑ์Šค๋‚˜ ๋žŒ๋‹ค ํ‘œํ˜„์‹์˜ ํŒŒ๋ผ๋ฏธํ„ฐ ๋“ฑ ์งง์€ ๋ฒ”์œ„์˜ ์ž„์‹œ ๋ณ€์ˆ˜์—๋Š” ๊ด€๋ก€์ ์œผ๋กœ 1๊ธ€์ž ๋ณ€์ˆ˜๋ช…์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

๐Ÿค Git Convention

Issue

๋ชจ๋“  ์ž‘์—…์˜ ๋‹จ์œ„๋Š” github์— ์ƒ์„ฑ๋œ Issue๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•ฉ๋‹ˆ๋‹ค.

Issue์˜ ๋ณผ๋ฅจ์€ ์ตœ์†Œ ํ•˜๋‚˜์˜ ๊ธฐ๋Šฅ์œผ๋กœ ํ•ฉ๋‹ˆ๋‹ค.

ํ•˜๋‚˜์˜ ์ด์Šˆ๋ฅผ ๋งˆ๋ฌด๋ฆฌํ•˜๊ธฐ ์ „์—๋Š” ํŠน๋ณ„ํ•œ ์ƒํ™ฉ์ด ์•„๋‹Œ ์ด์ƒ ๋‹ค๋ฅธ ์ž‘์—…์— ๋Œ€ํ•œ ์ด์Šˆ๋ฅผ ์ƒ์„ฑํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

PR (Pull Request)

Issue โ‰ค PR

ํ•˜๋‚˜์˜ ์ด์Šˆ์— ๋Œ€ํ•ด์„œ ๋ฐ˜๋“œ์‹œ ํ•˜๋‚˜์˜ PR์ด ์—ด๋ ค์•ผํ•˜๋Š” ๊ฑด ์•„๋‹™๋‹ˆ๋‹ค.

์›ํ™œํ•œ ์ฝ”๋“œ๋ฆฌ๋ทฐ์™€ ๋ฆฌ๋ทฐ์— ๋Œ€ํ•œ ๋‚ด์šฉ์„ ๋ฐ˜์˜ํ•˜๊ธฐ ์œ„ํ•ด์„œ PR์€ 3๊ฐœ์˜ commit์„ ๋„˜์–ด๊ฐ€์ง€ ์•Š์•„์•ผํ•ฉ๋‹ˆ๋‹ค.

ํ•˜๋‚˜์˜ PR์— 3๊ฐœ ์ด์ƒ์˜ File Change๋Š” ์ง€์–‘ํ•ฉ๋‹ˆ๋‹ค.

Branch

Branch ์ „๋žต์€ Git-flow๋ฅผ ์ค€์ˆ˜ํ•ฉ๋‹ˆ๋‹ค.

์šฐ๋ฆฐ Git-flow๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์–ด์š” | ์šฐ์•„ํ•œํ˜•์ œ๋“ค ๊ธฐ์ˆ ๋ธ”๋กœ๊ทธ

branch ์ด๋ฆ„: ๊ด€๋ จ๋ธŒ๋žœ์น˜ ๋ถ„๋ฅ˜/#[Issue tracker] ex) feature/#1

Commit

์ปค๋ฐ‹ ๊ตฌ๋ถ„ ์„ค๋ช…
Feature (Feature) ๊ฐœ์„  ๋˜๋Š” ๊ธฐ๋Šฅ ์ถ”๊ฐ€
Bug (Bug Fix) ๋ฒ„๊ทธ ์ˆ˜์ •
Doc (Documentation) ๋ฌธ์„œ ์ž‘์—…
Test (Test) ํ…Œ์ŠคํŠธ ์ถ”๊ฐ€/์ˆ˜์ •
Build (Build) ๋นŒ๋“œ ํ”„๋กœ์„ธ์Šค ๊ด€๋ จ ์ˆ˜์ •(yml)
Performance (Performance) ์†๋„ ๊ฐœ์„ 
Refactor (Cleanup) ์ฝ”๋“œ ์ •๋ฆฌ/๋ฆฌํŒฉํ† ๋ง
  • ์ด์Šˆ๋ฒˆํ˜ธ์™€ ํ•จ๊ป˜ ์ปค๋ฐ‹ ๋‚ด์šฉ์„ ์ ๋Š”๋‹ค.
  • ์˜ˆ์‹œ : [#1] feataure : ~