# Enchun.tw Website Migration - Product Requirements Document

**Status:** Active
**Version:** v4 (Brownfield Migration)
**Last Updated:** 2025-01-29
**Project:** Enchun CMS System Migration

---

## 📋 Quick Navigation

**📘 Complete PRD:** See [`docs/prd.md`](./docs/prd.md) for the full documentation structure

**Key Sections:**
- [Project Analysis](./docs/prd/01-project-analysis.md) - Background and scope
- [Requirements](./docs/prd/02-requirements.md) - Functional and non-functional requirements
- [UI Enhancement Goals](./docs/prd/03-ui-enhancement-goals.md) - Design system and pages
- [Technical Constraints](./docs/prd/04-technical-constraints.md) - Architecture and integration
- [Epic and Stories](./docs/prd/05-epic-stories.md) - Detailed user stories

**Archived Documentation:**
- [Legacy PRD v1](./docs/archive/PRD-v1-legacy.md) - Original PRD with Auth.js references (archived 2025-01-29)

---

## 🎯 Executive Summary

This document defines the requirements for migrating the existing `enchun.tw` website from Webflow CMS to a modern architecture using **Payload CMS** and **Astro (SSR)**.

### Migration Objectives

- ✅ Migrate 7 main pages + 35+ blog articles + 4 categories
- ✅ Implement **Payload CMS built-in authentication** (Admin/Editor roles)
- ✅ Achieve Lighthouse 95+ performance scores
- ✅ Deploy to Cloudflare infrastructure
- ✅ Maintain 95%+ visual fidelity to original Webflow design
- ✅ Preserve SEO value with 301 redirects

### Technology Stack

| Component | Technology |
|-----------|------------|
| **Frontend** | Astro 4.x (SSR mode) + Tailwind CSS |
| **Backend/CMS** | Payload CMS 3.x + MongoDB |
| **Authentication** | ✅ Payload CMS built-in (NOT Auth.js) |
| **Storage** | Cloudflare R2 |
| **Deployment** | Cloudflare Pages (frontend) + Workers (backend) |

---

## 🚀 Migration Priority

| Priority | Scope | Estimated Time |
|----------|-------|----------------|
| **P0** | Header, Footer, Home, Contact | 19-28h |
| **P1** | About, Solutions, Teams, Portfolio | 24-32h |
| **P2** | Blog system (list, categories, articles) | 30-44h |

**Total Estimate:** 120-160 hours (7 weeks for 1-2 developers)

---

## 📊 Key Requirements Summary

### Functional Requirements (Highlights)
- **FR3:** Payload CMS built-in authentication system ✅
- **FR4:** Migrate 35+ articles and 4 categories
- **FR6:** Complete 301 redirect mappings
- **FR12:** Responsive design across all devices

### Non-Functional Requirements (Highlights)
- **NFR1:** Lighthouse scores 95+ (all public pages)
- **NFR2:** FCP < 1.5s, LCP < 2.5s
- **NFR3:** WCAG 2.1 AA compliance
- **NFR10:** 80%+ test coverage

---

## 🔑 Authentication System Clarification

**❌ INCORRECT (Legacy Documentation):**
> "The site will use Auth.js (`astro-auth`) to handle user authentication."

**✅ CORRECT (Actual Implementation):**
> "The site will use **Payload CMS built-in authentication system** with cookie-based sessions."

### Key Differences
- Payload CMS handles Users collection directly
- Cookie-based sessions via HTTP-only cookies
- `/api/users/login` endpoint provided by Payload
- RBAC through Payload's access control functions

---

## 📂 Document Structure

```
website-enchun-mgr/
├── PRD.md                          # This file (overview)
├── docs/
│   ├── prd.md                      # Main PRD index
│   ├── prd/
│   │   ├── 01-project-analysis.md
│   │   ├── 02-requirements.md
│   │   ├── 03-ui-enhancement-goals.md
│   │   ├── 04-technical-constraints.md
│   │   └── 05-epic-stories.md
│   └── archive/
│       └── PRD-v1-legacy.md        # Old PRD with Auth.js references
├── cms_structure.md                # CMS collection reference
└── research/
    └── www.enchun.tw/              # Original Webflow HTML files
```

---

## 🎯 Success Criteria

The migration will be considered successful when:

1. ✅ All 7 main pages are migrated with 95%+ visual fidelity
2. ✅ All content (35+ articles, portfolio items) is accessible
3. ✅ Authentication system works (Admin/Editor roles)
4. ✅ Lighthouse scores 95+ on all public pages
5. ✅ 301 redirects preserve SEO traffic
6. ✅ Contact form submissions work correctly
7. ✅ Website is deployed and accessible at www.enchun.tw

---

## 📞 Quick Links

- **CMS Structure:** [`cms_structure.md`](./cms_structure.md)
- **Original Website:** [`research/www.enchun.tw/`](./research/www.enchun.tw/)
- **Full PRD:** [`docs/prd.md`](./docs/prd.md)

---

**Document maintained by:** Product Manager (PM Agent)
**Last Updated:** 2025-01-29
