Tutorial — Frontend + Backend — Step 5 of 9
Configure Frontend
Point the widget at your backend with api.baseUrl.
Point the widget at your backend. The compliance group is resolved automatically per visitor via /resolve-profile — no need to hardcode it:
main.ts
ts
import { ConsentiSetup } from '@consenti/ui'
const widget = new ConsentiSetup({
api: {
enabled: true,
baseUrl: 'https://your-site.com', // where your backend is mounted
},
})
widget.onReady(() => {
if (widget.isCookieGranted('analytics')) initAnalytics()
})ℹ️If the API request fails (network error, server down), the widget automatically falls back to the matching pre-built profile — it never breaks the page.
Already configured a custom geoDataProvider in Configure Backend? Nothing changes here — the frontend always delegates resolution to whatever the backend decides.