# FineCure Frontend

Nuxt 3 프론트엔드 프로젝트입니다.

## 운영 기준

- 서버 경로: `/var/www/front/finecure`
- 실행 포트: `5700`
- 공개 도메인: `https://fincure.officialsite.kr`
- API 대상: `https://api.fincure.officialsite.kr/api`
- PM2 앱 이름: `finecure-front`

## 로컬 실행

```bash
npm install
npm run dev
```

기본 개발 서버는 Nuxt 설정 기준 `3000` 포트입니다.

## 프로덕션 빌드

```bash
npm install
npm run build
```

## GitHub Actions 자동배포

워크플로우 파일:

- [`.github/workflows/deploy.yml`](d:/works/kscompany/finecure/.github/workflows/deploy.yml)

동작 방식:

1. `main` 또는 `live` 브랜치에 push
2. GitHub Actions가 서버에 SSH 접속
3. `/var/www/front/finecure` 에 최신 코드 반영
4. `.env` 생성
5. `npm install`
6. `npm run build`
7. PM2 `finecure-front` 재기동

필요한 GitHub Secrets:

- `SERVER_HOST`
- `SERVER_USER`
- `SERVER_PORT`
- `SERVER_SSH_KEY`

## 환경변수

로컬/운영 예시는 [`.env.example`](d:/works/kscompany/finecure/.env.example)에 있습니다.

현재 운영 기준 값:

```env
NODE_ENV=production
PORT=5700
API_BASE=https://api.fincure.officialsite.kr/api
NUXT_PUBLIC_API_BASE=https://api.fincure.officialsite.kr/api
TOSS_CLIENT_KEY=
NUXT_PUBLIC_TOSS_CLIENT_KEY=
NUXT_TELEMETRY_DISABLED=1
```

## PM2

설정 파일:

- [`ecosystem.config.cjs`](d:/works/kscompany/finecure/ecosystem.config.cjs)

수동 실행 예시:

```bash
cd /var/www/front/finecure
pm2 startOrReload ecosystem.config.cjs --env production
pm2 save
```

## Apache 설정

SSL은 부모 호스트에서 처리하고, 이 서버는 Apache `VirtualHost *:80` 로 프록시하는 기준입니다.

파일명 예시:

- `/etc/apache2/sites-available/fincure.officialsite.kr.conf`

권장 설정:

```apache
<VirtualHost *:80>
    ServerName fincure.officialsite.kr

    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:5700/
    ProxyPassReverse / http://127.0.0.1:5700/

    ErrorLog ${APACHE_LOG_DIR}/finecure-error.log
    CustomLog ${APACHE_LOG_DIR}/finecure-access.log combined
</VirtualHost>
```

적용 명령:

```bash
sudo a2enmod proxy proxy_http
sudo a2ensite fincure.officialsite.kr.conf
sudo apache2ctl configtest
sudo systemctl reload apache2
```

## 배포 확인

```bash
pm2 status
pm2 logs finecure-front --lines 100
curl -I http://127.0.0.1:5700
```
