Skip to content

๐Ÿž [ํ”„๋กœ๊ทธ๋ผํ”ผ 6๊ธฐ ์Šต๊ด€๋นต] ๊พธ์ค€ํ•œ ์Šต๊ด€ ๊ด€๋ฆฌ ๋ฐ ๋™๊ธฐ ๋ถ€์—ฌ ์ œ๊ณต์„ ์œ„ํ•ด '์Šต๊ด€์„ ๊ตฝ๋Š” ์ œ๋นต์‚ฌ'๋ฅผ ๋ชจํ† ๋กœ ๋ธŒ๋žœ๋”ฉํ™” ํ•œ ์„œ๋น„์Šค

Notifications You must be signed in to change notification settings

prography/6th-habitbread-node

Repository files navigation

IT ๋™์•„๋ฆฌ ํ”„๋กœ๊ทธ๋ผํ”ผ 6๊ธฐ ํ”„๋กœ์ ํŠธ

์„œ๋น„์Šค ์†Œ๊ฐœ

๊พธ์ค€ํ•œ ์Šต๊ด€ ๊ด€๋ฆฌ ๋ฐ ๋™๊ธฐ ๋ถ€์—ฌ ์ œ๊ณต์„ ์œ„ํ•ด '์Šต๊ด€๋นต์„ ๊ตฝ๋Š” ์ œ๋นต์‚ฌ'๋ฅผ ๋ชจํ† ๋กœ ๋ธŒ๋žœ๋”ฉํ™” ํ•œ ์„œ๋น„์Šค

'์Šต๊ด€๋นต'์€ ์ข‹์€ ์Šต๊ด€์„ ๋งŒ๋“ค๊ณ  ์‹ถ์€ ์‚ฌ์šฉ์ž๋“ค์—๊ฒŒ ๋„์›€์„ ์ฃผ๋Š” ๋ชจ๋ฐ”์ผ ์•ฑ ์„œ๋น„์Šค์ž…๋‹ˆ๋‹ค.

๋‹ค์–‘ํ•œ ๋นต์„ ๋งŒ๋“œ๋Š” '์ œ๋นต์‚ฌ'์ฒ˜๋Ÿผ ์—ฌ๋Ÿฌ๋ถ„์˜ ๋‹ค์–‘ํ•œ ์Šต๊ด€์„ ๊ตฌ์›Œ ์ข‹์€ ์Šต๊ด€์„ ์™„์„ฑํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ค„ ๊ฒ๋‹ˆ๋‹ค.

์Šต๊ด€์„ ๊ธฐ๋กํ•˜๊ณ  ํ•œ ๋ˆˆ์— ์•Œ์•„ ๋ณผ ์ˆ˜ ์žˆ๋Š” ํ†ต๊ณ„์™€ ๋žญํ‚น, ํ‘ธ์‹œ ์•Œ๋ฆผ์„ ํ†ตํ•œ ๋ฆฌ๋งˆ์ธ๋” ๊ธฐ๋Šฅ์„ ์ œ๊ณต ๋ฐ›์•„๋ณด์„ธ์š” !

์„œ๋น„์Šค ๊ฒฐ๊ณผ๋ฌผ

ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ

  • ์ถ”๊ฐ€ ์˜ˆ์ •..!

DB ์Šคํ‚ค๋งˆ ๊ตฌ์กฐ๋„

Redis ๊ตฌ์„ฑ

Ranking

  • Dense Ranking ๊ตฌํ˜„์„ ์œ„ํ•œ ๊ตฌ์กฐ
  1. ๊ฒฝํ—˜์น˜๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ •๋ ฌ๋œ ์‚ฌ์šฉ์ž ID ๋ฆฌ์ŠคํŠธ (Sorted Sets)

    [Key]
    "user:score"
    
    [Value]
    [
        {
            "value" : "user:1",
            "score" : "50"
        },
        ...
    ]
    
  2. ์‚ฌ์šฉ์ž ์ •๋ณด (Hash)

    [Key]
    "user:{id}" 
    Ex) "user:1", "user:2"
    
    [Value]
    {
        "name" : "์‚ฌ์šฉ์ž ์ด๋ฆ„",
        "achievement" : "50", // ๋‹ฌ์„ฑ๋„
        "exp" : "10"          // ๊ฒฝํ—˜์น˜
    }
    

Scheduler

  • FCM ๋ฉ”์‹œ์ง• ๊ธฐ๋Šฅ ๊ตฌํ˜„์„ ์œ„ํ•œ ๊ตฌ์กฐ
  1. ํŠน์ • ์‹œ๊ฐ„์— ์•Œ๋ฆผ์„ ๋ณด๋‚ด์•ผํ•˜๋Š” ์Šต๊ด€ ID ๋ฆฌ์ŠคํŠธ (Set)

    [Key]
    "MMDDHHmm" Date ํ˜•ํƒœ์˜ String 
    Ex) "10281020"
    
    [Value]
    [
        "10", // ์Šต๊ด€์˜ ID
        "80"
        ...
    ]
    
  2. Habit ์ •๋ณด (Hash)

    [Key]
    "habit:{id}"
    Ex) "habit:1", "habit:2"
    
    [Value]
    {
        "userId" : "1",
        "title" : "๋งค์ผ ํ•˜๋ฃจ 1๋ฒˆ ๋ฌผ ๋งˆ์‹œ๊ธฐ",
        "dayOfWeek" : "0100010" // ์Šต๊ด€์„ ํ•ด์•ผํ•  ์š”์ผ
    }
    
  3. User ์ •๋ณด (Hash)

    [Key]
    "user:{id}"
    Ex) "user:1", "user:2"
    
    [Value]
    {
        "isAlarmOn" : "0", // 0 or 1 (์•Œ๋žŒ ํ‚จ ์—ฌ๋ถ€)
        "FCMToken" : "token", // FCM์—์„œ ๋ฐœ๊ธ‰๋ฐ›์€ ํ† ํฐ
    }
    

๊ธฐ์ˆ  ์Šคํƒ

  • RunTime : Node.js

  • Web server : Nginx + SSL ์ธ์ฆ

  • Framework : Express

  • Language : Typescript

  • Dependencies Management : NPM

  • Security : Let's Encrypt + JWT

  • Database : MySQL

  • ORM : Prisma2

  • Testing : Jest + supertest

  • Interactive Build : Docker

  • Cloud Server : AWS EC2

  • CI / CD : Github Action

  • OAuth : Google, Apple

  • Cloud Messaging : FCM (Firebase Cloud Messaging)

API ๋ฌธ์„œ

HabitBread API ๋ฌธ์„œ

๋ฌธ์˜

์„œ๋น„์Šค ์‚ฌ์šฉ ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด issue๋ฅผ ๋‹ฌ์•„์ฃผ์„ธ์š” ๐Ÿ™‡๐Ÿปโ€โ™‚๏ธ

About

๐Ÿž [ํ”„๋กœ๊ทธ๋ผํ”ผ 6๊ธฐ ์Šต๊ด€๋นต] ๊พธ์ค€ํ•œ ์Šต๊ด€ ๊ด€๋ฆฌ ๋ฐ ๋™๊ธฐ ๋ถ€์—ฌ ์ œ๊ณต์„ ์œ„ํ•ด '์Šต๊ด€์„ ๊ตฝ๋Š” ์ œ๋นต์‚ฌ'๋ฅผ ๋ชจํ† ๋กœ ๋ธŒ๋žœ๋”ฉํ™” ํ•œ ์„œ๋น„์Šค

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published