Connect your app to Mapbox
Connect your Mapbox account to Lovable to show interactive maps, look up addresses, and build routes. You add your Mapbox keys once in your workspace connectors so your app can use them securely.
Anyone who needs custom map styles, address lookup, or route calculations inside their Lovable app using Mapbox.
Do this, in order
- 1
Sign in to Mapbox and copy your default public token, then create a secret token if your app needs search or route calculations.
The public token renders maps in the web browser, while the secret token handles server-side tasks like finding addresses and paths.
- 2
In your Lovable dashboard, open Connectors, select Mapbox, and click Connect.
This opens the settings form where you connect your credentials to Lovable.
- 3
Give the connection a name, paste your secret token and public token into their respective fields, adjust sharing settings, and click Connect.
Lovable validates your tokens with Mapbox and safely stores them so your app can make map requests.
- 4
Open your project chat and ask Lovable to link your project to the Mapbox connection and build your map feature.
Your project needs permission to use the saved credentials before it can render maps or call location tools.
Paste this into your project
Use Mapbox to build an interactive store locator with address search, map pins, and a sidebar listing the closest locations.
Words decoded
- Public token
- A code that is safe to display in the website code to draw the map on the screen.
- Secret token
- A private digital key that acts like a password for protected server tasks, which visitors should never see.
- Geocoding
- Translating a street address or city name into latitude and longitude coordinates that a map can pinpoint.
Where people get stuck
- If you only provide a public token, features like address search and turn-by-turn routing will fail because they require a secret token.
- Do not mix Google Maps data with Mapbox; Google terms forbid displaying Google route or place data on Mapbox maps.
- Mapbox displays secret tokens only once upon creation, so copy and save it before closing the page.
- Before launching publicly, restrict your public token to your app's web address inside Mapbox so other websites cannot use your quota.
The short version, steps, decoder and prompt on this page are written automatically from Lovable's own documentation and can lag or misread it. The official page is always the authority.