How pmniko/api-weather works
Project type and purpose
• This is a Node.js/TypeScript back‑end API (“Api‑Test”) that follows a Clean Architecture or Domain‑Driven Design style.
• Its sole purpose is to fetch weather data from an external API, transform it through a domain/dto/entity pipeline, and expose two REST endpoints:
• GET /api/weather/home
• GET /api/weather/provincias
File structure
• Top‑level:
• app.ts – application entry point that boots the server;
• config/plugins – environment variable loader;
• helpers/errors – custom error types and a handler;
• domain – core business layer: interfaces, entities, DTOs, repositories, datasources;
• infraestructure – concrete implementations: HTTP datasource, repository;
• application – orchestration: use‑cases and a Service that exposes them;
• presentation – HTTP layer: Express routes, controllers, server initialization.
• Patterns:
• Each “domain” concept (weather) has its interface, entity, dto, repository.
• Use‑cases live in application and are glued together by a Service class.
• Controllers call service methods; service calls use‑cases; use‑cases call repository interfaces; repositories call datasources; datasources call external API.
Key architecture insights from README
• The README steps describe exactly how to interface the external JSON, define domain abstractions, DTOs, use‑cases, services, controllers, and finally concrete infra implementations.
• The project enforces strict layer separation and dependency inversion: higher layers depend on abstractions, lower layers implement them.