Individuals and corporations alike are increasingly monitoring the environmental impact of their actions — both out of a sense of personal and corporate responsibility, but also out of a need to adapt to rapidly evolving regulatory guidelines and incentives. For individuals, tracking climate impact is fairly straightforward and involves monitoring personal carbon emissions from daily activities such as commuting, energy use, and food consumption. Efforts to mitigate this personal impact are similarly approachable, such as choosing to bike instead of driving or using energy-efficient appliances.
Corporations, of course, have a much larger carbon footprint, and their tracking involves more complex processes, including monitoring emissions from manufacturing, supply chain, transportation, and more opaque daily business operations. Large corporations increasingly have to adhere to environmental regulations and set sustainability goals, which require more in-depth reporting and data analysis. Tracking and reporting on these disparate data sources is cumbersome, and the technology purpose-built for this use case is nascent.
is addressing this challenge through its carbon calculation engine delivered via a climate API that simplifies the process of calculating the environmental footprint of a company’s emission-generating activities. Climatiq converts operational activity into CO2e estimates, which are then embedded into a customer’s existing applications. Climatiq (and the underlying emissions data) is exposed as a REST API that can be easily consumed by enterprise business systems such as ERP applications and data warehouses. Climatiq provides emissions insights across transportation and logistics, procurement and spend, cloud computing, buildings and energy, flights and cargo, and supply chain. These integrations enable businesses to incorporate carbon emission metrics into their daily operations and existing software, facilitating data-driven decision-making. As Climatiq CTO Isis T. Baulig positioned it, “every organization has their own specific setup, a slate of applications and services they use, and activities they pursue to succeed. The data that lets them track and understand how they are performing from a climate perspective is generally tied to these earlier software choices, such as accounting, cloud services, project management, travel bookings, or office supplies. All of these systems provide the activity data needed to calculate an organization’s greenhouse gas emissions.”
Climatiq’s mission of driving climate action through data and insight is reflected in Climatiq software engineer Gustav Wengel’s explanation of the business: “Climatiq
is an API designed to estimate greenhouse gas emissions for any given activity. It can be used to batch process large amounts of data, and embedded into other software for informed decision-making. Climatiq aims to provide businesses and developers with a powerful tool to monitor and reduce their carbon footprint.” With this mission in mind, Climatiq needed to balance two key pillars for their business while building out their architecture: low emissions and great performance around the world.
The challenge: Building a distributed Climate API with low emissions, low latency, and high performance
Climatiq’s offering — a globally distributed carbon calculation REST API paired with a database of thousands of scientifically-vetted emission factors (all integrated with 3rd party software) — mandated an underlying application stack that was flexible, performant, and fast. Considering Climatiq’s mission is to help companies make data-driven climate decisions, they kept climate efficiency front-of-mind when building their own architecture. At the same time, they didn’t want to sacrifice world-class performance. Climatiq ultimately prioritized low emissions, low global latency, and short time-to-market to inform their more specific requirements.
Distributed by default with low latency
Climatiq’s ambitious mission dictated they design their architecture for global scale from the start. “We serve our API in a geographically distributed manner,” explained Wengel. This ultimately required implementing distributed infrastructure that would ensure that requests to the Climatiq API would be returned from the closest possible compute or database nodes. This would help keep global latency low, and reduce emissions caused by network traffic reaching distant servers. On the compute side, Climatiq required edge compute functions that were both fast and efficient.
In a dynamic application, latency is tied to the lowest common denominator (which is often an exogenous factor like network latency
), but often the database when considering the latency incurred within the bounds of an application architecture alone. As Climatiq gathered requirements, they understood they would need a stateful data store for climate data (estimations, configurations, and other metadata). They needed the database layer to be served as close as possible to their compute nodes to reduce latency, so a modern, globally distributed operational data store was also required. The data was fairly disparate in nature and had security requirements, so support for unstructured data and a high degree of data integrity was critical.
Climatiq sought to deliver a true edge API through a fully distributed stack.
Speed to market, rapid iteration, and low emissions
Prioritizing low environmental impact and speed to market, together, led Climatiq to assess serverless solutions. Serverless technologies would enable Climatiq to scale their infrastructure to zero, avoiding emissions created by underutilized servers. “As a climate-focused company we should also walk the talk, and every CPU cycle we save means less electricity used,” shared Wengel.
With a smaller team, Climatiq liked the idea of bypassing the undifferentiated engineering associated with legacy infrastructure. Instead of patching infrastructure, engineering for multi-region capabilities, or sharding the underlying database, Climatiq wanted to focus on building their core API.
Ultimately, Climatiq solves business problems and is used within enterprise software that carry demanding performance requirements — they couldn’t sacrifice performance for low emissions.
“If you want people to embed your API, you need to ensure you’re faster than a certain threshold so your API feels instantaneous.” Wengel continued, “This means that people don’t have to worry about loading states, spinners, or their application seeming sluggish. While it’s often said that programmer hours are less expensive than CPU hours, speed still matters to us. By making our API fast and responsive, we make it easier for developers and businesses to embed Climatiq into their applications, enabling them to calculate and minimize their carbon footprint and make climate-friendly choices in real-time.”
Climatiq application architecture
The Climatiq team ultimately opted for a composable, best-of-breed serverless and distributed approach that delivers modular pieces of functionality.
Climatiq selected Fauna as the database to host calculation data and metadata, Fastly’s Compute@Edge
for their compute layer, Vercel
as their frontend cloud with Next.js
as the frontend framework, and Auth0
The solution: Serverless and distributed
Fauna, Vercel, Auth0, and Fastly all take an API-first approach to delivering their solutions, allowing Climatiq to focus on delivering the best solution for their customers instead of managing a broad range of functionality internally. Vercel and Next.js offer a dynamic and composable foundation to deliver the user dashboard and configuration without having to manage those components manually, while Auth0 delivers turnkey authentication to manage access.
For the compute and data components, CTO Isis T. Baulig shared that “adopting Fauna and Compute@Edge early on has been instrumental in our ability to test and release features quickly. It allows us to maintain our data logic in a single place, and provides enough flexibility to adapt to different requirements across our application.” Pairing Fauna’s globally distributed database and Fastly’s Compute@Edge platform enabled Climatiq to not only achieve climate efficiency with their own architecture, but to also accelerate their ability to get their API in the hands of users. With this distributed architecture delivered at the edge, Climatiq is able to “achieve ultra-low latencies, consistently under 100ms, and sometimes even as low as 30ms,” shared Wengel.
API delivery model
For edge architectures like Climatiq’s that are optimized for low latency and low emissions, services that are delivered via an HTTP call are attractive because they preclude connection pooling. This reduces idle compute time and accelerates development velocity; Climatiq developers don’t have to spend time building brittle integration code. Fauna offers easy integration with other services and tools that are enabled for edge workloads, including the different components of Climatiq’s stack like Auth0, Vercel
, and Fastly’s Compute@Edge
Distributed architecture with strong consistency guarantees
Climatiq knew that a database built for a single-region wouldn’t satisfy their global requirements. From a latency standpoint, databases located in a single region have round trip times that are typically at the rate of three-digit milliseconds for a global user base. Single-region databases also suffer from inconsistent UX — if a database is located on the US east coast and clients request data from the east and west coast, they incur different latencies purely due to the distance.
Fauna, on the other hand, is distributed by default and offers automatic data replication across regions. Fauna’s Intelligent Routing provides developers with a single endpoint to access a strongly consistent, multi-region distributed database that optimally routes requests for the lowest latency, has replicas for redundancy against regional cloud failures, and provides region choice to help meet data residency requirements. Unlike other serverless databases, Fauna offers the highest serializability
Climatiq wanted to spend their time optimizing their API, and not the underlying infrastructure. Fauna offered the standard serverless benefits while being engineered to accommodate multi-region applications out-of-the-box. Climatiq developers don’t need to worry about sharding, data replication, or any of the other undifferentiated tasks associated with scaling legacy or single-region databases.
Flexible data model
Fauna’s support for unstructured data while maintaining strong consistency
make it both highly scalable as an application evolves, and compatible with edge workloads. This is particularly important for Climatiq, which processes and analyzes large amounts of data from multiple sources, and where data security and reliability are critical. Fauna provides a flexible data model that offers the power of relations in the context of a document through its powerful query language
, enabling Climatiq developers to model and manipulate complex data structures, and extract valuable insights from the data.
Fastly Compute@Edge is optimized for speed and performance, which turned out to be the perfect solution to Climatiq’s challenge of delivering great performance with low emissions. “The physical distance between servers and users can significantly impact API response times. To address this challenge, we’ve turned to Fastly’s Compute@Edge platform, running Rust code on a vast edge computing network. This approach allows us to deploy our code across multiple geographically distributed data centers, ensuring that there’s always an API instance nearby to serve requests,” shared Wengel.
Fastly provides great Rust support, which allowed the Climatiq team to write not only efficient but also very stable software, while designing for a zero runtime exception architecture.
Climatiq is running Compute@Edge on Rust and WebAssembly, which provides the high-level features that allow Climatiq to write efficient software. Meanwhile, Climatiq also leverages Fastly’s caching services to minimize latency. Across the board, Fastly delivers ultra-low latency with negligible cold start times, which helps Climatiq deliver a superior end user experience for this customers.
Vercel provides a frontend cloud that integrates with Fauna, Auth0, and other composable tools. They are the creators of the React framework Next.js, providing Climatiq with a managed platform that automatically generates infrastructure from the framework native code. Climatiq chose Vercel for it’s suite of developer experience tools, like having unique environments and deployments for every change in the application, including the ability to comment directly on the UI.
Climatiq’s API-first architecture delivered on the edge has allowed the team to continually innovate and focus on driving value for their customer base, which has now surpassed 4,000 leading corporations worldwide. The team is well on its way of achieving its mission to drive climate action through data and insight — validated by winning
the Enterprise and Smart Data category at the 2023 SXSW Pitch