Skip to content

gopal092003/Dictionary-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📖 Dictionary API

A modular FastAPI-based REST API to fetch word meanings and synonyms using external APIs like DictionaryAPI and Datamuse.


🚀 Features

  • Fetch word meanings
  • Retrieve synonyms
  • FastAPI interactive docs (Swagger UI)
  • Clean architecture (routes, services, utils)
  • Scalable and easy to extend

📸 Demo / Preview

Demo Screenshot


🧪 Interactive API Docs

FastAPI provides built-in docs:

🏗️ Project Structure

dictionary-api/
│
├── app/
│   ├── routes/        # API endpoints
│   ├── services/      # Business logic
│   ├── utils/         # External API calls
│   └── config/        # Settings
│
├── tests/             # Unit tests
├── run.py             # Entry point
├── requirements.txt
└── README.md

⚙️ Installation

1. Clone the repository

git clone https://github.com/gopal092003/Dictionary-API.git
cd Dictionary-API

2. Create virtual environment (recommended)

python -m venv venv
venv\Scripts\activate      # Windows

3. Install dependencies

pip install -r requirements.txt

▶️ Run the Application

python run.py

Server will start at:

http://127.0.0.1:8000

🔌 API Endpoints

➤ Health Check

GET /

➤ Define a Word

GET /define/{word}

Example:

/define/apple

📊 Example Response

{
  "word": "apple",
  "meanings": [
    "A common, round fruit produced by the tree Malus domestica."
  ],
  "synonyms": [
    "orchard apple tree",
    "malus pumila"
  ]
}

📊 API Workflow

Architecture


🌐 External APIs Used

  • Dictionary API (dictionaryapi.dev)
  • Datamuse API (for synonyms)

⚠️ Error Handling

Status Code Description
404 Word not found
500 Internal server error

🧪 Running Tests

pytest

(or use unittest if configured)


📦 Dependencies

  • FastAPI
  • Uvicorn
  • Requests

🔮 Future Improvements

  • Add antonyms endpoint
  • Add phonetics and pronunciation
  • Add caching (Redis / in-memory)
  • Deploy to cloud (Render / AWS)

👨‍💻 Author

Gopal Gupta


⭐ Support

If you like this project:

  • ⭐ Star the repo
  • 🍴 Fork it
  • 🚀 Use it in your own apps

About

A FastAPI-based REST API for retrieving word meanings and synonyms, designed with clean architecture and external API integration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages