The open-source, high-performance REST API for astronomy enthusiasts, educators, and space-bots. 🚀
CosmosAPI provides curated, scientifically accurate facts about the universe (planets, stars, black holes, and more). Built with FastAPI for blazing speed and simplicity.
The API is deployed and ready to use! You can test all endpoints directly in your browser via the interactive Swagger UI:
Click here to try the API (Live Docs)
- 🌌 Vast Database: Facts about planets, stars, nebulae, and space history.
- 🚀 Blazing Fast: Built on top of Starlette and Pydantic.
- 📖 Self-Documented: Automatic interactive documentation.
- 🔍 Smart Filtering: Filter facts by specific categories.
- 🆓 Free & Open Source: No API keys required (yet).
Base URL: https://cosmos-api-production.onrender.com
| Method | Endpoint | Description | Example Usage |
|---|---|---|---|
GET |
/api/v1/random | Returns a single random fact. | curl /api/v1/random |
GET |
/api/v1/facts | Returns the full list of facts. | curl /api/v1/facts |
GET |
/api/v1/category/{name} | Filter facts by category. | curl /api/v1/category/planets |
GET |
/docs | Interactive Swagger UI. | Visit in browser |
{
"id": "fact_001",
"content": "Neutron stars are so dense that a teaspoon of them would weigh about 6 billion tons.",
"category": "stars",
"complexity": "medium",
"source": "National Geographic"
}cosmos-api/
├── app/
│ ├── main.py # The API entry point & logic
│ └── __init__.py
├── data/
│ └── cosmos_facts.json # The database of facts
├── requirements.txt # Python dependencies
└── README.md # Project documentation
If you find this API useful, please give it a star ⭐ on GitHub!
Built with ❤️ and 🔭 by Furni