Skip to content

reBike/reBike-front

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒณย What is ReBike?


์ƒํ™œ ์“ฐ๋ ˆ๊ธฐ ์ข…๋ฅ˜ AI ๋ถ„์„ ๋ฐ ๋ถ„๋ฆฌ์ˆ˜๊ฑฐ ์ƒํ™œํ™”๋ฅผ ์œ„ํ•œ ํ”Œ๋žซํผ

๐Ÿชตย System Architecture

๐ŸŒตย Tech Stack

Dev-Ops
Frontend
Backend
DB
AI
Monitoring
Others

๐ŸŒธย Core Screens

Redux

acitions
โŽฟ DecodeActions.tsx
	dispatch๊ฐ€ ์–ด๋–ค type์— ๋”ฐ๋ผ ํ•จ์ˆ˜๋ฅผ ์‹คํ–‰ํ•ด์ค„์ง€ ์ •ํ•œ๋‹ค. state๊ฐ’์„ ์–ด๋–ป๊ฒŒ ๋ณ€๊ฒฝํ• ์ง€ ์ •ํ•ด์ฃผ๋Š” ํŒŒ์ผ
	์ธ์ž๋กœ token๊ฐ’์„ ๋ฐ›์•„์„œ ๊ทธ๊ฑธ ๋””์ฝ”๋”ฉ ํ•ด์ค€๋‹ค . 
	๊ทธ๋ฆฌ๊ณ  payload์— [success, action[success, payload]] ๋ฅผ ์„ค์ •

โŽฟ ImgIDReducer.tsx
    dispatch๋กœ ์‹คํ–‰ํ•  ์•ก์…˜ ๊ฐ’ 1๊ฐœ (SAVE_ID) ์ด๊ฑธ๋กœ id ๊ฐ’์„ ๋„˜๊ฒจ์ค€๋‹ค.

reducer
โŽฟ DecodeReducer.tsx
	state ์ดˆ๊ธฐ๊ฐ’ ์„ค์ • ๋ฐ dispatch๋ฅผ ํฌํ•จํ•˜๊ณ  ์žˆ๋Š” ๊ณณ action ์ด ๋“ค์–ด์™€์„œ action.payload๋กœ 
	id, alias ๋ฅผ ๊ฐ€์ ธ์™€ state๊ฐ’์„ dispatch์—์„œ ๋„˜์–ด์˜จ ๋ฐ์ดํ„ฐ๋ฅผ ํ™œ์šฉํ•ด ๋ณ€๊ฒฝํ•ด์ค€๋‹ค .(์ „์—ญ๊ด€๋ฆฌ ์‹œ์ž‘)
	ex.	const userIdtoRedux = ReduxModule().decodeInfo?.id;
	

โŽฟ ImgIDReducer.tsx
    SAVE_ID ํƒ€์ž…์œผ๋กœ dispatch ๊ฐ€ ์‹คํ–‰๋์œผ๋ฉด ๊ฑฐ๊ธฐ์„œ ์ €์žฅ๋œ payload๋ฅผ ๊ฐ€์ ธ์™€ ๊ทธ ๊ฐ’์„ ๋ฆฌํ„ดํ•ด์ค€๋‹ค.
    dispatch(save_ID(res.data.image_id)); ์‹คํ–‰ํ›„ itemID ๋ฆฌํ„ด
	  ex. const itemID = useSelector((state: RootReducerType) => state.ImgIDReducer);

โŽฟ index.tsx
    root ๋ฆฌ๋“€์„œ ๊ด€๋ฆฌ ๋งŒ๋“ค์–ด ๋†“์€ DecodeReducer, ImgIDReducer๋ฅผ ์ด๊ด„ํ•œ๋‹ค. app.tsx์—์„œ ๋ถˆ๋Ÿฌ์™€ ์‚ฌ์šฉ

ReduxModule ํ† ํฐ์ด ์žˆ์„ ๋•Œ๋งŒ dispatch๋ฅผ ํ†ตํ•ด id๋ฅผ ๊ฐ€์ ธ์˜ค๋ ค๊ณ  ๋”ฐ๋กœ ๋ชจ๋“ˆ๋กœ ๋บด๋†“์Œ ํ† ํฐ์„ decoderedux๋ฅผ ํ†ตํ•ด ๋””์ฝ”๋”ฉ์‹œํ‚จ ํ›„ id๋ฅผ ๋ฆฌํ„ดํ•œ๋‹ค.

  • ์ •๋ฆฌ
    1. redux๋ฅผ ํ†ตํ•ด token decode ํ›„ uuid ์ „์—ญ๊ด€๋ฆฌ
    2. ์ปดํฌ๋„ŒํŠธ ์žฌํ™œ์šฉ์„ ์œ„ํ•ด uploadํ•œ ์ด๋ฏธ์ง€ ๋ฐ ๋‚ด๊ฐ€ ๋ฒ„๋ฆฐ ์“ฐ๋ ˆ๊ธฐ ์ƒ์„ธํŽ˜์ด์ง€๋ฅผ ์œ„ํ•œ trash_id ์ „์—ญ๊ด€๋ฆฌ

Mainpage

  • Search

  • UploadImage (polling)

  • PopularTrash

Sign up/ Sign in

  • Sign Up

  • Sign In

MyPage

  • MyTrashcan โ†’ ์˜ฌ๋ ธ๋˜ ์‚ฌ์ง„๋“ค์„ ๋ชจ๋‘ ํ™•์ธ๊ฐ€๋Šฅ
    autosave - On : ์˜ฌ๋ฆฐ ์‚ฌ์ง„์„ ์ž๋™ ์ €์žฅ / Off : ์ €์žฅ๋˜์ง€ ์•Š์Œ

  • Graph โ†’ ์˜ฌ๋ฆฐ ์‚ฌ์ง„์˜ ์ข…๋ฅ˜์™€ ์ˆ˜ ํŒŒ์•… ๊ฐ€๋Šฅ
    Default : ์ง€๊ธˆ๊นŒ์ง€ ์˜ฌ๋ ธ๋˜ ์ด ์‚ฌ์ง„ ์ข…๋ฅ˜, ๊ฐœ์ˆ˜
    ์‹œ์ž‘ ๋‚ ์งœ, ๋ ๋‚ ์งœ๋ฅผ ์ง€์ •ํ•˜์—ฌ ์›ํ•˜๋Š” ๋‚ ์งœ์— ์˜ฌ๋ฆฐ ์“ฐ๋ ˆ๊ธฐ ์ข…๋ฅ˜ ํ™•์ธ

  • Challenge โ†’ ์‚ฌ์ง„์„ ์˜ฌ๋ ธ์„ ๋•Œ ํ™œ์„ฑํ™”/Change Info โ†’ ๋น„๋ฐ€๋ฒˆํ˜ธ, ๋‹‰๋„ค์ž„ ๋ณ€๊ฒฝ/Log Out

๐ŸŒฟย ERD

users api

  • api/users/
    • GET : ํšŒ์›๊ฐ€์ž… ์‹œ ์•„์ด๋””, ๋‹‰๋„ค์ž„ ์ค‘๋ณต ์ฒดํฌ ๊ฒฐ๊ณผ
    • POST : ํšŒ์› ๊ฐ€์ž… ์ •๋ณด ์ €์žฅ
    • PATCH : ํšŒ์› ์ •๋ณด ์ˆ˜์ •
  • api/users/auth
    • POST : access token, refresh token ๊ฐฑ์‹ 
  • api/users/autosave
    • GET : ์—…๋กœ๋“œ ์‚ฌ์ง„ ์ž๋™์ €์žฅ ์—ฌ๋ถ€
    • PATCH : ์—…๋กœ๋“œ ์‚ฌ์ง„ ์ž๋™์ €์žฅ ์—ฌ๋ถ€ ๋ณ€๊ฒฝ

trash api

  • api/challenges
    • GET : ๋ชจ๋“  ๋„์ „๊ณผ์ œ ์ •๋ณด
  • api/statistics/ranking
    • GET : ์ธ๊ธฐ์ˆœ์œผ๋กœ ์ •๋ ฌ๋œ ์ผ์ฃผ์ผ๊ฐ„์˜ ์žฌํ™œ์šฉ ๋ฐ์ดํ„ฐ
  • api/users/{user_id}/results/tasks
    • POST : ์‚ฌ์šฉ์ž๊ฐ€ ์—…๋กœ๋“œํ•œ ์‚ฌ์ง„ ๋ถ„์„ ๋น„๋™๊ธฐ ์ฒ˜๋ฆฌ
  • api/users/{user_id}/results/tasks/{task_id}
    • GET : task_id๋กœ ๋ถ„์„ ์™„๋ฃŒ ์—ฌ๋ถ€ ํ™•์ธ, ํ”„๋ก ํŠธ์—์„œ polling
  • api/users/{user_id}/challenges
    • GET : ์‚ฌ์šฉ์ž๊ฐ€ ๋‹ฌ์„ฑํ•œ ๋„์ „๊ณผ์ œ ์ •๋ณด
  • api/users/{user_id}/pages/{page_number}
    • GET : ์‚ฌ์šฉ์ž๊ฐ€ ์—…๋กœ๋“œํ•œ ์žฌํ™œ์šฉ ์ด๋ฏธ์ง€ ๋ฐ์ดํ„ฐ, ํŽ˜์ด์ง€๋„ค์ด์…˜ ์ด์šฉ
  • api/trash/users/{user_id}/statistics
    • GET : ์‚ฌ์šฉ์ž๊ฐ€ ์—…๋กœ๋“œํ•œ ๋ชจ๋“  ์žฌํ™œ์šฉ ๋ฐ์ดํ„ฐ์˜ ํ†ต๊ณ„
  • api/trash/users/{user_id}/statistics/period/{from_date}/{to_date}
    • GET : ์‚ฌ์šฉ์ž๊ฐ€ ์„ค์ •ํ•œ ๋‚ ์— ๋”ฐ๋ฅธ ์žฌํ™œ์šฉ ๋ฐ์ดํ„ฐ ํ†ต๊ณ„

Search api

  • api/search/
    • POST : value ๊ฐ’์— ๋งž๋Š” ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ ๋ฐ˜ํ™˜

Elastic_search

  • used_library

    • elasticsearch
    • django_elasticsearch_dsl
  • setup_es.py

    • elastic_search default data setter
      1. make connection with django_elasticsearch_dsl

      2. make default data by using search_cofig.json

      3. bulk default data on elastic_search

  • elastic_search on Search api

  • why_elastic_search?

    • elastic_search has bunch of useful functions with searching data

    • elastic_search is much lighter than other DB

KIBANA

  • ์ผ๋ผ์Šคํ‹ฑ ์„œ์น˜์˜ ๊ฐ ๋ฐ์ดํ„ฐ๋“ค์„ ์‹œ๊ฐํ™”ํ•˜๋ฉฐ, ํ•ด๋‹น ๋ฐ์ดํ„ฐ๋“ค์„ ๊ด€๋ฆฌํ•˜๋Š”๋ฐ ๋„์›€์„ ์ฃผ๋Š” ํ”„๋กœ๊ทธ๋žจ
  • ์ถ”ํ›„. ๋ฐ์ดํ„ฐ ๊ด€๋ฆฌ ๋ฐ, ๋ฐ์ดํ„ฐ ์‹œ๊ฐํ™”๋ฅผ ํ†ตํ•œ ๋ณด๋‹ค ์ข‹์€ ๊ฐœ๋ฐœํ™˜๊ฒฝ์„ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ,

๐Ÿชดย AI

  • Result

JWT

  • used_library

    • djangorestframework-jwt
  • JWT_Settings.py

    • set JWTโ€™s default_settings

  • JWT on frontEND

    • restore tokens by using redux
    • if we need some user data, we donโ€™t need to make connection with backend by opening JWT payload, we can get user data
  • JWT on backEND

    • after we identify user by check login data, give authorization by using JWT
    • by using refresh_token, we enhanced our security level

๐Ÿ’ป Monitoring

Prometheus

  • exporter๊ฐ€ ๋งคํŠธ๋ฆญ์„ ์ˆ˜์ง‘ํ•˜๊ณ  HTTP ํ†ต์‹ ์„ ํ†ตํ•ด metric data๋ฅผ ๊ฐ€์ ธ๊ฐˆ ์ˆ˜ ์žˆ๊ฒŒ /metrics ๋ผ๋Š” HTTP ์—”๋“œํฌ์ธํŠธ๋ฅผ ์ œ๊ณตํ•œ๋‹ค. ๊ทธ๋Ÿฌ๋ฉด Prometheus server๊ฐ€ ์ด exporter์˜ ์—”๋“œํฌ์ธํŠธ์— HTTP GET ์š”์ฒญ์„ ์ด์šฉํ•˜์—ฌ metric data๋ฅผ pull ํ•œ๋‹ค.
  • ํ•ด๋‹น ๋…ธ๋“œ์˜ metric data

Grafana

  • Prometheus์˜ ์‹œ๊ฐํ™” ๋„๊ตฌ๊ฐ€ ๋ถ€์กฑํ•˜์—ฌ ์ด๋ฅผ ์ง์ ‘ ์‚ฌ์šฉํ•˜์ง€๋Š” ์•Š๊ณ  ๋Œ€๊ฒŒ Grafana๋ผ๋Š” Data Visualization tool์„ ์ด์šฉํ•˜์—ฌ ์‹œ๊ฐํ™”ํ•˜๊ณ  ์žˆ๋‹ค.

CPU load / RAM usage / Memory swap

Cadvisor

  • ์ƒ์„ฑ๋œ ๋„์ปค ์ปจํ…Œ์ด๋„ˆ๋“ฑ์— ๋Œ€ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์ง‘ํ•ด์ค€๋‹ค.

How to Start

Project Tree

โ„ข๏ธโฑ Members of Team-E

์ด๋ฆ„ ๊ฐœ๋ฐœ๋ถ„์•ผ ์†Œ๊ฐœํŽ˜์ด์ง€
๐Ÿฆฅ๊น€์šฉ๋ฏผ Back-end,DevOps https://github.com/Ryokuman
๐Ÿ’›๊น€์œ ๋ฆผ Back-end,DevOps,AI https://github.com/Ellie010707
๐Ÿ†๋ฐ•์„ฑ๋นˆ Back-end,DevOps https://github.com/SeongbinPark
๐Ÿงš๐Ÿปโ€โ™€๏ธ์ด์ฑ„ํ˜„ Front-end https://github.com/chloe1129
๐ŸŽน์ด์ •์šฐ Front-end https://github.com/RayLee-Kor
๐Ÿ‘ผ์ง„ํ˜ธ๋ณ‘ Front-end https://github.com/bicco2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published