Files
brachnha-insight/DEPLOYMENT.md
Max 3fbbb1a93b Initial commit: Brachnha Insight project setup
- Next.js 14+ with App Router and TypeScript
- Tailwind CSS and ShadCN UI styling
- Zustand state management
- Dexie.js for IndexedDB (local-first data)
- Auth.js v5 for authentication
- BMAD framework integration

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-26 12:28:43 +07:00

72 lines
3.0 KiB
Markdown

# Deployment Instructions - Test01
This guide provides instructions for deploying the **Test01** application to production environments.
## Prerequisites
- **Node.js**: v18 or higher
- **npm**: v9 or higher
- **Vercel Account** (Recommended for hosting)
## Environment Variables
Ensure the following environment variables are configured in your production environment:
| Variable | Description | Default / Example |
| :--------------------------- | :----------------------------- | :------------------------ |
| `NEXT_PUBLIC_AI_PROVIDER` | Default AI Provider (optional) | `gemini` |
| `NEXT_PUBLIC_GEMINI_API_KEY` | Initial API Key (optional) | `AIzaSy...` |
| `NEXT_PUBLIC_API_URL` | API Base URL (if custom) | `https://api.example.com` |
> **Note:** The application uses a local-first architecture (IndexedDB), so no external database connection strings (Postgres/MySQL) are required for the core journaling features.
## Deployment Options
### Option 1: Vercel (Recommended)
Vercel provides the best support for Next.js applications, including PWA headers and caching.
1. **Push to GitHub**: Ensure your code is pushed to a remote repository.
2. **Import Project**: Go to [Vercel Dashboard](https://vercel.com/new) and import your repository.
3. **Configure**:
- **Framework Preset**: Next.js
- **Build Command**: `next build`
- **Output Directory**: `.next`
- **Environment Variables**: Add any keys defined above.
4. **Deploy**: Click "Deploy".
Vercel will automatically detect the `manifest.webmanifest` and service worker configurations.
### Option 2: Docker / Custom Server
To deploy as a standalone Node.js application:
1. **Build the application**:
```bash
npm run build
```
2. **Start the server**:
```bash
npm start
```
The app will be available at `http://localhost:3000`.
**Docker Strategy:**
You can use the official [Next.js Docker example](https://github.com/vercel/next.js/tree/canary/examples/with-docker) for a containerized deployment.
## Troubleshooting
### Build Failures
- **Google Fonts / Network Errors**: The build process requires internet access to download fonts from Google. If building in a restricted environment (like a corporate firewall or offline CI), you may see TLS/Network errors.
- *Workaround*: Set `NEXT_TURBOPACK_EXPERIMENTAL_USE_SYSTEM_TLS_CERTS=1` or temporarily disable `next/font/google` in `src/app/layout.tsx`.
- **Manifest Errors**: If you see `manifest.ts` type errors, ensure you are using a compatible Next.js version (14+ recommended) or check `purpose` fields in icon definitions.
### PWA Verification
After deployment, verify the PWA features:
1. Open the deployed URL (e.g., `https://test01.vercel.app`) on a mobile device or Chrome.
2. Look for the "Install Test01" prompt (bottom banner) or the Install icon in the address bar.
3. Install the app and verify it opens in standalone mode.
4. Disconnect internet and verify you can still create/save drafts (Offline support).