The portal supports deployment to multiple hosting platforms. Each platform has different features, configurations, and pricing models.
Netlify
Automatic deployments with preview URLs
Vercel
Optimized for Next.js applications
AWS S3
Static hosting with CloudFront CDN
Netlify Deployment
Netlify provides automatic deployments from Git with built-in CI/CD.
Configuration
The repository includes a netlify.toml configuration file:
[[headers]]
for = "/_next/image/*"
[headers.values]
Content-Security-Policy= "upgrade-insecure-requests"
Strict-Transport-Security = "max-age=63072000; includeSubDomains; preload"
X-XSS-Protection = "1; mode=block"
X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
Referrer-Policy = "strict-origin-when-cross-origin"
Permissions-Policy= "accelerometer=(self), ambient-light-sensor=(self), ..."
This configuration applies security headers to Next.js image optimization requests.
Deployment Steps
Connect Repository
- Log in to Netlify
- Click “Add new site” → “Import an existing project”
- Connect your Git provider (GitHub, GitLab, Bitbucket)
- Select the portal repository
Configure Build Settings
Set the following build configuration:
- Build command:
npm run build
- Publish directory:
.next
- Node version:
22
Add Environment Variables
In Netlify dashboard, go to Site settings → Environment variables:NEXT_PUBLIC_INFURA_PROJECT_ID=your_infura_id
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_wc_id
NEXT_PUBLIC_METADATACACHE_URI=https://aquarius.pontus-x.eu
NEXT_PUBLIC_MARKET_FEE_ADDRESS=0x...
AGROPORTAL_API_KEY=your_api_key
NEXT_TELEMETRY_DISABLED=1
Deploy
Click “Deploy site”. Netlify will:
- Install dependencies
- Build the application
- Deploy to CDN
- Provide a preview URL
Netlify Features
Every push to your main branch triggers a new deployment automatically.
Pull requests get unique preview URLs for testing before merging.
Deploy specific branches for staging or feature testing.
Add custom domains with automatic HTTPS certificates.
Netlify CLI Deployment
Deploy from command line:
# Install Netlify CLI
npm install -g netlify-cli
# Login to Netlify
netlify login
# Build and deploy
npm run build
netlify deploy --prod
Vercel Deployment
Vercel is optimized for Next.js and offers zero-configuration deployment.
Deployment Steps
Configure Project
Vercel auto-detects Next.js configuration:
- Framework Preset: Next.js
- Build Command:
npm run build (auto-detected)
- Output Directory:
.next (auto-detected)
- Install Command:
npm install
Set Environment Variables
Add environment variables in project settings:NEXT_PUBLIC_INFURA_PROJECT_ID=your_infura_id
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_wc_id
NEXT_PUBLIC_METADATACACHE_URI=https://aquarius.pontus-x.eu
AGROPORTAL_API_KEY=your_api_key
Deploy
Click “Deploy”. Vercel will build and deploy your application with:
- Automatic HTTPS
- Global CDN
- Edge network optimization
Vercel CLI Deployment
Vercel Features
- Edge Functions: Run server-side code at the edge
- Image Optimization: Automatic image optimization
- Analytics: Built-in performance analytics
- Preview Deployments: Unique URL for every commit
AWS S3 + CloudFront
Deploy as a static site with AWS infrastructure.
Prerequisites
- AWS account
- AWS CLI configured
- S3 bucket created
- CloudFront distribution (optional)
Static Export Build
Build Static Export
Generate static HTML files:This creates a public/ directory with exported HTML. Create S3 Bucket
Create and configure S3 bucket:aws s3 mb s3://agrospai-portal
aws s3 website s3://agrospai-portal \
--index-document index.html \
--error-document 404.html
Configure Bucket Policy
Add public read policy:{
"Version": "2012-10-17",
"Statement": [{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::agrospai-portal/*"
}]
}
Apply policy:aws s3api put-bucket-policy \
--bucket agrospai-portal \
--policy file://bucket-policy.json
Upload Files
Sync the public directory:aws s3 sync public/ s3://agrospai-portal \
--delete \
--cache-control "public, max-age=31536000"
CloudFront CDN Setup
Add CloudFront for global CDN distribution:
Create Distribution
aws cloudfront create-distribution \
--origin-domain-name agrospai-portal.s3.amazonaws.com \
--default-root-object index.html
Configure Custom Error Pages
Map 404 errors to index.html for client-side routing:aws cloudfront update-distribution \
--id YOUR_DISTRIBUTION_ID \
--custom-error-responses \
"ErrorCode=404,ResponsePagePath=/index.html,ResponseCode=200"
Add Custom Domain
- Request SSL certificate in ACM
- Add custom domain to distribution
- Update DNS records to point to CloudFront
S3 Deployment Script
Automate deployment with a script:
#!/bin/bash
BUCKET_NAME="agrospai-portal"
DISTRIBUTION_ID="YOUR_CLOUDFRONT_ID"
echo "Building static export..."
npm run build:static
echo "Uploading to S3..."
aws s3 sync public/ s3://$BUCKET_NAME \
--delete \
--cache-control "public, max-age=31536000" \
--exclude "*.html" \
--exclude "sw.js"
aws s3 sync public/ s3://$BUCKET_NAME \
--delete \
--cache-control "public, max-age=0, must-revalidate" \
--exclude "*" \
--include "*.html" \
--include "sw.js"
echo "Invalidating CloudFront cache..."
aws cloudfront create-invalidation \
--distribution-id $DISTRIBUTION_ID \
--paths "/*"
echo "Deployment complete!"
Make executable and run:
chmod +x deploy-s3.sh
./deploy-s3.sh
Deployment Comparison
| Feature | Netlify | Vercel | AWS S3 |
|---|
| Setup Complexity | Easy | Easy | Moderate |
| Next.js Support | Good | Excellent | Limited (static only) |
| Auto Deploy | Yes | Yes | No (CI/CD needed) |
| Preview URLs | Yes | Yes | No |
| Custom Domains | Yes | Yes | Yes (via CloudFront) |
| HTTPS | Automatic | Automatic | Via ACM |
| CDN | Included | Included | CloudFront (separate) |
| Server Functions | Yes | Yes | No |
| Free Tier | Generous | Generous | Pay per use |
| Enterprise Support | Available | Available | Available |
Remember: NEXT_PUBLIC_* variables must be set at build time on all platforms.
Set in: Site settings → Environment variablesVariables are available during build and runtime.
Set in: Project Settings → Environment VariablesCan be scoped to Production, Preview, or Development.
Set as environment variables in your CI/CD pipeline or build script.Must be present when running npm run build.
Continuous Deployment
All platforms support automated deployments:
GitHub Actions Example
.github/workflows/deploy.yml
name: Deploy to Production
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '22'
- name: Install dependencies
run: npm install
- name: Build
env:
NEXT_PUBLIC_INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }}
NEXT_PUBLIC_METADATACACHE_URI: https://aquarius.pontus-x.eu
AGROPORTAL_API_KEY: ${{ secrets.AGROPORTAL_API_KEY }}
run: npm run build
- name: Deploy to Netlify
uses: netlify/actions/cli@master
with:
args: deploy --prod
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
Monitoring and Analytics
After deployment, set up monitoring:
- Netlify Analytics: Built-in traffic and performance metrics
- Vercel Analytics: Web Vitals and performance insights
- AWS CloudWatch: S3 and CloudFront metrics and logs
- Third-party: Google Analytics, Plausible (configured in
app.config.js)
Next Steps
Production Build
Optimize your build process
Docker Deployment
Deploy with containers
Configuration
Configure environment settings
Network Setup
Configure network and chain settings