AWS Lambda service that scrapes FAA Temporary Flight Restrictions (TFRs) and stores them in MongoDB for geo-querying.
Two Lambda functions deployed via Serverless Framework:
- scraper -- Runs every 15 minutes. Fetches the current TFR list and geometry from the FAA WFS GeoJSON endpoint, then retrieves detailed NOTAM data from the FAA NMS-API. Results are stored in MongoDB with a 2dsphere index.
- query --
GET /api/tfr?lat=...&lon=...&radialDistance=...returns TFRs within the given radius (meters).
- Node.js 24+
- Serverless Framework v3
- AWS CLI configured with credentials (
aws configure) - A MongoDB Atlas cluster
- FAA NMS-API credentials (email 7-AWA-NAIMES@faa.gov to request access)
yarn installCreate a config.prod.json in the project root (gitignored):
{
"MONGODB_USER": "your-mongodb-user",
"MONGODB_PASSWORD": "your-mongodb-password",
"MONGODB_HOST": "your-cluster.mongodb.net",
"NMS_API_HOST": "https://api-nms.aim.faa.gov",
"NMS_API_KEY": "your-nms-api-key",
"NMS_API_SECRET": "your-nms-api-secret"
}For other stages, create config.<stage>.json (e.g. config.dev.json).
npx serverless deploy --stage prodTo deploy to a different stage:
npx serverless deploy --stage devTrigger the scraper on-demand:
npx serverless invoke --function scraper --stage prodTest the query endpoint:
curl "https://<api-id>.execute-api.us-east-1.amazonaws.com/api/tfr?lat=38.85&lon=-77.04&radialDistance=50000"