Skip to content
Home » ThaiWeather – Part 1: Solution Architecture

ThaiWeather – Part 1: Solution Architecture

The goal of ThaiWeather.asia was to build both a website and an Android application that give users a quick overview of the current weather in Thailand. Travellers can use it to compare weather conditions between different places, check the temperature, see where it is currently raining and get a better idea of the conditions across the country. This can help with everyday decisions during a trip, such as planning activities, choosing a destination or deciding what clothes to wear.

The project is designed with scalability in mind. New cities, additional weather providers, extra API endpoints or entirely new client applications can be added without requiring major changes to the existing architecture. Each component has a clearly defined responsibility, making the system modular and straightforward to expand.

In the following articles, I will explain each component of the project in more detail, beginning with the Python configuration files and gradually working through the database layer, the weather collector and the FastAPI backend.

Part 1: Solution Architecture

ThaiWeather.asia uses a simple layered architecture that separates data collection, data storage, the backend API and the applications that present the information to users.

The process starts with the Open Meteo API. This external service provides the weather data used by ThaiWeather.asia. The Python weather collector, implemented in collector.py, connects to Open Meteo over HTTPS and retrieves the latest weather observations in JSON format.

A scheduler runs the collector at fixed intervals. This means the weather data is refreshed automatically without requiring a visitor to trigger a new request. Each collected observation is stored in the PostgreSQL database.

PostgreSQL acts as the central data store for the project. It contains the latest weather measurements as well as the historical observations that have been collected over time. Because the data is stored locally, the platform does not need to call the external weather provider every time a user opens the website or Android application.

The FastAPI backend sits between the database and the client applications. It reads the weather information from PostgreSQL and exposes it through REST API endpoints. These endpoints provide information such as available locations, current weather conditions and historical data.

Both the ThaiWeather.asia website and the Android application connect to the same FastAPI backend over HTTPS. The website provides a responsive interface for browsers, while the Android application offers a native mobile experience built with Kotlin.

For testing, I will use both Playwright and Selenium. These tools will help verify that the website behaves correctly in different browsers and that important user flows continue to work as new features are added.

This structure keeps the different responsibilities clearly separated. The collector handles data retrieval, PostgreSQL handles storage, FastAPI handles access to the data, and the website and Android application handle presentation. It also makes the project easier to expand because new cities, endpoints, statistics or client applications can be added without changing the entire system.

Leave a Reply

Your email address will not be published. Required fields are marked *