fastapi-cors
Simple env support of CORS settings for Fastapi applications
What it is and what it does
fastapi-cors is a thin wrapper around FastAPI's built-in CORS middleware that reads configuration from environment variables instead of requiring programmatic setup. It lets you define allowed origins, methods, headers, and credential support through a .env file, then applies those settings with a single function call. The package includes an optional health-check route that displays the active CORS environment variables.
The package is designed for developers who want to manage CORS policy through environment configuration rather than code. It depends on environs to parse and cast environment variables, and fastapi as its target framework. Since the package is abandoned (no updates since July 2023), it receives no maintenance or security updates, making it suitable only for stable, low-risk deployments or as a reference implementation rather than a production dependency.
Use it for:
- Configure CORS for a FastAPI app using only environment variables, avoiding hardcoded origin lists in code.
- Set different CORS policies across development, staging, and production by changing .env files without code changes.
- Add a health-check endpoint that reports the active CORS configuration for debugging cross-origin request issues.
- Quickly scaffold a FastAPI app with sensible CORS defaults (localhost and localhost:3000 allowed) for local development.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Configures CORS settings for FastAPI applications via environment variables, with optional health-check endpoint.
No. The package is abandoned and receives no maintenance. For new projects, use FastAPI's built-in CORSMiddleware directly with environment variable parsing via environs or python-dotenv—you gain the same functionality with active upstream support. For existing projects already using fastapi-cors, migration is straightforward since the underlying FastAPI CORS API is stable.
Install
fastapi-cors on PyPI
pip
pip install fastapi-corsuv
uv add fastapi-corspoetry
poetry add fastapi-corsInstalling fastapi-cors
Before you install
Low install friction with only two runtime dependencies (environs and fastapi). However, the package is abandoned—last release was 2023-07-12 with no updates since, so expect no maintenance or security patches going forward.
License in practice
MIT license is permissive, allowing commercial and private use with minimal restrictions.
Quickstart
pip install fastapi-cors
from fastapi import FastAPI
from fastapi_cors import CORS
app = FastAPI()
CORS(app)
Requires fastapi and environs as runtime dependencies; reads .env file during import.
Verify before relying
- Whether the package's defaults (localhost:3000 origins, all methods, credentials enabled) are suitable for production use cases beyond development.
- How the health-check endpoint behaves when CORS restrictions are in place and whether it poses any security concerns.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — environs, fastapi |
| Maintenance | abandoned — 1,129 days since the last release |
| First released | |
| Downloads | 240,558/month — #8,904 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: fastapi_cors-0.0.6-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
aiohttp-corsAdds Cross-Origin Resource Sharing (CORS)…
permissive · top 5,000 on PyPI
flask-corsFlask-CORS handles Cross-Origin Resource…
permissive · top 1,000 on PyPI
django-cors-headersAdds Cross-Origin Resource Sharing (CORS)…
permissive · top 1,000 on PyPI
Sanic-CorsSanic-CORS is a Sanic extension that adds…
permissive · top 15,000 on PyPI
cherrypy-corsAdds Cross-Origin Resource Sharing (CORS)…
permissive · top 15,000 on PyPI
quart-corsQuart-CORS adds Cross-Origin Resource Sharing…
permissive · top 15,000 on PyPI
invenio-restInvenio-REST provides Flask-based REST API…
permissive · top 15,000 on PyPI
python-json-configLoads JSON configuration files and provides…
permissive · top 15,000 on PyPI
envierEnvier extracts application configuration from…
permissive · top 1,000 on PyPI
environsenvirons parses environment variables into…
permissive · top 5,000 on PyPI