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
WebSocket connection shows live progress as pages are crawled
Download llms.txt
Instantly download generated files or get public URLs
Responsive Design
Works on desktop, tablet, and mobile devices
Error Handling
Graceful error messages and retry logic
Deployment Options
The frontend can be deployed to several platforms:- Vercel (Recommended)
- AWS Amplify
- Netlify
- Self-hosted
Best for Next.js with automatic deployments, edge network, and zero config.
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
Retrieve the Application Load Balancer URL:Example:
llmstxt-alb-1234567890.us-east-1.elb.amazonaws.comDeploy Frontend
Navigate to frontend directory and deploy:Deployment Output
Successful deployment shows:Frontend is now live! Visit the URL to test.
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
Add each variable:
| Key | Value | Environments |
|---|---|---|
NEXT_PUBLIC_WS_URL | ws://your-alb.amazonaws.com/ws/crawl | Production, Preview, Development |
NEXT_PUBLIC_API_KEY | Your API key | Production, Preview, Development |
Test Frontend
Access the Application
Visit your Vercel URL:https://llmstxt-generator.vercel.app
Verify WebSocket Connection
Enter URL and Start Crawl
In the web interface:
- Enter a URL (e.g.,
https://example.com) - Set max pages (e.g.,
10) - Click “Generate llms.txt”
If you see real-time progress, the frontend is correctly connected to the backend!
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
Vercel provides DNS records to add:For root domain (
yoursite.com):- Type:
A - Name:
@ - Value:
76.76.21.21
llms.yoursite.com):- Type:
CNAME - Name:
llms - Value:
cname.vercel-dns.com
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)
Terraform already created an Amplify app. Complete the setup:Example:
Connect GitHub Repository
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)
Add Environment Variables
In Amplify Console → Environment variables:
NEXT_PUBLIC_WS_URLNEXT_PUBLIC_API_KEY
Get Amplify URL
https://infra.d1a2b3c4d5e6f7.amplifyapp.comContinuous Deployment
Vercel GitHub Integration
Enable automatic deployments on Git push:Connect Git Repository
In Vercel dashboard:
- 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
- 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
Check browser console for errors:
- 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
Common issues:
- 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)
Verify Next.js routing:
- 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)
When frontend uses HTTPS but backend uses HTTP:Option 1: Use HTTP WebSocket on HTTPS page (browser blocks this)Option 2: Configure HTTPS for backend:
- 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:
Next Steps
Monitoring & Logs
Set up CloudWatch monitoring and alerts for your deployment