Skip to content

Repository files navigation

🌱 GreenCoach

GreenCoach Logo

분리배출, 오늘부터 함께 시작해요

Android Kotlin Spring Boot Jetpack Compose

개발 환경FeaturesScreenshots개발 팀향후 계획Tech StackArchitectureInstallationAPI Documentation


📖 Overview

GreenCoach는 AI 기술을 활용하여 올바른 분리배출을 돕는 환경 보호 앱입니다. 사용자가 쓰레기를 촬영하면 AI가 자동으로 분류하고, 올바른 배출 방법을 안내합니다. 또한 분리배출 활동을 기록하며 나만의 숲을 키우고, 커뮤니티에서 환경 실천 경험을 공유할 수 있습니다.

개발 기간

  • 2025년 7월 ~ 2025년 11월 (약 4개월)
  • Sprint 기반 Agile 개발 방식 적용

팀 구성

  • 2인 팀 프로젝트
    • Full-stack 개발 (Backend + Android)
    • AI 모델 통합 및 UI/UX 디자인

개발 목적

  • 환경부 분리배출 가이드라인 기반 실용적인 솔루션 제공
  • AI 기술을 활용한 사용자 편의성 극대화
  • 커뮤니티 기반 지속가능한 습관 형성 지원

🎯 Key Highlights

  • 🤖 AI-Powered Waste Classification: ONNX/TensorFlow Lite 기반 실시간 분류
  • 📸 Camera Scan: 쓰레기 촬영만으로 즉시 분류 및 가이드 제공
  • 🌳 Gamification: 분리배출 횟수에 따라 성장하는 나만의 숲
  • 📊 CO2 Visualization: 전세계/한국/내 CO2 배출량 비교 차트
  • 👥 Community: 환경 실천 경험 공유 및 소통
  • 📚 Comprehensive Guide: 14개 카테고리, 80+ 세부 품목별 상세 가이드

💻 개발 환경

Backend

구분 내용
IDE IntelliJ IDEA 2024.1+
JDK OpenJDK 17 (Eclipse Temurin)
Build Tool Gradle 8.13 (Kotlin DSL)
Database H2 (개발) / MySQL 8.0 (프로덕션 예정)
Server Embedded Tomcat 10.1

Frontend (Android)

구분 내용
IDE Android Studio Ladybug (2024.2.1)
Language Kotlin 2.1.21
Compile SDK API 36 (Android 14+)
Min SDK API 24 (Android 7.0)
Target SDK API 36
Gradle 8.13

협업 도구

- 버전 관리: Git / GitHub
- 이슈 트래킹: GitHub Issues
- 문서화: GitHub Wiki, Notion
- 커뮤니케이션: Discord

✨ Features

1. 🏠 Home - 카테고리 & 뉴스

Home
  • 14개 분리배출 카테고리 빠른 접근
  • 실시간 환경 뉴스 (Naver News API 연동)
  • 검색 기능: 키워드로 빠르게 품목 찾기
  • 인기 해시태그: 자주 검색된 항목 표시

2. 🌳 Forest - 나만의 숲 키우기

Forest

성장 단계 (Leafs 기반):

  • 🌱 Seed (0-10 leafs): 씨앗 단계
  • 🌿 Sprout (11-20 leafs): 새싹이 돋아남
  • 🌾 Sapling (21-30 leafs): 어린 나무
  • 🌲 Growing Tree (31-50 leafs): 무럭무럭 자라는 중
  • 🌳 Mature Tree (51-70 leafs): 성숙한 나무
  • 🍎 Fruit-bearing Tree (71+ leafs): 열매 맺은 나무

CO2 데이터:

  • 📈 세계/한국/나의 CO2 배출량 및 감소량 비교
  • 📊 Our World in Data 실시간 데이터 연동

3. 📸 Scan - AI 분류

스캔
  • AI 기반 자동 분류: 이미지 업로드 시 실시간 분석
  • 신뢰도 표시: AI 예측 정확도 퍼센트
  • 상세 가이드 연결: "Read More"로 세부 배출 방법 확인
  • 히스토리 관리: 최근 스캔 내역 저장 및 조회
  • Leafs 획득: 스캔할 때마다 포인트 적립

4. ♻️ Category - 상세 가이드

카테고리

카테고리별 가이드:

  • 투명 페트병, 플라스틱, 비닐류, 스티로폼
  • 캔류, 고철류, 유리병, 종이류
  • 섬유류, 대형/소형 전자제품, 가구, 전지류, 음식물

세부 품목 (80+):

  • 각 카테고리당 3-7개 대표 품목
  • 단계별 배출 방법 (Step by Step)
  • ❌ 잘못된 배출 예시

5. 👥 Community - 경험 공유

Community Feed Community Comments

  • 피드: 환경 실천 경험 공유
  • 좋아요 & 댓글: 실시간 상호작용
  • 알림: 좋아요/댓글/답글 알림
  • 북마크: 마음에 드는 게시글 저장
  • 검색: 키워드로 게시글 필터링

6. 👤 Profile - 내 활동

프로필
  • 회원가입/로그인: JWT 기반 인증
  • 내 게시글/저장된 글/댓글: 탭 전환으로 관리
  • 프로필 편집: 닉네임, 생년월일, 성별 수정
  • 소셜 로그인: Naver, Google 연동 (준비 중)

📱 Screenshots

🏠 Home & Search
Home News Search Result
Home
default.mp4
_.mp4
카테고리 · 뉴스 · 해시태그 실시간 환경 뉴스 키워드 검색 결과
검색 결과 없음 (미등록 품목)
Check redundancy
데이터에 없는 품목 검색 시 ‘결과 없음’ 안내
🌳 Forest Growth Stages
Seed Sprout Sapling Growing Tree Mature Tree Fruit-bearing Tree

0%~10%

11%~20%

21%~30%

31%~50%

51%~70%

71%~
📸 Scan & AI Classification
Scan Main Scanning Result Detail Guide
♻️ Category Details
Category
Category.mp4
분리수거 카테고리 15종
👥 Community & Interactions
Feed Comments Notifications Saved Posts
👤 Profile & Authentication
Sign Up Login Profile Home Edit Profile
SignUp_motion.mp4
Login_motion.mp4
회원가입 플로우 · 필드 검증 로그인 플로우 · 일반/소셜 프로필 홈 · 정보/포인트 프로필 편집 · 닉네임/아바타
Nickname Duplication Invalid Input (Generic)
Check redundancy
incorrect_information_entry.mp4
닉네임 중복 검사 잘못된 정보 입력 시 유효성

👥 개발 팀

Team Members (2인)

역할 담당 업무
김하늘 • UI/UX 디자인
• Backend 개발 (Spring Boot, REST API)
• Android 개발 (Jetpack Compose)
• 상태 관리 (ViewModel, StateFlow)
심재학 • AI 개발 및 모델 통합 (ONNX, TFLite)
• 데이터베이스 설계 (JPA, H2)
• 보안 (Spring Security, JWT)
• API 연동 (Retrofit, Hilt)

공동 작업

  • 프로젝트 기획 및 요구사항 분석
  • API 명세 설계
  • 테스트 및 디버깅
  • 문서화 작업

🎯 향후 계획

  • MySQL 마이그레이션 (H2 → Production DB)
  • 소셜 로그인 (Naver, Google) 완성
  • 푸시 알림 (FCM 연동)
  • 포인트 & 리워드 시스템
  • 지역별 분리배출 규칙 커스터마이징
  • AI 모델 고도화 (더 많은 카테고리, 높은 정확도)

🛠 Tech Stack

📱 Android Client

// UI
- Jetpack Compose (Material3)
- Navigation Compose
- Coil (Image Loading)

// Architecture
- MVVM + Repository Pattern
- Hilt (Dependency Injection)
- Kotlin Coroutines & Flow

// Network
- Retrofit + OkHttp
- Gson Converter

// Local Storage
- SharedPreferences (Scan History)
- Room (향후 확장)

// AI/ML (향후)
- TensorFlow Lite
- ONNX Runtime

🔧 Backend (Spring Boot)

// Framework
- Spring Boot 3.5.3
- Kotlin 2.1.21
- Spring Security + JWT

// Database
- JPA/Hibernate
- MySQL (Production)
- H2 (Development)

// External APIs
- Naver News API
- Naver Image Search API
- Our World in Data (CO2)

// AI/ML
- ONNX Runtime (1.20.0)
- TensorFlow Lite (2.12.0)

// Build Tool
- Gradle (Kotlin DSL)

🏗 Architecture

Android App Architecture

frontend/
├── app/src/main/java/com/application/frontend/
│   ├── ui/
│   │   ├── screen/          # Compose Screens
│   │   │   ├── HomeScreen.kt
│   │   │   ├── ForestScreen.kt
│   │   │   ├── ScanScreen.kt
│   │   │   ├── CommunityScreen.kt
│   │   │   └── ProfileScreen.kt
│   │   └── theme/           # Material3 Theme
│   ├── viewmodel/           # ViewModels (MVVM)
│   ├── data/
│   │   ├── repository/      # Data Layer
│   │   └── local/           # Local Storage
│   ├── model/               # Data Models
│   ├── di/                  # Hilt Modules
│   └── navigation/          # Navigation Graph

Backend Architecture

src/main/java/com/greencoach/
├── controller/              # REST Controllers
│   ├── AuthController.kt
│   ├── CategoryController.kt
│   ├── ScanController.kt
│   └── CommunityController.kt
├── service/                 # Business Logic
│   ├── AuthService.kt
│   ├── ScanService.kt
│   ├── Co2Service.kt
│   └── ai/
│       └── OnnxAiEngine.kt
├── model/                   # DTOs & Entities
│   ├── auth/
│   ├── community/
│   └── scan/
├── repository/              # JPA Repositories
└── config/                  # Security, JWT, WebClient

🚀 Installation

Prerequisites

# Android Development
- Android Studio Hedgehog (2023.1.1) or later
- JDK 17 or later
- Android SDK 24+ (API Level 24+)

# Backend Development
- JDK 17 or later
- MySQL 8.0+ (or H2 for local dev)
- Gradle 8.1+

1️⃣ Clone Repository

git clone https://github.com/yourusername/greencoach.git
cd greencoach

2️⃣ Backend Setup

# Navigate to backend
cd backend

# Configure application.yml (or use H2 default)
cp src/main/resources/application.yml.example src/main/resources/application.yml

# Edit application.yml
# - Database credentials
# - JWT secret
# - Naver API credentials

# Build and Run
./gradlew bootRun

# API will be available at http://localhost:8080

Environment Variables (Optional):

# Naver API (for News)
naver.client.id=YOUR_CLIENT_ID
naver.client.secret=YOUR_CLIENT_SECRET

# JWT
jwt.secret=your-secret-key-min-32-bytes-long
jwt.expiresMillis=86400000

# Database
spring.datasource.url=jdbc:mysql://localhost:3306/greencoach
spring.datasource.username=root
spring.datasource.password=yourpassword

3️⃣ Android Setup

# Navigate to frontend
cd frontend

# Open in Android Studio
# File > Open > Select 'frontend' folder

# Configure local.properties
echo "sdk.dir=/path/to/your/Android/Sdk" > local.properties

# Add Naver API keys (optional)
echo "naver.client.id=YOUR_CLIENT_ID" >> gradle.properties
echo "naver.client.secret=YOUR_CLIENT_SECRET" >> gradle.properties

# Sync Gradle
# Build > Make Project

# Run on Emulator/Device
# Run > Run 'app'

Update API Base URL (if needed):

// frontend/app/build.gradle.kts
buildConfigField("String", "BASE_URL", "\"http://10.0.2.2:8080/\"")
// For physical device, use your computer's IP

🧪 Testing

Android Tests

# Unit Tests
./gradlew test

# Instrumented Tests (requires emulator/device)
./gradlew connectedAndroidTest

# Specific test classes
./gradlew test --tests "*ProfileFlowsTest"

Test Coverage:

  • ✅ Login/Sign-up flows
  • ✅ Password reset flows
  • ✅ Category navigation
  • ✅ Scan functionality
  • ✅ Community interactions

Backend Tests

# Run all tests
./gradlew test

# Specific test
./gradlew test --tests com.greencoach.service.AuthServiceTest

📡 API Documentation

Base URL

http://localhost:8080

Authentication

Sign Up

POST /auth/signup
Content-Type: application/json

{
  "nickname": "greenuser",
  "email": "user@example.com",
  "password": "password123"
}

Response: 200 OK
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Login

POST /auth/login
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "password123"
}

Response: 200 OK
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Categories

Get Top Categories

GET /api/categories

Response: 200 OK
[
  {
    "name": "투명 페트병",
    "imageUrl": "/images/icons/pet_bottle.png"
  },
  ...
]

Get Sub Categories

GET /api/categories/{name}/sub

Response: 200 OK
[
  {
    "name": "생수",
    "imageUrl": "/images/sub/pet_water.png"
  },
  ...
]

Scan

Analyze Image

POST /api/scan
Content-Type: multipart/form-data

file: [binary image data]

Response: 200 OK
{
  "items": [
    {
      "label": "plastic_bottle",
      "confidence": 0.87,
      "category": "플라스틱"
    }
  ],
  "model": "onnx-garbage-classifier",
  "processedAt": "2025-01-15T10:30:00Z"
}

CO2 Data

Get World CO2 Data

GET /api/co2/world

Response: 200 OK
{
  "emissions": {
    "label": "World Emissions",
    "points": [
      {"year": 2020, "value": 6500.0},
      {"year": 2021, "value": 6800.0}
    ]
  },
  "reduction": {
    "label": "World Reduction",
    "points": [...]
  }
}

Community

Get Feed

GET /community/feed
Authorization: Bearer {token}

Response: 200 OK
[
  {
    "id": "1",
    "author": {...},
    "createdAt": "2025-01-15T10:00:00Z",
    "text": "오늘 처음으로 투명 페트병 분리배출 성공!",
    "likeCount": 15,
    "commentCount": 3
  }
]
📖 More API Endpoints

Comments

  • GET /community/posts/{postId}/comments - Get comments
  • POST /community/posts/{postId}/comments - Create comment
  • POST /community/comments/{commentId}/like - Like comment
  • DELETE /community/comments/{commentId} - Delete comment

Notifications

  • GET /community/notifications - Get notifications
  • GET /community/notifications/meta - Get unread count
  • POST /community/notifications/read-all - Mark all as read

Profile

  • GET /users/me - Get current user
  • PATCH /users/me - Update profile

🙏 Acknowledgments

  • Our World in Data - CO2 emissions data
  • Naver API - News and image search
  • Material Design 3 - UI/UX guidelines
  • Jetpack Compose - Modern Android UI toolkit
  • All contributors who help improve this project

Made with ❤️ for the Environment

⬆ Back to Top

About

쓰레기 분리수거 애플리케이션 2인 협업 프로젝트

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages