FastAPI server that provides Airflow operators discovery and DAG management capabilities.
- Operator Discovery - Automatically detects all available Airflow operators without importing
- Fast Startup - AST-based parsing for quick initialization
- Operator Status - Track available and unavailable operators
- Airflow Integration - Query DAGs and runs from Airflow instances
- CORS Support - Ready for frontend integration
- Structured Logging - Built-in logging infrastructure
- Python 3.8+
- Apache Airflow 2.7+
- FastAPI 0.104+
- Clone the repository:
git clone <repo-url>
cd airdraw-server- Create virtual environment:
python -m venv venv
source venv/bin/activate # On macOS/Linux
# or
venv\Scripts\activate # On Windows- Install dependencies:
pip install -r requirements.txt- Create
.envfile:
cp .env.example .envEdit .env with your settings:
# App
APP_NAME=AirDraw Server
DEBUG=True
LOG_LEVEL=INFO
# CORS
CORS_ORIGINS=["http://localhost:5173"]
# Airflow
AIRFLOW_HOME=~/airflow
AIRFLOW__CORE__SQL_ALCHEMY_CONN=sqlite:///~/airflow/airflow.db
AIRFLOW__CORE__DAGS_FOLDER=~/airflow/dags
AIRFLOW__WEBSERVER__BASE_URL=http://localhost:8080Development with auto-reload:
uvicorn main:app --reload --host 0.0.0.0 --port 8000Or using the script:
chmod +x run.sh
./run.shProduction:
uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4Visit: http://localhost:8000/docs for interactive API docs
GET /operators/all- Get all available operatorsGET /operators/status- Get operator availability status
GET /health- Server health checkGET /- Root endpoint
GET /listFiles- List files in current directoryGET /path- Show Airflow providers path
airdraw-server/
├── main.py # Entry point
├── requirements.txt # Dependencies
├── .env # Environment variables
├── README.md # This file
│
├── app/
│ ├── config.py # Settings & configuration
│ ├── core/
│ │ └── operators.py # Operator loading logic
│ ├── api/
│ │ └── routes/
│ │ ├── operators.py
│ │ ├── files.py
│ │ └── health.py
│ └── models/
│ └── schemas.py # Pydantic models
│
└── tests/
└── test_operators.py
The server uses AST (Abstract Syntax Tree) parsing to discover operators without importing them:
- Walks through
airflow.providerspackages - Locates operator modules
- Parses Python files with AST
- Extracts class names containing "Operator"
- Filters out base classes (BaseOperator, BaseBranchOperator, etc.)
- Caches results at startup
Benefits:
- ⚡ Fast startup (50-80% faster than imports)
- 🔒 Safe (no side effects from imports)
- 📦 Detects unavailable operators
{
"available": {
"airflow.providers.smtp.operators.smtp": ["EmailOperator"],
"airflow.providers.standard.operators.bash": ["BashOperator"],
"airflow.providers.standard.operators.python": [
"PythonOperator",
"BranchPythonOperator"
]
},
"unavailable": {
"airflow.providers.standard.operators.hitl": "Human in the loop needs Airflow 3.1+"
},
"summary": {
"total_available_modules": 9,
"total_unavailable_modules": 1,
"total_operators": 25
}
}pytest
pytest -v # Verbose
pytest --cov=app # With coverageblack app/ # Format code
flake8 app/ # Check styleVS Code users can press F5 to start with debugger (uses .vscode/launch.json).
Logs are configured in app/config.py. Default level is INFO.
View logs:
tail -f logs/airdraw.logIssue: Operators not loading
- Check Airflow installation:
python -c "import airflow; print(airflow.__version__)" - Verify
AIRFLOW_HOMEenvironment variable - Check logs for import errors
Issue: Slow startup
- Make sure you're using the AST-based approach (not importing)
- Check
LOG_LEVEL=DEBUGfor details
Issue: CORS errors
- Verify
CORS_ORIGINSin.envmatches your frontend URL
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests & linting
- Submit a pull request
MIT
For issues or questions, open an issue on GitHub or contact the maintainers.