The PyConDE website includes a secure contact form with bot protection and email delivery.
- Frontend: Lektor page with HTML5 form and JavaScript validation
- Backend: FastAPI REST API deployed on AWS Lambda
- Email: Mailgun API integration
- Security: reCAPTCHA v3, honeypot, API key authentication, AWS WAF
cd backend
cp .env.example .env
# Edit .env with your credentials
# Run backend
uv run uvicorn main:app --reload --port 8000Backend available at http://localhost:8000
make runContact form available at http://localhost:5001/contact
- Navigate to http://localhost:5001/contact
- Fill out form and complete reCAPTCHA
- Submit and verify email delivery to info26@pycon.de
- Register at https://www.google.com/recaptcha/admin
- Create reCAPTCHA v3 site for domains:
2026.pycon.depycon.delocalhost(testing)
- Configure credentials:
- Backend: Set
RECAPTCHA_SECRET_KEYinbackend/.env - Frontend: Update
recaptcha_site_keyincontent/contact/contents.lr
- Backend: Set
Configure in backend/.env:
MAILGUN_API_KEY=key-your-api-key
MAILGUN_DOMAIN=mg.yourdomain.com
MAILGUN_API_BASE_URL=https://api.eu.mailgun.net/v3
EMAIL_RECIPIENT=info26@pycon.de
EMAIL_SENDER=noreply@pycon.deUpdate content/contact/contents.lr:
api_endpoint: https://your-api-gateway-url/prod/api/contact
recaptcha_site_key: your_site_key_here
See backend/DEPLOY.md for complete deployment instructions.
Choose deployment mode:
Basic (Function URL):
cd backend
sam build -t template.yaml
sam deploy --guided --template-file template.yamlSecure (API Gateway + WAF) - Recommended for production:
cd backend
sam build -t template-secure.yaml
sam deploy --guided --template-file template-secure.yamlAfter deployment, update frontend api_endpoint with the output URL.
- FastAPI docs disabled in production (DEBUG=False)
- Optional API key authentication
- AWS WAF protection against DDoS, SQL injection, XSS (secure template)
- reCAPTCHA v3 verification
- Honeypot field for bot detection
- CORS validation
- Input validation with Pydantic
See backend/SECURITY.md for comprehensive security documentation.
View logs:
sam logs --stack-name pyconde-contact-form --tailView metrics in AWS Console:
- Lambda: Functions → pyconde-contact-form-api
- API Gateway: APIs → pyconde-contact-form-api
- WAF: Web ACLs → pyconde-contact-form-waf
Docs not accessible locally:
- Ensure
DEBUG=Trueinbackend/.env
CORS errors:
- Verify
ALLOWED_ORIGINSinbackend/.envmatches frontend domain
API key errors (403):
- Include
X-API-Keyheader in frontend requests ifAPI_KEYis set
pyconde-website/
├── backend/
│ ├── main.py # FastAPI application
│ ├── lambda_handler.py # AWS Lambda handler
│ ├── config.py # Configuration
│ ├── recaptcha.py # reCAPTCHA verification
│ ├── email_service.py # Mailgun integration
│ ├── template.yaml # Basic SAM template
│ ├── template-secure.yaml # Production SAM template
│ ├── DEPLOY.md # Deployment guide
│ └── SECURITY.md # Security documentation
├── content/contact/
│ └── contents.lr # Contact page content
├── templates/
│ └── contact-form.html # Form template
└── assets/static/
├── css/custom.css # Form styles
└── js/contact-form.js # Form handling
Basic deployment:
- Lambda: $0-1/month
- Total: ~$0-2/month
Secure deployment:
- Lambda: $0-1/month
- API Gateway: $0-2/month
- WAF: $5-7/month
- Total: ~$5-10/month
Plus Mailgun costs (separate).