아키텍처 개요
딸깍문서는 현대적인 웹 기술 스택을 기반으로 구축된 AI 기반 문서 편집 플랫폼입니다.
시스템 아키텍처
flowchart TB
subgraph Client["클라이언트"]
Browser["웹 브라우저"]
Editor["TipTap 에디터"]
AISidebar["AI 사이드바"]
end
subgraph NextJS["Next.js 서버"]
AppRouter["App Router"]
APIRoutes["API Routes"]
Auth["NextAuth.js"]
end
subgraph External["외부 서비스"]
Anthropic["Anthropic Claude"]
Supabase["Supabase"]
Storage["Supabase Storage"]
end
Browser --> AppRouter
Editor --> APIRoutes
AISidebar --> APIRoutes
APIRoutes --> Auth
APIRoutes --> Anthropic
APIRoutes --> Supabase
APIRoutes --> Storage
핵심 컴포넌트
1. 프론트엔드 레이어
| 컴포넌트 | 역할 | 기술 |
|---|---|---|
| App Shell | 전체 레이아웃 및 라우팅 | Next.js App Router |
| Document Editor | 문서 편집 인터페이스 | TipTap (ProseMirror) |
| AI Sidebar | AI 대화 인터페이스 | React, Streaming |
| PDF Viewer | PDF 미리보기 및 편집 | react-pdf, pdf-lib |
2. API 레이어
주요 API 엔드포인트:
/api/document/
├── route.ts # CRUD 기본 동작
├── [id]/route.ts # 개별 문서 조작
├── complete-stream/ # AI 스트리밍 응답
├── upload/ # 파일 업로드
├── export/ # 문서 내보내기
└── export-pdf/ # PDF 변환
/api/pdf/
├── detect-blanks/ # AI 빈칸 감지
├── fill-blanks/ # 빈칸 채우기
├── extract-fields/ # 필드 추출
└── ocr-region/ # 영역 OCR
/api/ocr/
├── claude-vision/ # 단일 이미지 OCR
└── claude-vision-batch/ # 배치 OCR
3. 데이터 레이어
erDiagram
User ||--o{ Document : creates
Document ||--o{ DocumentVersion : has
Document ||--o{ DocumentFile : contains
Document ||--o{ Prompt : has
User ||--o{ PdfBlanks : creates
User {
string id PK
string email
string name
boolean isPremium
}
Document {
string id PK
string title
text content
string documentType
string userId FK
timestamp createdAt
timestamp updatedAt
}
DocumentVersion {
string id PK
string documentId FK
text content
int versionNumber
timestamp createdAt
}
Prompt {
string id PK
string documentId FK
text userPrompt
text aiResponse
json suggestions
timestamp createdAt
}