Software Architecture
System Overview
External Services
CRM
As defined in ADR-013 - External APIs, the Sunny Calculator Add-On interacts exclusively with the CRM system. All data operations (quote retrieval, updates, and document generation) are delegated to CRM, which in turn integrates with ERP, pricing engines, and discount services on behalf of the Add-On.
The CRM API is a RESTful JSON interface specified using OpenAPI and published via Azure API Management for authentication, authorization. For detailed request/response schemas and examples, see the CRM API reference.
Sunny Configurator
For product configuration details needed to build offers in the AddOn (product options, customizations).
F&SCM
Production lead times or material availability, as well as customer discounts.
Calculator Add-On Architecture
Backend
The backend service implements the core application logic and serves a RESTful API to the frontend.
Key characteristics:
- Containerized Deployment: Packaged as a Docker container and deployed to Azure Container Apps for scalability and resilience.
- Modular Structure:
- Routers: FastAPI endpoints defining the public API.
- Services: Business logic orchestrating CRM calls and calculation workflows.
- CRM Client: Auto-generated via
openapi-python-clientto interact with the CRM API. - Models: Pydantic schemas for request and response bodies.
- Utilities: Logging, configuration, and error handling.
Authentication and authorization are enforced by Azure API Management.
See ADR 007 - Techstack Backend for details.
Frontend
The frontend application is a single-page application (SPA) built with React and TypeScript, using Vite as the build tool. It leverages:
- Routing: TanStack Router for nested routes and parameter handling.
- Data Fetching: TanStack Query for declarative data fetching, caching, and synchronization over HTTP/JSON.
- UI Components: shadcn components styled with Tailwind CSS for rapid UI development.
- Client Code Generation: API types and hooks generated from the OpenAPI spec to ensure end-to-end type safety.
See ADR 008 - Techstack Frontend for details.
API
The frontend and backend communicate over a RESTful JSON API as defined in ADR-015 - Frontend-Backend Communication. The API adheres to standard HTTP semantics:
- OpenAPI Specification: Auto-generated
openapi.jsonfrom FastAPI, imported into Azure API Management. - HTTP Verbs and Status Codes: CRUD operations mapped to standard methods (GET, PATCH, POST, DELETE) and status codes (2xx for success, 4xx/5xx for errors).
- Versioning: Managed via path prefixes (e.g.,
/v1) and API gateway configuration. - Authentication: Bearer tokens issued by Azure AD, validated by Azure API Management.