A machine-readable Nepali calendar (Bikram Sambat) dataset and high-performance API. This project provides automated scraping, structured data storage, and a RESTful interface for calendar data from 1992 BS to the present.
The API is deployed and publicly accessible:
https://api-nepalicalendar.leapcell.app
Interactive documentation (Swagger UI) is available at:
/docs
- Accurate Mapping: Reliable BS to AD date conversion.
- Rich Metadata: Includes Tithi, religious festivals, and public holidays.
- Auspicious Dates: Monthly data for Marriage and Bratabandha.
- Dual Format Storage: Optimized for both bulk (yearly) and granular (monthly) access.
- High Performance: Built with FastAPI and
uvfor minimal overhead. - Zero-Touch Updates: Automated daily scraping via GitHub Actions with dynamic year calculation.
- Python 3.13+
- uv (highly recommended for dependency management)
-
Clone the repository:
git clone https://github.com/S4NKALP/nepali-calendar-api.git cd nepali-calendar-api -
Install dependencies:
uv sync
uv run uvicorn app:app --reloadThe server will start at http://localhost:8000.
Dataset resides in the /data directory:
- Aggregated Yearly:
data/<year>.json(Full 12-month payload) - Modular Monthly:
data/<year>/<month>.json(Lightweight monthly payload)
{
"metadata": {
"np": "बैशाख २०८२",
"en": "Apr/May 2025"
},
"days": [
{
"d": 2,
"n": "१",
"e": "14",
"t": "प्रतिपदा",
"f": "navavarsha 2082",
"h": true
}
],
"holiFest": ["navavarsha 2082..."],
"marriage": ["..."],
"bratabandha": ["..."]
}The scraper is the core engine for dataset expansion.
# Scrape specific year
uv run scraper.py 2082
# Scrape range
uv run scraper.py 2070 2085
# Format-specific flags
uv run scraper.py 2082 --single json # Aggregated only
uv run scraper.py 2082 --dir format # Monthly files onlyThis project uses GitHub Actions (.github/workflows/scrape.yml) to keep the data fresh.
- Frequency: Runs daily at 00:00 UTC.
- Intelligence: Automatically calculates the current BS year and updates folders.
- Manual Control: Supports
workflow_dispatchto manually scrape any year via the GitHub UI.
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request