Skip to content

Commit 97b09f4

Browse files
authored
Update README.md
1 parent ff14f52 commit 97b09f4

File tree

1 file changed

+155
-152
lines changed

1 file changed

+155
-152
lines changed

README.md

Lines changed: 155 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,201 +1,204 @@
1-
# 🚗 IsItempty 백엔드 개발 가이드
1+
# 🚗 IsItEmpty 백엔드
22

3-
이 문서는 IsItempty 백엔드 애플리케이션의 로컬 개발 환경 설정 및 실행 방법을 안내합니다.
3+
<div align="center">
4+
<img src="./images/logo.png" alt="IsItEmpty Logo" width="400"/>
5+
6+
> 🅿️ 실시간 주차장 빈자리 확인으로 주차 스트레스 해소!
7+
</div>
48
5-
## 📋 목차
9+
서울시 공공데이터를 활용한 실시간 주차장 빈자리 확인 서비스의 백엔드 시스템입니다.
610

7-
- [개발 환경 설정](#개발-환경-설정)
8-
- [애플리케이션 실행](#애플리케이션-실행)
9-
- [데이터베이스 연결 설정](#데이터베이스-연결-설정)
10-
- [환경 설정 파일](#환경-설정-파일)
11-
- [프로필 설정](#프로필-설정)
12-
- [API 테스트](#api-테스트)
13-
- [문제 해결](#문제-해결)
14-
- [프로젝트 구조](#프로젝트-구조)
15-
- [참고 자료](#참고-자료)
11+
## 💡 서비스 소개
1612

17-
## 💻 개발 환경 설정
13+
IsItEmpty는 다음과 같은 문제를 해결하기 위해 만들어졌습니다:
1814

19-
### 필수 요구사항
15+
- 🚫 불법 주정차로 인한 사회적 문제
16+
- 😫 주차 공간을 찾기 위한 불필요한 시간 낭비
17+
- 🌍 교통 체증과 환경 오염
2018

21-
- ✅ JDK 17 이상
22-
- ✅ MySQL (SSH 터널링 방식 사용)
23-
- ✅ Git
24-
- ✅ Intellij IDE (권장)
19+
### 주요 기능
2520

26-
### 프로젝트 클론
21+
1. 🔍 **실시간 주차장 정보**
22+
- 서울시 시영주차장 실시간 정보 제공
23+
- 빈자리 수, 운영 시간, 요금 정보 제공
24+
- 위치 기반 주변 주차장 검색
2725

28-
```bash
29-
git clone https://github.com/isitempty/backend.git
30-
cd backend
31-
```
32-
33-
## 🚀 애플리케이션 실행
34-
35-
### 1) IntelliJ IDEA에서 실행
36-
37-
1. IntelliJ IDEA에서 프로젝트 열기
38-
2. `IsitemptyApplication.java` 실행 버튼 클릭
26+
2. 📸 **주차 단속 카메라 정보**
27+
- 주차 단속 카메라 위치 정보 제공
28+
- 단속 구역 안내
3929

40-
### 2) 명령줄에서 실행
30+
3. 🚽 **편의시설 정보**
31+
- 주차장 내 화장실 위치
32+
- 장애인 편의시설 정보
4133

42-
```bash
43-
./gradlew bootRun
44-
```
34+
4.**사용자 맞춤 기능**
35+
- 즐겨찾기 주차장 등록
36+
- 리뷰 및 평점 시스템
37+
- 주차장 이용 내역 관리
4538

46-
## 🔌 데이터베이스 연결 설정
39+
5. 👑 **관리자 기능**
40+
- 사용자 관리 (조회/수정/삭제)
41+
- 권한 관리 (관리자/일반 사용자)
42+
- 문의사항 관리
43+
- 시스템 모니터링
4744

48-
### SSH 터널링을 통한 원격 데이터베이스 연결
49-
1. Bash 스크립트 파일에 권한 부여
50-
```bash
51-
$ chmod +x mysql-tunnel.sh redis-tunnel.sh
52-
```
45+
## 🛠 기술 스택
5346

54-
2. 터미널 2개를 열고 각각 Bash 스크립트 파일을 실행 후, 서버 비밀번호를 입력
55-
```bash
56-
// Mysql
57-
$ ./mysql-tunnel.sh
58-
59-
// Redis
60-
$ ./redis-tunnel.sh
61-
```
47+
- **언어 및 프레임워크**:
48+
- ![Java](https://img.shields.io/badge/Java-ED8B00?style=flat-square&logo=openjdk&logoColor=white)
49+
- ![Spring Boot](https://img.shields.io/badge/Spring_Boot-6DB33F?style=flat-square&logo=spring-boot&logoColor=white)
6250

63-
> **SSH 터널링이 설정되면 애플리케이션은 원격 MySQL 및 Redis 서버에 연결됩니다.**
51+
- **데이터베이스**:
52+
- ![MySQL](https://img.shields.io/badge/MySQL-4479A1?style=flat-square&logo=mysql&logoColor=white)
53+
- ![Redis](https://img.shields.io/badge/Redis-DC382D?style=flat-square&logo=redis&logoColor=white)
6454

65-
## 🔐 환경 설정 파일
55+
- **인증/인가**:
56+
- ![OAuth2.0](https://img.shields.io/badge/OAuth2.0-2C5BB4?style=flat-square)
57+
- ![JWT](https://img.shields.io/badge/JWT-000000?style=flat-square&logo=json-web-tokens&logoColor=white)
6658

67-
### 애플리케이션 프로필
59+
- **빌드 및 배포**:
60+
- ![Gradle](https://img.shields.io/badge/Gradle-02303A?style=flat-square&logo=gradle&logoColor=white)
61+
- ![Docker](https://img.shields.io/badge/Docker-2496ED?style=flat-square&logo=docker&logoColor=white)
62+
- ![GitHub Actions](https://img.shields.io/badge/GitHub_Actions-2088FF?style=flat-square&logo=github-actions&logoColor=white)
6863

69-
프로젝트는 Spring Boot의 프로필 기능을 사용하여 환경별 설정을 관리합니다:
64+
## 📐 시스템 아키텍처
7065

71-
1. **application.properties**: 공통 설정
72-
2. **application-dev.properties**: 개발 환경 설정 (민감 정보 포함)
73-
3. **application-prod.properties**: 운영 환경 설정
66+
### 전체 구조
67+
```
68+
isitempty_backend/
69+
├── src/
70+
│ ├── main/
71+
│ │ ├── java/
72+
│ │ │ └── com.isitempty/
73+
│ │ │ ├── backend/
74+
│ │ │ │ ├── camera/ # 단속 카메라 관리
75+
│ │ │ │ ├── favorite/ # 즐겨찾기 기능
76+
│ │ │ │ ├── oauthlogin/ # 소셜 로그인
77+
│ │ │ │ ├── parkinglot/ # 주차장 관리
78+
│ │ │ │ ├── question/ # 문의사항
79+
│ │ │ │ ├── review/ # 리뷰 시스템
80+
│ │ │ │ └── toilet/ # 화장실 정보
81+
│ │ │ └── config/ # 시스템 설정
82+
│ │ └── resources/ # 리소스 파일
83+
│ └── test/ # 테스트 코드
84+
└── build.gradle # 빌드 설정
85+
```
7486

75-
### 개발 환경 설정하기
87+
### 주요 컴포넌트
7688

77-
1. `src/main/resources/application-dev.properties.example` 파일을 복사하여 같은 위치에 `application-dev.properties` 파일을 생성합니다.
78-
2. 생성한 파일에서 다음 설정값을 실제 값으로 변경합니다:
79-
```properties
80-
# 개발 환경 설정
89+
1. 🔐 **인증/인가 시스템**
90+
- OAuth2.0 기반 소셜 로그인 (Google, Naver, Kakao)
91+
- JWT 토큰 기반 인증
92+
- 사용자 권한 관리 (USER, ADMIN)
8193

82-
# MySQL
83-
spring.datasource.url=
84-
spring.datasource.username=
85-
spring.datasource.password=
86-
87-
# Redis
88-
spring.data.redis.host=
89-
spring.data.redis.port=
90-
spring.data.redis.password=
91-
92-
# 서울시 API 키
93-
seoul.key=
94-
95-
# SSH 터널링 설정
96-
ssh.host=
97-
ssh.port=
98-
ssh.username=
99-
ssh.password=
100-
ssh.remote.host=
101-
ssh.remote.port=
102-
ssh.local.port=
103-
ssh.enabled=
104-
105-
# Redis 터널링 설정
106-
ssh.redis.remote.host=
107-
ssh.redis.remote.port=
108-
ssh.redis.local.port=
109-
```
94+
2. 🅿️ **주차장 관리 시스템**
95+
- 실시간 주차장 정보 조회
96+
- 주차장 검색 및 필터링
97+
- 즐겨찾기 기능
11098

111-
> **중요**: `application-dev.properties` 파일은 `.gitignore`에 추가되어 있어 Git에 커밋되지 않습니다. .env의 역할을 한다고 생각하면 됩니다.
99+
3.**리뷰 시스템**
100+
- 주차장 리뷰 작성/수정/삭제
101+
- 리뷰 평점 관리
112102

113-
## 🔄 프로필(개발 환경)
103+
4. 💾 **데이터 캐싱**
104+
- Redis를 활용한 실시간 데이터 캐싱
105+
- 성능 최적화
114106

115-
애플리케이션은 다음 프로필을 지원합니다:
107+
5. 🔒 **보안 설정**
108+
- CORS 설정
109+
- Spring Security 기반 보안 구성
110+
- SSH 터널링 지원
116111

117-
| 프로필 | 설명 |
118-
|--------|------|
119-
| `dev` | 개발 환경 (기본값) |
120-
| `prod` | 운영 환경 |
112+
## 🔌 API 엔드포인트
121113

122-
## 🧪 API 테스트
114+
### 인증
115+
- 🔑 POST `/api/auth/login`: 로그인
116+
- ✨ POST `/api/auth/signup`: 회원가입
117+
- 👤 GET `/api/auth/me`: 현재 사용자 정보 조회
123118

124-
애플리케이션이 실행되면 다음 URL로 API를 테스트할 수 있습니다:
119+
### 주차장
120+
- 📋 GET `/api/parkinglots`: 주차장 목록 조회
121+
- 🔍 GET `/api/parkinglots/{id}`: 특정 주차장 정보 조회
122+
- ⚡ GET `/api/parkinglots/realtime`: 실시간 주차장 정보 조회
125123

126-
- 주차장 목록: [http://localhost:8080/api/parking-lots](http://localhost:8080/api/parking-lots)
124+
### 리뷰
125+
- ✏️ POST `/api/reviews`: 리뷰 작성
126+
- 📝 PUT `/api/reviews/{id}`: 리뷰 수정
127+
- 🗑️ DELETE `/api/reviews/{id}`: 리뷰 삭제
127128

128-
## ⚠️ 문제 해결
129+
### 즐겨찾기
130+
- ⭐ POST `/api/favorites`: 즐겨찾기 추가
131+
- 💫 DELETE `/api/favorites/{id}`: 즐겨찾기 삭제
132+
- 📑 GET `/api/favorites`: 즐겨찾기 목록 조회
129133

130-
### 1. SSH 터널링 오류
134+
### 관리자
135+
- 👥 GET `/api/admin/users`: 사용자 목록 조회
136+
- 🔄 PUT `/api/admin/users/{id}`: 사용자 정보 수정
137+
- 🗑️ DELETE `/api/admin/users/{id}`: 사용자 삭제
138+
- 👑 PATCH `/api/admin/users/{id}/role`: 사용자 권한 변경
131139

132-
오류 메시지: `PortForwardingL: local port 3307 cannot be bound.`
140+
## ⚙️ 개발 환경 설정
133141

134-
**[해결 방법]**
142+
1. 필수 요구사항
143+
- ☕ JDK 17 이상
144+
- 🐬 MySQL 8.0
145+
- 🔄 Redis
146+
- 🐳 Docker (선택사항)
135147

136-
1. 이미 실행 중인 SSH 터널이 있는지 확인
137-
```bash
138-
$ ps aux | grep ssh
148+
2. 환경변수 설정
149+
```properties
150+
# application-dev.properties
151+
spring.datasource.url=jdbc:mysql://localhost:3306/isitempty
152+
spring.datasource.username=your_username
153+
spring.datasource.password=your_password
154+
155+
spring.data.redis.host=localhost
156+
spring.data.redis.port=6379
157+
spring.data.redis.password=your_redis_password
158+
159+
seoul.key=your_seoul_api_key
139160
```
140161

141-
2. 다른 프로세스가 3307 포트를 사용 중인지 확인
162+
3. 빌드 및 실행
142163
```bash
143-
$ lsof -i :3307
164+
# 프로젝트 빌드
165+
./gradlew build
166+
167+
# 애플리케이션 실행
168+
./gradlew bootRun
144169
```
145170

146-
3. 다른 로컬 포트 사용 (예: 3308)
171+
4. Docker 실행
147172
```bash
148-
$ ssh -L 3307:172.19.0.3:3306 [email protected]
173+
# Docker 이미지 빌드
174+
docker build -t isitempty-backend .
175+
176+
# Docker 컨테이너 실행
177+
docker-compose up
149178
```
150179

151-
### 2. 데이터베이스 연결 오류
180+
## 🚀 배포
152181

153-
오류 메시지: `Communications link failure`
182+
GitHub Actions를 통한 자동 배포가 구성되어 있습니다:
183+
1. main 브랜치에 push 시 자동 빌드
184+
2. 테스트 실행
185+
3. Docker 이미지 빌드 및 푸시
186+
4. 운영 서버 배포
154187

155-
**[해결 방법]**
188+
## 📊 모니터링
156189

157-
1. SSH 터널이 활성화되어 있는지 확인
158-
```bash
159-
ps aux | grep ssh
160-
```
161-
162-
2. 데이터베이스 자격 증명이 올바른지 확인
163-
```bash
164-
mysql -h 127.0.0.1 -P 3307 -u isitempty -p
165-
```
166-
167-
## 📁 프로젝트 구조
190+
- 📝 로깅 레벨 설정을 통한 모니터링
191+
- 📈 실시간 데이터 처리 상태 모니터링
192+
- 🚨 에러 로깅 및 추적
168193

169-
```
170-
backend/
171-
├── src/main/java/com/isitempty/
172-
│ ├── IsitemptyApplication.java # 애플리케이션 진입점
173-
│ ├── config/
174-
│ │ ├── SshTunnelConfig.java # SSH 터널링 설정
175-
│ │ ├── EnvTest.java # 환경 변수 테스트
176-
│ │ └── EnvTest2.java # 시스템 환경 변수 테스트
177-
│ └── backend/
178-
│ ├── hello/
179-
│ │ └── HelloController.java # 테스트용 컨트롤러
180-
│ └── parkinglot/
181-
│ ├── controller/ # 주차장 API 컨트롤러
182-
│ ├── model/ # 주차장 데이터 모델
183-
│ ├── repository/ # 주차장 데이터 접근 계층
184-
│ └── service/ # 주차장 비즈니스 로직
185-
├── src/main/resources/
186-
│ ├── application.properties # 기본 애플리케이션 설정
187-
│ ├── application-dev.properties # 개발 환경 설정
188-
│ └── application-prod.properties # 운영 환경 설정
189-
└── scripts/
190-
└── setup-ssh-tunnel.sh # SSH 터널 설정 스크립트
191-
```
194+
## 📜 라이선스
192195

193-
## 📚 참고 자료
196+
This project is licensed under the MIT License - see the LICENSE file for details
194197

195-
- [Spring Boot 문서](https://docs.spring.io/spring-boot/docs/current/reference/html/)
196-
- [MySQL 문서](https://dev.mysql.com/doc/)
197-
- [SSH 터널링 가이드](https://www.ssh.com/academy/ssh/tunneling)
198+
## 📞 연락처
198199

199-
---
200+
프로젝트 관련 문의사항은 아래 채널을 통해 연락주세요:
200201

201-
© 2025 IsItempty Team
202+
- 이메일: [email protected]
203+
- 웹사이트: https://isitempty.kr
204+
- GitHub: https://github.com/isitempty

0 commit comments

Comments
 (0)