Coder Social home page Coder Social logo

weather's Introduction

README

Rails app to get weather from US address using OpenWeather API.

Application Design

diagram

The Rails WeatherController#current action calls Services::OpenWeatherConnector which is encapsulates calling the OpenWeather API and build a response.

OpenWeatherConnector uses the open-weather-ruby-client gem.

OpenWeatherConnector uses OpenWeatherResponseBuilder to build a data response for the WeatherController. OpenWeatherResponseBuilder is based on the factory design pattern. This will allow us to easily extend the application to support multiple API data sources or multiple endpoint as we add features.

Scalability

This application is stateless and runs without a database. There is a database version is on a separate branch: with-db for future feature expansion that may require a db.

To scale up the application you could setup your infrastructure architecture such that web application instances and Redis cluster nodes as are dynamically increased as load increases. See example diagram below.

Additionally you could serve static assets such as images, css, javascript from a CDN.

infra

Dependencies

  • Ruby 3
  • Rails 7
  • Redis

App Setup for local development

bundle
bin/setup
cp .env.sample .env

Edit .env with your OpenWeather API key.

Run app

bin/dev

Testing

Run test with:

rspec

Documentation

This project is documented using YARD.

Existing code documenation is located the doc folder of the project: open doc/index.html

To regenerate the docs run: rake yard

Screenshots

Homepage homepage

With Invalid Fields valid fields

With Valid Fields valid fields

Cache Miss cache miss

Cache Hit cache hit

weather's People

Contributors

druwerd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.