GithubHelp home page GithubHelp logo

wooodhead / 6th-habitbread-node Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prography/6th-habitbread-node

0.0 1.0 0.0 2.79 MB

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

Dockerfile 0.75% JavaScript 5.90% TypeScript 89.72% Shell 3.63%

6th-habitbread-node's Introduction

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๋ฅผ ๋‹ฌ์•„์ฃผ์„ธ์š” ๐Ÿ™‡๐Ÿปโ€โ™‚๏ธ

6th-habitbread-node's People

Contributors

dependabot[bot] avatar dnatuna avatar wwlee94 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.