Home / Companies / Webflow / Blog / Post Details
Content Deep Dive

How to build a Google Maps distance calculator for service-area sites with Webflow Cloud

Blog post from Webflow

Post Details
Company
Date Published
Author
Ismail Ajagbe
Word Count
2,997
Company Posts That Month
27
Language
English
Hacker News Points
-
Post removed?
No
Summary

Moving companies and regional installers can build a secure distance calculator in Webflow by deploying a Next.js 15 or later application to Webflow Cloud and routing address requests through a server-side API rather than exposing a Google Maps key in browser code. The approach requires a billed Google Cloud project with the Routes API enabled, a restricted server-only API key, Node.js 22+, npm, and the current Webflow CLI, while the application is mounted at a path such as `/tools` and the rest of the site can remain built in Webflow Designer. A POST route validates origin and destination inputs, calls Google’s computeRouteMatrix endpoint with a required field mask, and returns road distance, drive time, and numerical distance data for pricing or service-area logic. The client form must manually prefix requests with the mounted base path, supplied through a public build-time environment variable, while the Google key is stored as a secret Webflow Cloud environment variable. Additional safeguards include restricting the key to the Routes API, setting Google quotas or budget alerts, optionally checking request origins, and avoiding the unsupported Next.js edge runtime directive. Common deployment issues include missing mount paths that cause production 404 errors, mismatched environment variables between local and deployed environments, and improperly restricted or absent API keys. The resulting calculator can support delivery-fee calculations, service-radius filtering, fixed business destinations, and future multi-location route comparisons.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Edge Computing 3 107 30 11 +20%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.