Overview
The frontend is a Next.js application that provides a web interface for the llms.txt Generator. It connects to the backend API via WebSocket for real-time crawl progress.Frontend Features
Real-time Crawling
Download llms.txt
Responsive Design
Error Handling
Deployment Options
The frontend can be deployed to several platforms:- Vercel (Recommended)
- AWS Amplify
- Netlify
- Self-hosted
Vercel Deployment
Install Vercel CLI
Login to Vercel
- GitHub (recommended for auto-deployments)
- GitLab
- Bitbucket
Prepare Environment Variables
Before deploying, collect these values:Get Backend URL
llmstxt-alb-1234567890.us-east-1.elb.amazonaws.comGet API Key
terraform.tfvars file:Format WebSocket URL
ws://llmstxt-alb-1234567890.us-east-1.elb.amazonaws.com/ws/crawlwss:// (secure WebSocket) if you configure HTTPS with a custom domain.Deploy Frontend
Navigate to frontend directory and deploy:Project Setup
Framework Detection
Environment Variables
Production Deployment
Deployment Output
Successful deployment shows:Configure Environment Variables (Alternative Method)
Via Vercel Dashboard
Open Project Settings
- Go to vercel.com/dashboard
- Select your project:
llmstxt-generator - Navigate to Settings → Environment Variables
Add Variables
Redeploy
Test Frontend
Access the Application
Visit your Vercel URL:https://llmstxt-generator.vercel.app
Verify WebSocket Connection
Open Browser DevTools
F12 or right-click → Inspect → Console tabEnter URL and Start Crawl
- Enter a URL (e.g.,
https://example.com) - Set max pages (e.g.,
10) - Click “Generate llms.txt”
Watch Console Logs
- WebSocket connection established
- Crawl progress messages
- Page discoveries
- Completion message
Configure Custom Domain (Optional)
Use your own domain for the frontend
Use your own domain for the frontend
Add Domain in Vercel
- Go to Project Settings → Domains
- Click “Add”
- Enter your domain:
llms.yoursite.com - Click “Add”
Update DNS Records
yoursite.com):- Type:
A - Name:
@ - Value:
76.76.21.21
llms.yoursite.com):- Type:
CNAME - Name:
llms - Value:
cname.vercel-dns.com
Wait for Verification
Update WebSocket URL
- Use
wss://for WebSocket URL (requires HTTPS backend) - Or configure backend custom domain with SSL
AWS Amplify Deployment (Alternative)
If you prefer to deploy the frontend on AWS:Deploy frontend using AWS Amplify (configured in Terraform)
Deploy frontend using AWS Amplify (configured in Terraform)
Connect GitHub Repository
Get Amplify App ID
Open Amplify Console
- Go to AWS Amplify Console
- Select your app:
llmstxt-frontend
Connect Repository
- Click “Connect branch”
- Choose GitHub
- Authorize AWS Amplify
- Select repository and branch (
mainormaster)
Configure Build Settings
Add Environment Variables
NEXT_PUBLIC_WS_URLNEXT_PUBLIC_API_KEY
Deploy
- Clone repository
- Install dependencies
- Build Next.js app
- Deploy to CDN
Get Amplify URL
https://infra.d1a2b3c4d5e6f7.amplifyapp.comContinuous Deployment
Vercel GitHub Integration
Enable automatic deployments on Git push:Connect Git Repository
- Go to Project Settings → Git
- Click “Connect Git Repository”
- Select GitHub/GitLab/Bitbucket
- Choose repository
Configure Branch Deployments
- Production branch:
mainormaster - Preview branches: All other branches
Push Changes
- Build and deploy on every push
- Create preview URLs for PRs
- Run build checks before merging
Frontend Configuration
Update Backend URL
If your backend URL changes (e.g., custom domain):Configure CORS
Ensure backend allows your frontend domain: Editterraform/terraform.tfvars:
Troubleshooting
WebSocket connection fails
WebSocket connection fails
- CORS error: Add frontend domain to
cors_originsin backend - Connection refused: Verify backend ALB is accessible
- Invalid API key: Check
NEXT_PUBLIC_API_KEYmatches backend
Build fails on Vercel
Build fails on Vercel
- Missing dependencies: Check
package.json - Build errors: Run locally first:
- Environment variables: Ensure they’re set in Vercel
Page not found (404)
Page not found (404)
- Check
frontend/pages/orfrontend/app/directory structure - Ensure
index.jsorpage.jsexists - Review Vercel build logs for errors
Mixed content warning (HTTP/HTTPS)
Mixed content warning (HTTP/HTTPS)
- Set up custom domain for ALB
- Use ACM certificate (already created by Terraform)
- Update WebSocket URL to
wss://
Performance Optimization
Enable Vercel Analytics
pages/_app.js:
Configure Caching
Optimize static assets innext.config.js: