[프로젝트] 간단한 CRM 시스템 — 백엔드 구현 (Spring Boot)

Nolrimbo·2025년 9월 21일

포트폴리오

목록 보기
19/21

핵심 요약

  • 🎯 기능: 고객(Customer) · 미팅(Meeting) · 리마인더(Reminder) CRUD, “다가올 리마인더(7일)” 조회, 완료 처리
  • 🧱 스택: Spring Boot 3, Spring Web, Spring Data JPA, Validation, Lombok, MariaDB, springdoc-openapi
  • 🔗 문서: Swagger UI (springdoc)
  • 🗄️ DB: MariaDB (ddl-auto=update, 운영 전환 시 Flyway 권장)

폴더 구조

├─ config # CORS 등 공통 설정
├─ common/exception # 예외/전역 핸들러
├─ customer {controller, dto, entity, repository, service}
├─ meeting {controller, dto, entity, repository, service}
└─ reminder {controller, dto, entity, repository, service}

Gradle & 설정

build.gradle (요지)

implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
runtimeOnly  'org.mariadb.jdbc:mariadb-java-client'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.9'

application.properties

server.port=8080
spring.datasource.url=jdbc:mariadb://localhost:3306/crm?useUnicode=true&characterEncoding=utf8
spring.datasource.username=crm
spring.datasource.password=crm123
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
springdoc.api-docs.enabled=true
springdoc.swagger-ui.enabled=true
# 필요 시 UI 경로 고정
# springdoc.swagger-ui.path=/swagger-ui

데이터 모델(요약)

  • Customer: id, type(COMPANY|PERSON), name, email, phone, owner, createdAt, updatedAt
  • Meeting: id, customer_id(FK), meetingAt, title, notes, createdAt
  • Reminder: id, customer_id(FK), dueDate, note, status(PENDING|DONE), doneAt, createdAt

REST API 요약

Customers

  • POST /api/customers 생성
  • GET /api/customers?q=&page=&size=&sort=updatedAt,desc 목록(검색/정렬/페이징)
  • GET /api/customers/{id} 상세
  • PUT /api/customers/{id} 수정
  • DELETE /api/customers/{id} 삭제

Meetings

  • POST /api/meetings 생성
  • GET /api/customers/{id}/meetings?page=&size=&sort=meetingAt,desc
  • DELETE /api/meetings/{id}

Reminders

  • POST /api/reminders 생성
  • GET /api/customers/{id}/reminders?page=&size=
  • GET /api/reminders/upcoming?days=7 다가올 리마인더
  • PATCH /api/reminders/{id}/done 완료 처리
  • PATCH /api/reminders/{id} (마감일/메모 수정)
  • DELETE /api/reminders/{id}

실행 & 스모크 테스트

./gradlew bootRun
# Swagger UI
# - http://localhost:8080/swagger-ui.html
# - 또는 http://localhost:8080/swagger-ui/index.html
# OpenAPI JSON: http://localhost:8080/v3/api-docs

# 고객 생성
curl -s -X POST http://localhost:8080/api/customers \
 -H "Content-Type: application/json" \
 -d '{"name":"Acme Co","type":"COMPANY","email":"sales@acme.com","owner":"홍상화"}' | jq

# 리마인더 생성
curl -s -X POST http://localhost:8080/api/reminders \
 -H "Content-Type: application/json" \
 -d '{"customerId":1,"dueDate":"2025-09-21","note":"견적서 재전송"}' | jq

# 다가올 리마인더(7일)
curl -s "http://localhost:8080/api/reminders/upcoming?days=7" | jq

# 완료 처리
curl -s -X PATCH http://localhost:8080/api/reminders/1/done -i

백로그(선택 개선)

  • Meeting 단건 조회/수정, Reminder 일괄 완료, 응답 DTO 도입, 인덱스 최적화, Actuator, JWT(담당자별 데이터 분리), Flyway
profile
Java 개발자 | 사이드 프로젝트 마니아 | GPT 기반 자동화 툴 연구 중 기술 리뷰, 개발일지

0개의 댓글