Bước cuối cùng là deploy frontend Next.js 15 lên AWS Amplify với tích hợp GitLab để tự động deploy khi có code mới.
1. Check Frontend Structure
cd frontend
# Check package.json
cat package.json
# Should show Next.js 15
2. Test Frontend Locally
# Install dependencies
npm install
# Run development server
npm run dev
# Open http://localhost:3000
3. Build Frontend
# Build for production
npm run build
# Test production build
npm start
1. Go to AWS Amplify Console
2. Connect to GitLab
Screenshot: Amplify showing GitLab connection
3. Select Repository
everyonecookmain (or dev for development)1. App Name
App name: everyonecook-frontend
2. Build Settings
Amplify auto-detects Next.js, but verify:
version: 1
applications:
- frontend:
phases:
preBuild:
commands:
- export HUSKY=0
- npm install --legacy-peer-deps --ignore-scripts
build:
commands:
- echo "=== Creating .env.production from Amplify env vars ==="
- rm -f .env.production
- env | grep -e NEXT_PUBLIC_ > .env.production || true
- echo "=== .env.production content ==="
- cat .env.production
- echo "=== Building frontend ==="
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
- .next/cache/**/*
appRoot: frontend
3. Advanced Settings
Add environment variables:
NEXT_PUBLIC_API_URL=https://api.everyonecook.cloud
NEXT_PUBLIC_CDN_URL=https://cdn.everyonecook.cloud
NEXT_PUBLIC_USER_POOL_ID=us-east-1_ABC123
NEXT_PUBLIC_USER_POOL_CLIENT_ID=abc123def456
NEXT_PUBLIC_REGION=us-east-1
Screenshot: Amplify environment variables configuration
1. Start Deployment
Click “Save and deploy”
Amplify will:
2. Monitor Deployment
Watch deployment progress:
3. Wait for Completion
Deployment takes 5-10 minutes.
Screenshot: Amplify showing successful deployment
1. Add Custom Domain
everyonecook.cloudeveryonecook.cloudwww.everyonecook.cloud2. DNS Configuration
Amplify automatically creates DNS records in Route 53:
everyonecook.cloud → A record → Amplify
www.everyonecook.cloud → CNAME → Amplify
3. SSL Certificate
Amplify automatically provisions SSL certificate via ACM.
4. Wait for DNS Propagation
Takes 5-15 minutes.
Screenshot: Amplify showing custom domain configured
1. Access Frontend
# Via Amplify domain
curl -I https://main.d1234567890.amplifyapp.com
# Via custom domain
curl -I https://everyonecook.cloud
# Should return 200 OK
2. Test Frontend Features
Screenshot: Browser showing EveryoneCook frontend live
Congratulations! Your application is now fully deployed:
Proceed to Cleanup when you’re done testing, or start using your application!