Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather API Wrapper Service 🌦️

Project Description

This project is a Weather API Wrapper Service built with ASP.NET Core. Instead of fetching weather data directly from the provider every time, this service acts as a middleware that implements an intelligent caching strategy using Redis.

It solves two main problems:

  1. Rate Limiting & Cost: Reduces the number of calls to the third-party API (Visual Crossing).
  2. Latency: Provides instant responses for frequently requested cities by serving data from the cache.

🚀 Features

  • Third-Party Integration: Wraps the Visual Crossing Weather API.
  • Redis Caching: Implements the Cache-Aside pattern:
    • Checks Redis first for cached city data
    • If not found, fetches from the API and saves to Redis
  • TTL (Time-To-Live): Cached data expires automatically after 12 hours
  • Dockerized: Fully containerized using Docker Compose (API + Redis)
  • Secure Configuration: Uses Environment Variables and .env files to protect API keys

🛠️ Tech Stack

  • .NET 9 (ASP.NET Core Web API)
  • StackExchange.Redis
  • Docker & Docker Compose
  • Scalar / Swagger (API Documentation)

⚙️ Getting Started

Prerequisites

Installation & Running

  1. Clone the repository
git clone <your-repo-url>
cd <your-project-folder>
  1. Create a .env file
# .env
WEATHER_API_KEY=your_visual_crossing_api_key_here
  1. Run with Docker Compose
docker-compose up --build
  1. Access the API

🇹🇷 Türkçe

Proje Açıklaması

Bu proje, ASP.NET Core ile geliştirilmiş Hava Durumu API Sarmalayıcı (Wrapper) Servisidir. Hava durumu verilerini her istek için doğrudan sağlayıcıdan almak yerine, Redis kullanarak akıllı bir önbellekleme (caching) stratejisi uygular.

Çözdüğü ana problemler:

  1. Maliyet ve Rate Limit: Üçüncü parti API çağrılarını azaltır
  2. Performans: Sık istenen şehirler için milisaniyeler içinde yanıt döner

🚀 Özellikler

  • Visual Crossing API Entegrasyonu

  • Redis Önbellekleme (Cache-Aside Pattern)

    • Önce Redis kontrol edilir
    • Veri yoksa API’den çekilip Redis’e kaydedilir
  • TTL: Veriler 12 saat sonra otomatik silinir

  • Docker Desteği: API ve Redis Docker Compose ile ayağa kalkar

  • Güvenli Konfigürasyon: .env ve environment variable kullanımı


🛠️ Kullanılan Teknolojiler

  • .NET 9 (ASP.NET Core Web API)
  • StackExchange.Redis
  • Docker & Docker Compose
  • Scalar / Swagger

⚙️ Kurulum ve Çalıştırma

Gereksinimler

  • Docker Desktop
  • Visual Crossing API Anahtarı

Adımlar

  1. Projeyi klonla
git clone <repo-adresiniz>
cd <proje-klasoru>
  1. .env dosyası oluştur
WEATHER_API_KEY=sizin_visual_crossing_api_keyiniz
  1. Docker ile başlat
docker-compose up --build
  1. API Kullanımı
GET http://localhost:8080/weather/ISTANBUL

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages