diff --git a/README.md b/README.md index b8a1d49..c93a0d8 100644 --- a/README.md +++ b/README.md @@ -1,56 +1 @@ -## 01. 프로젝트 설명 -- Spring + RabbitMQ + STOMP를 통한 실시간 채팅 서비스 -- JWT를 통한 세션 관리 -- DB 활용 - - | DB | 사용 이유 | - |---------|----------------| - | MySQL | 메인 DB | - | MongoDB | 채팅 메시지 저장 | - | Redis | 실시간 채팅방 참가자 관리 | - -## 02. 핵심 기능 -- 실시간 채팅 -- UI를 통한 데이터 시각화 및 편의성 제공 -- 채팅방 메시지의 읽지 않은 사용자의 수를 실시간으로 반영 - ![rabbitmq](https://github.com/user-attachments/assets/4dbc6156-3408-49ad-8575-4bc168052aa9) - > 1. 메시지 전송 시 현재 채팅방에 접속된 유저를 통해 '안 읽은 수'를 계산하여 같이 출력 - > 2. 다른 채팅방 참가자가 접속 시 미리 접속해있던 유저들이 보고 있는 메시지의 '안 읽은 수'를 최신화하여 갱신 - -## 03. 사용 기술 -- `Spring Boot 3.1`, `Spring Data JPA` -- `MySQL`, `MongoDB`, `Redis` -- `RabbitMQ`, `STOMP` -- `JWT` -- `Docker`, `docker-compose` -- `HTML`, `CSS`, `JS` - -## 04. 관련 포스팅 -- [기술 스택 선정 이유](https://lsh2613.tistory.com/260#1.%20RabbitMQ%20%EC%84%A0%ED%83%9D%20%EC%9D%B4%EC%9C%A0-1) -- [STOMP-테스트 실패](https://lsh2613.tistory.com/260#3.%20%ED%85%8C%EC%8A%A4%ED%8A%B8%20%EC%A4%91%20%EB%B3%80%EC%88%98%20%EB%B0%9C%EC%83%9D-1) -- [채팅 내역을 MongoDB에 저장하는 이유](https://lsh2613.tistory.com/261#1.%20%EC%B1%84%ED%8C%85%20%EB%82%B4%EC%97%AD%EC%9D%84%20MongoDB%EC%97%90%20%EC%A0%80%EC%9E%A5%ED%95%98%EB%8A%94%20%EC%9D%B4%EC%9C%A0-1) -- [읽음/안 읽음 기능 적용](https://lsh2613.tistory.com/262#1.%20%EC%9D%BD%EC%9D%8C%2F%EC%95%88%20%EC%9D%BD%EC%9D%8C-1) -- [JWT + Session 적용 이유](https://lsh2613.tistory.com/263#2.%20JWT%2C%20Session%20%EB%8C%80%EC%8B%A0%20%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94%20%EA%B1%B4%EB%8D%B0%20%EC%99%9C%20%EA%B5%B3%EC%9D%B4%20%EB%91%98%20%EB%8B%A4%20%EC%82%AC%EC%9A%A9%ED%95%A0%EA%B9%8C%3F-1) - -## 05. 시작하기 -**1. 프로젝트 불러오기** -``` bash -git clone https://github.com/lsh2613/RabbitMQ.git <원하는 경로> -cd <원하는 경로> -``` - -**2. docker-compose 실행** - -``` bash -docker-compose up -d -``` - -**3. 애플리케이션 실행** -``` bash -./gradlew bootRun -``` - -**4. 채팅 테스트** -1. `localhost:8080`를 통해 API UI에 접속 -2. 회원 가입, 채팅방 생성, 채팅방 참가 등 필요한 api 호출 -3. 두 개 이상의 브라우저를 열고, 각 브라우저에서 채팅방에 참가 -4. 각 브라우저에서 채팅 메시지를 전송하고, 실시간으로 메시지가 전달되는지 확인 +업데이트 예정 diff --git a/src/main/resources/static/chatroom/chat-room-create.html b/src/main/resources/static/chatroom/chat-room-create.html deleted file mode 100644 index c7aaf46..0000000 --- a/src/main/resources/static/chatroom/chat-room-create.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - Chat Room Created - - - - -
- -
- - -
- -
- -
- - - - - \ No newline at end of file diff --git a/src/main/resources/static/chatroom/chat-room-join.html b/src/main/resources/static/chatroom/chat-room-join.html deleted file mode 100644 index 0e6869a..0000000 --- a/src/main/resources/static/chatroom/chat-room-join.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - Join Chat Room - - - - -
- - -
- - -
-
-

채팅방 참가

-
-
- - -
- -
-
- - -
-

채팅방 목록

-
    -
    - - - -
    - -
    - - - - - \ No newline at end of file diff --git a/src/main/resources/static/chatroom/chat-room.html b/src/main/resources/static/chatroom/chat-room.html deleted file mode 100644 index 6645a13..0000000 --- a/src/main/resources/static/chatroom/chat-room.html +++ /dev/null @@ -1,240 +0,0 @@ - - - - - Chat Room - - - - - -
    -
    -
    -

    채팅방

    -
    -
    -
    - - -
    -
    -
    -
    - - - - - - \ No newline at end of file diff --git a/src/main/resources/static/chatroom/chat-rooms.html b/src/main/resources/static/chatroom/chat-rooms.html deleted file mode 100644 index 2423775..0000000 --- a/src/main/resources/static/chatroom/chat-rooms.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - Chat Rooms - - - - -
    - - -
    - - -
    -

    전체 채팅방 목록

    - -
    - -
    - - - - - \ No newline at end of file diff --git a/src/main/resources/static/chatroom/my-chat-rooms.html b/src/main/resources/static/chatroom/my-chat-rooms.html deleted file mode 100644 index 9ca9c22..0000000 --- a/src/main/resources/static/chatroom/my-chat-rooms.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - My Chat Rooms - - - - - - -
    -
    - -
    -

    내 채팅방 목록

    -
    -
    -
    -
    -
    - - - - - - \ No newline at end of file diff --git a/src/main/resources/static/css/style.css b/src/main/resources/static/css/style.css deleted file mode 100644 index 8a3afae..0000000 --- a/src/main/resources/static/css/style.css +++ /dev/null @@ -1,62 +0,0 @@ -body { - padding: 20px; - background-color: #f8f9fa; -} - -.api-section { - border: 1px solid #dee2e6; - border-radius: 5px; - padding: 20px; - margin-bottom: 30px; - background-color: #ffffff; -} - -.api-block { - background-color: #f1f3f5; - padding: 15px; - border-radius: 5px; - margin-bottom: 15px; - word-break: break-word; -} - -.token-text { - flex-grow: 1; - margin-right: 10px; - overflow-wrap: anywhere; -} - -h2 { - margin-bottom: 20px; -} - -h4 { - margin-bottom: 20px; -} - -/* 헤더 스타일 */ -.header { - width: 100%; - background-color: rgb(123, 184, 6); - padding: 0.5rem 1rem; /* px-3 py-2 반영 */ - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); - - /* 유연한 레이아웃 */ - display: flex; - justify-content: space-between; - align-items: center; -} - -.header a { - text-decoration: none; - color: #333; - font-weight: bold; - font-size: 1.5rem; - margin-bottom: 0; /* mb-0 반영 */ -} - -/* 유저 정보 표시 영역 */ -#user-info { - display: flex; - align-items: center; - gap: 0.5rem; -} \ No newline at end of file diff --git a/src/main/resources/static/header.html b/src/main/resources/static/header.html deleted file mode 100644 index 490c76f..0000000 --- a/src/main/resources/static/header.html +++ /dev/null @@ -1,5 +0,0 @@ -
    - HOME -
    -
    -
    \ No newline at end of file diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html deleted file mode 100644 index 2ddbb19..0000000 --- a/src/main/resources/static/index.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - API Docs - - - - - -
    -
    - - -
    -

    Member API

    - -
    -

    - 회원가입 - [POST]   /members -

    - - - - -
    - -
    -

    - 모든 회원 조회 - [GET]   /members -

    - -
    - -
    - -

    ChatRoom API

    - -
    -

    - 채팅방 생성 - [POST]   /chat-rooms -

    - -
    - -
    -

    - 전체 채팅방 조회 - [GET]   /chat-rooms -

    - -
    - -
    -

    - 나의 채팅방 조회 - [POST]   /my-chat-rooms -

    - - -
    - -
    - -

    ChatRoomMember API

    - -
    -

    - 채팅방 참가 - [POST]   /chat-rooms/{chatRoomId}/members -

    - -
    - -
    - -
    - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/static/js/header.js b/src/main/resources/static/js/header.js deleted file mode 100644 index 18beea7..0000000 --- a/src/main/resources/static/js/header.js +++ /dev/null @@ -1,59 +0,0 @@ -document.addEventListener("DOMContentLoaded", function () { - fetch("/header.html") - .then(response => response.text()) - .then(data => { - document.getElementById("header-placeholder").innerHTML = data; - updateUserInfo(); - }) - .catch(error => console.error("헤더 로드 실패:", error)); -}); - -function updateUserInfo() { - const userInfoDiv = document.getElementById("user-info"); - const memberId = sessionStorage.getItem("memberId"); - const nickname = sessionStorage.getItem("nickname"); - const accessToken = sessionStorage.getItem("accessToken"); - - userInfoDiv.innerHTML = ""; // 초기화 - - if (memberId && nickname && accessToken) { - const nameSpan = document.createElement("span"); - nameSpan.textContent = `👤 ${nickname}`; - nameSpan.style.fontSize = "0.9rem"; - nameSpan.style.fontWeight = "bold"; - - const logoutButton = document.createElement("button"); - logoutButton.textContent = "로그아웃"; - logoutButton.onclick = logout; - logoutButton.style.background = "transparent"; - logoutButton.style.border = "none"; - logoutButton.style.fontSize = "0.9rem"; - logoutButton.style.cursor = "pointer"; - logoutButton.style.fontWeight = "bold"; - - userInfoDiv.appendChild(nameSpan); - userInfoDiv.appendChild(logoutButton); - } else { - const loginButton = document.createElement("button"); - loginButton.textContent = "로그인"; - loginButton.style.background = "transparent"; - loginButton.style.border = "none"; - loginButton.style.fontSize = "0.9rem"; - loginButton.style.cursor = "pointer"; - loginButton.style.textDecoration = "none"; - loginButton.style.fontWeight = "bold"; - - loginButton.onclick = () => { - window.location.href = "/member/members.html"; - }; - - userInfoDiv.appendChild(loginButton); - } -} - -function logout() { - sessionStorage.removeItem("memberId"); - sessionStorage.removeItem("nickname"); - sessionStorage.removeItem("accessToken"); - location.reload(); -} \ No newline at end of file diff --git a/src/main/resources/static/member/members.html b/src/main/resources/static/member/members.html deleted file mode 100644 index 9c9ae63..0000000 --- a/src/main/resources/static/member/members.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - Members List - - - - -
    - -
    - - -
    -
    -

    모든 회원 조회

    -
      -
    -
    -
    -
    - - - - - \ No newline at end of file