Important AWS Secrets Required
Before deploying, add these secrets to your GitHub repository:
| Secret | Description | Example |
|---|---|---|
NEXT_PUBLIC_API_URL | Backend API URL | https://api.pixora.io |
NEXT_PUBLIC_SITE_URL | Frontend site URL | https://pixora.io |
NEXT_PUBLIC_CLOUDFRONT_DOMAIN | CloudFront domain | d1bfw6cejuxgtj.cloudfront.net |
Lambda Setup (One-Time)
Before the first deployment, create the Lambda function:
JavaScript
cd client/infrastructure
# Create placeholder zip
echo "" | zip placeholder.zip -
# Initialize and apply Terraform
terraform init
terraform applyThis creates:
- Lambda function:
pixora-nextjs-ssr - IAM role with S3 and CloudWatch permissions
- Lambda Function URL for CloudFront origin
CloudFront Configuration
After Lambda is created, configure CloudFront behaviors:
- Default behavior → Lambda Function URL origin
/_next/static/*→ S3 origin (static assets)/api/*→ EKS backend origin
Local Development
JavaScript
npm install
npm run devBuild
JavaScript
# Standard Next.js build
npm run build
# OpenNext build for AWS
npm run build:open-nextDeployment
Deployments are automated via GitHub Actions when pushing to main branch.
Manual deployment:
JavaScript
npm run build:open-next
# Deploy Lambda
cd .open-next/server-function
zip -r ../../lambda.zip .
aws lambda update-function-code \
--function-name pixora-nextjs-ssr \
--zip-file fileb://../../lambda.zip
# Deploy static assets
aws s3 sync .open-next/assets s3://imageopt-website-329599656829-us-east-1/_nextwork ci/cd