Webflow itself doesn't support backend code execution or direct server-side API calls, but you can still integrate your NodeJS backend with Webflow to retrieve personalized content using client-side techniques and third-party tools.
1. Use Client-Side JavaScript to Call Your NodeJS API
- Webflow allows custom JavaScript, so you can write scripts that make HTTP requests (e.g., using
fetch()
or Axios) to your NodeJS server. - These API calls happen in the browser (client-side), not on the Webflow server.
- You can insert JavaScript using the Page Settings > Before Body Tag section or through an Embed element in the Designer.
2. Ensure Your NodeJS API Is Publicly Accessible
- Your API must be hosted on a server with a public domain or IP and must allow CORS (Cross-Origin Resource Sharing) to accept requests from Webflow-hosted sites.
- Configure your NodeJS server to include the correct CORS headers, e.g.,
Access-Control-Allow-Origin: *
or the specific Webflow domain.
3. Handle Personalization with Caution
- Since personalization will happen on the frontend, avoid exposing sensitive data (e.g., user tokens).
- You can identify users via URL query parameters, cookies, localStorage, or JWTs passed in headers, assuming your backend validates them securely.
If you need server-side logic but want something Webflow-compatible:
- Use platforms like Make.com, Zapier, Firebase Functions, or AWS Lambda to act as intermediaries between Webflow and your backend.
- This lets you integrate securely without exposing sensitive backend logic directly in the browser.
5. Custom Hosting Option
If you need full server-side rendering:
- You can export your Webflow site's HTML (from a paid plan) and host it on your own stack (e.g., with Express.js), allowing tighter integration with your NodeJS backend.
- However, by doing so, you lose CMS features and Webflow’s visual editing unless you maintain them manually.
Summary
You cannot make backend calls from Webflow’s servers, but you can call your NodeJS API from the frontend using JavaScript. Ensure your API is configured correctly with CORS and avoid exposing sensitive logic client-side. For advanced use cases, consider serverless functions or exporting your site to host with full backend control.