puffin-app/docker-compose.yml
Matt 82f72941ca
Some checks failed
Build and Push Docker Images / docker (push) Failing after 1m58s
Migrate from Vite to Next.js 16 with Turbopack
This is a major migration from Vite to Next.js 16.0.1 for improved
performance, better SEO, and modern React features.

## Next.js Migration Changes
- Upgraded to Next.js 16.0.1 with Turbopack (from Vite 6)
- Migrated from client-side routing to App Router architecture
- Created app/ directory with Next.js page structure
- Added server components and client components pattern
- Configured standalone Docker builds for production

## Bug Fixes - React Hooks
- Fixed infinite loop in Header.tsx scroll behavior (removed lastScrollY state dependency)
- Fixed infinite loop in useCalculatorState.ts (wrapped saveState/clearState in useCallback)
- Fixed infinite loop in OffsetOrder.tsx (removed savedState from useEffect dependencies)
- Removed unused React imports from all client components

## Environment Variable Migration
- Migrated all VITE_ variables to NEXT_PUBLIC_ prefix
- Updated src/utils/config.ts to use direct static references (required for Next.js)
- Updated src/api/checkoutClient.ts, emailClient.ts, aisClient.ts for Next.js env vars
- Updated src/vite-env.d.ts types for Next.js environment
- Maintained backward compatibility with Docker window.env

## Layout & UX Improvements
- Fixed footer to always stay at bottom of viewport using flexbox
- Updated app/layout.tsx with flex-1 main content area
- Preserved glass morphism effects and luxury styling

## TypeScript & Build
- Fixed TypeScript strict mode compilation errors
- Removed unused imports and variables
- Fixed Axios interceptor types in project/src/api/wrenClient.ts
- Production build verified and passing

## Testing & Verification
- Tested calculator end-to-end in Playwright
- Verified Wren API integration working (11 portfolios fetched)
- Confirmed calculation: 5000L → 13.47 tons CO₂ → $3,206 total
- All navigation routes working correctly
- Footer positioning verified across all pages

## Files Added
- app/ directory with Next.js routes
- components/ directory with client components
- next.config.mjs, next-env.d.ts
- ENV_MIGRATION.md, NEXTJS_MIGRATION_COMPLETE.md documentation

## Files Modified
- Docker configuration for Next.js standalone builds
- package.json dependencies (Next.js, React 19)
- ts config.json for Next.js
- All API clients for new env var pattern

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 22:23:45 +01:00

72 lines
2.1 KiB
YAML

version: '3.8'
services:
# Frontend - Next.js App
web:
image: code.puffinoffset.com/matt/puffin-app:frontend-latest
container_name: puffin-frontend
ports:
- "3800:3000"
environment:
- NODE_ENV=production
# Next.js environment variables (NEXT_PUBLIC_ prefix for client-side)
- NEXT_PUBLIC_API_BASE_URL=${NEXT_PUBLIC_API_BASE_URL:-https://api.puffinoffset.com}
- NEXT_PUBLIC_WREN_API_TOKEN=${NEXT_PUBLIC_WREN_API_TOKEN}
- NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=${NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY}
# Backward compatibility fallbacks (remove after migration)
- VITE_API_BASE_URL=${VITE_API_BASE_URL}
- VITE_WREN_API_TOKEN=${VITE_WREN_API_TOKEN}
- VITE_STRIPE_PUBLISHABLE_KEY=${VITE_STRIPE_PUBLISHABLE_KEY}
restart: unless-stopped
networks:
- puffin-network
depends_on:
backend:
condition: service_healthy
# Backend - Express API Server
backend:
image: code.puffinoffset.com/matt/puffin-app:backend-latest
container_name: puffin-backend
ports:
- "3801:3001"
volumes:
- puffin-data:/app/data
environment:
- NODE_ENV=production
- PORT=3001
- FRONTEND_URL=${FRONTEND_URL:-https://puffinoffset.com}
- STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY}
- STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET}
- WREN_API_TOKEN=${WREN_API_TOKEN}
- WREN_DRY_RUN=${WREN_DRY_RUN:-false}
- DATABASE_PATH=/app/data/orders.db
- SMTP_HOST=${SMTP_HOST}
- SMTP_PORT=${SMTP_PORT}
- SMTP_SECURE=${SMTP_SECURE}
- SMTP_USER=${SMTP_USER}
- SMTP_PASSWORD=${SMTP_PASSWORD}
- SMTP_FROM_NAME=${SMTP_FROM_NAME}
- SMTP_FROM_EMAIL=${SMTP_FROM_EMAIL}
- ADMIN_EMAIL=${ADMIN_EMAIL:-matt@puffinoffset.com}
dns:
- 8.8.8.8
- 8.8.4.4
networks:
- puffin-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
puffin-network:
driver: bridge
volumes:
puffin-data:
driver: local