🎉 Good News!
This entire phase can be done through web interfaces - Cloudflare Dashboard and GitHub. No terminal commands required!
This entire phase can be done through web interfaces - Cloudflare Dashboard and GitHub. No terminal commands required!
Prerequisites
- Phase 2 completed (Backend deployed and accessible)
- Cloudflare account created
- Domain name (he2.ai) owned
- GitHub account with frontend code repository
- Frontend builds successfully locally
Step 1: Cloudflare Account & Domain Setup
1.1
Create Cloudflare Account
-
1
-
2Enter your email and create a password
-
3Verify your email address
-
4Log in to Cloudflare Dashboard
1.2
Add Your Domain to Cloudflare
-
1In Cloudflare Dashboard, click "Add a site"
-
2Enter your domain: he2.ai
-
3Click "Add site"
-
4Select plan: Choose "Free" (sufficient for most use cases)
-
5Click "Continue"
-
6Cloudflare will scan your existing DNS recordsWait for scan to complete (30-60 seconds)
-
7Review DNS records and click "Continue"
-
8Cloudflare will show you 2 nameservers (e.g.,
ns1.cloudflare.com)Copy these - you'll need them for the next step
1.3
Update Nameservers at Domain Registrar
What are Nameservers?
Nameservers tell the internet where to find your website. By pointing them to Cloudflare, all traffic goes through Cloudflare's network first.
Nameservers tell the internet where to find your website. By pointing them to Cloudflare, all traffic goes through Cloudflare's network first.
-
1Log in to your domain registrar (GoDaddy, Namecheap, etc.)
-
2Find DNS or Nameserver settings for he2.ai
-
3Replace existing nameservers with Cloudflare's nameservers
-
4Save changes
-
5Go back to Cloudflare Dashboard and click "Done, check nameservers"⏳ Nameserver propagation can take 24-48 hours, but usually completes in 1-2 hours
Pro Tip
You can continue with the next steps while waiting for nameservers to propagate. Cloudflare will send you an email when it's complete.
Step 2: Configure SSL/TLS Settings
2.1
Set Encryption Mode
-
1In Cloudflare Dashboard, select your domain he2.ai
-
2Click "SSL/TLS" in left sidebar
-
3Select encryption mode: Full (strict)This ensures end-to-end encryption
-
4Click "Edge Certificates" tab
-
5Enable "Always Use HTTPS"
-
6Minimum TLS Version: TLS 1.2
-
7Enable "Automatic HTTPS Rewrites"
Step 3: Configure DNS Records
3.1
Add DNS Record for API Subdomain
-
1Click "DNS" in left sidebar
-
2Click "Add record"
-
3Type: CNAME
-
4Name: api
-
5Target: Paste your ALB DNS nameExample:
helium-production-alb-123456789.us-east-1.elb.amazonaws.com -
6Proxy status: Proxied (orange cloud icon)This enables Cloudflare's security and performance features
-
7TTL: Auto
-
8Click "Save"
DNS Record Added! Your API subdomain (api.he2.ai) now points to your AWS backend through Cloudflare.
Step 4: Deploy Frontend to Cloudflare Pages
What is Cloudflare Pages?
Cloudflare Pages is a JAMstack platform for deploying static sites and full-stack applications. It's similar to Vercel but with Cloudflare's global network.
Cloudflare Pages is a JAMstack platform for deploying static sites and full-stack applications. It's similar to Vercel but with Cloudflare's global network.
4.1
Connect GitHub Repository
-
1In Cloudflare Dashboard, click "Workers & Pages" in left sidebar
-
2Click "Create application"
-
3Click "Pages" tab
-
4Click "Connect to Git"
-
5Select "GitHub"
-
6Click "Connect GitHub"
-
7Authorize Cloudflare to access your GitHub account
-
8Select your repository (e.g., neuralarc-ai/he2)
-
9Click "Begin setup"
4.2
Configure Build Settings
-
1Project name: helium-frontend
-
2Production branch: main
-
3Framework preset: Select "Next.js"
-
4Build command: cd frontend && npm install && npm run build
-
5Build output directory: frontend/.next
-
6Root directory: /
⚠️ 2025 Update Required!
For Next.js 14/15, you need to add the
For Next.js 14/15, you need to add the
@cloudflare/next-on-pages adapter to your project. Add this to your package.json devDependencies before deploying.
4.3
Add Environment Variables
-
1Scroll to "Environment variables" section
-
2Click "Add variable" for each:
| Variable Name | Value |
|---|---|
| NEXT_PUBLIC_SUPABASE_URL | https://your-project.supabase.co |
| NEXT_PUBLIC_SUPABASE_ANON_KEY | your-anon-key |
| NEXT_PUBLIC_BACKEND_URL | https://api.he2.ai |
| NEXT_PUBLIC_URL | https://he2.ai |
| NEXT_PUBLIC_ENV_MODE | production |
| NODE_VERSION | 20 |
-
3Click "Save and Deploy"First deployment takes 3-5 minutes
🔍 Watch the Build:
You'll see a real-time build log. Watch for any errors. If the build fails, check the logs for specific error messages.
You'll see a real-time build log. Watch for any errors. If the build fails, check the logs for specific error messages.
4.4
Add Custom Domain
-
1After successful deployment, click "Custom domains" tab
-
2Click "Set up a custom domain"
-
3Enter domain: he2.ai
-
4Click "Continue"
-
5Cloudflare will automatically configure DNSSince your domain is already on Cloudflare, this is automatic!
-
6Click "Activate domain"
-
7Repeat for www.he2.ai
🌐 Domain Connected! Your frontend is now accessible at https://he2.ai
Step 5: Configure Security & Performance
5.1
Enable DDoS Protection
-
1Click "Security" in left sidebar
-
2Click "DDoS" tab
-
3Verify "HTTP DDoS attack protection" is OnThis is enabled by default on all plans
-
4Sensitivity: Set to Medium
5.2
Configure Rate Limiting
-
1Click "Security" → "WAF"
-
2Click "Rate limiting rules" tab
-
3Click "Create rule"
-
4Rule name: api-rate-limit
-
5When incoming requests match: (http.request.uri.path contains "/api")
-
6Requests: 2000
-
7Period: 5 minutes
-
8Action: Block
-
9Click "Deploy"
5.3
Configure Caching Rules
-
1Click "Caching" in left sidebar
-
2Click "Cache Rules" tab
-
3Click "Create rule"
-
4Rule name: cache-static-assets
-
5When incoming requests match: (http.request.uri.path contains "/_next/static/")
-
6Cache eligibility: Eligible for cache
-
7Edge TTL: 1 year
-
8Click "Deploy"
Performance Boost
Caching static assets at the edge reduces load times by 40-60% for users worldwide!
Step 6: Verify Frontend Deployment
6.1
Test Your Website
-
1Open browser and visit: https://he2.ai
-
2Verify page loads correctly
-
3Open browser DevTools (F12) → Console tab
-
4Check for any errors (should be none)
-
5Test user authentication (login/signup)
-
6Test API calls (check Network tab in DevTools)
6.2
Check Cloudflare Analytics
-
1In Cloudflare Dashboard, click "Analytics & Logs"
-
2Review traffic metrics
-
3Check cache hit ratio (should improve over time)
🎉 Frontend is Live! Your Next.js application is now deployed globally on Cloudflare's edge network!
Phase 3 Verification Checklist
- Cloudflare account created
- Domain added to Cloudflare
- Nameservers updated
- SSL/TLS set to Full (strict)
- Always Use HTTPS enabled
- DNS record for api.he2.ai created
- GitHub repository connected
- Build settings configured
- Environment variables added
- First deployment successful
- Custom domains configured
- DDoS protection enabled
- Rate limiting configured
- Caching rules set
- Website accessible at https://he2.ai
- No console errors
- Authentication working
- API calls successful
✅ Phase 3 Complete! Your frontend is deployed and secured. Ready for Phase 4: Data & Cache Layer!