![Setting up Webflow’s hybrid app example locally with Ngrok](https://cdn.feather.blog?src=https%3A%2F%2Fwww.notion.so%2Fimage%2Fhttps%3A%252F%252Fprod-files-secure.s3.us-west-2.amazonaws.com%252F480f0932-72ea-496f-a70d-3632da8d6e99%252Fca54b70e-f510-4b8a-aa71-4dfd03eb8df0%252FWebflow_Ngrok.png%3Ftable%3Dblock%26id%3D82f43deb-0757-4007-92d8-14be68de69e8%26cache%3Dv2&optimizer=image&quality=80&width=280)
Do not index
Do not index
Webflow apps offer a world of potential, especially when it comes to hybrid apps, the versatile app types that include both server-side and client functionality. While Webflow has a thorough guide for using the hybrid example app with codespaces, I wanted to share an example of running it locally using NGROK. Webflow needs apps to use a publicly accessible HTTPS URI for redirects. Ngrok allows you to do this while testing locally. This approach is useful if you're thinking of using the hybrid app example as a foundation for your future integrations.
About the Hybrid app example
The hybrid app example enables users to generate images using OpenAI’s Dall-E and add them to their Webflow assets. I'm fond of this example for several reasons:
- It's built on Next.js, offering a glimpse into constructing data-client apps in this framework.
- It illustrates the process of integrating third-party APIs within Webflow’s Hybrid apps.
- It highlights how data from these APIs can be channeled into designer extensions, allowing users to view the info directly within Webflow.
It’s a demonstration of functionality that you could use to build many different kinds of hybrid apps within Webflow.
![Gif of the Webflow hybrid app example taken from the Hybrid app example](https://cdn.feather.blog?src=https%3A%2F%2Fusenotioncms.com%2Fproxy-prod%2Fblock%2Fe7031381-9441-42a3-81e0-bf53ba163932%2F480f0932-72ea-496f-a70d-3632da8d6e99%2F60640ebb-7470-4480-817e-d92b5e36c58d%2FLarge_GIF_(1184x674).gif&optimizer=image&quality=80&width=280)
Running the Hybrid App with Ngrok
Before diving into running a Webflow hybrid app locally using Ngrok, make sure you meet the prerequisites. These tools and accounts are crucial for following along with this guide.
Prerequisites
- Node.js 16.20 or later
- A Webflow site for development and testing
- An OpenAI API key
- A Webflow site for development and testing
- A NGROK account.
Step 1: Configure Webflow App
Follow Webflow's guide to create an app. Enable the data client and designer extension options. Set the following scopes:
'assets:read',
'assets:write',
'authorized_user:read',
'cms:read',
'cms:write',
'custom_code:read',
'custom_code:write',
'forms:read',
'forms:write',
'pages:read',
'pages:write',
'sites:read',
'sites:write',
Step 2: Clone the Repository
Clone the Webflow hybrid example repository. Use this command in your terminal:
git clone https://github.com/Webflow-Examples/Hybrid-App-Example.git
Once cloning is complete, switch to the new project directory with:
cd Hybrid-App-Example
Step 3: Set Up Ngrok
Webflow needs apps to use a publicly accessible HTTPS URI for redirects. Ngrok allows you to do this while testing locally.
While these instructions largely follow Webflow's own guide, note that for the hybrid example, you should use port 3001 instead of 3000 and set the redirect URI to
/webflow_redirect
instead of /auth
.
- Sign Up: Create a free Ngrok account.
- Install: In your terminal, run
$ brew install ngrok
.
- Authenticate: Use
$ ngrok config add-authtoken <your-token>
to add your auth token.
- Start Tunnel: Open a tunnel on port 3001 with
$ ngrok http 3001
.
- Configure Webflow App: Copy the Ngrok forwarding URI. Set this as your App's homepage in Webflow.
![notion image](https://cdn.feather.blog?src=https%3A%2F%2Fusenotioncms.com%2Fproxy-prod%2Fblock%2F56a4091f-467f-47df-85e9-11dd6e597074%2F480f0932-72ea-496f-a70d-3632da8d6e99%2F8c25bd5e-8509-4ee4-af22-3fd388f0f4cc%2FCleanShot_2023-10-27_at_10.23.052x.png&optimizer=image&quality=80&width=280)
- Add
/webflow_redirect
to the end of this URI for the Redirect URL. For example:https://939c-136-33-253-184.ngrok.io/webflow_redirect
.
![notion image](https://cdn.feather.blog?src=https%3A%2F%2Fusenotioncms.com%2Fproxy-prod%2Fblock%2Fbe512b24-77f3-4fcd-af05-11319b4ea248%2F480f0932-72ea-496f-a70d-3632da8d6e99%2F2764d95e-2b22-4a33-9447-2d59ce06e2a4%2FCleanShot_2023-10-27_at_10.26.472x.png&optimizer=image&quality=80&width=280)
Step 4: Set Up Environment Variables
- Create an
.env.local
file in both thedata-client
anddesigner-extension
folders.
![notion image](https://cdn.feather.blog?src=https%3A%2F%2Fusenotioncms.com%2Fproxy-prod%2Fblock%2F6a5c0076-f497-489b-bb77-dfead0562b37%2F480f0932-72ea-496f-a70d-3632da8d6e99%2Ff2c4fdd1-e8e7-4e4c-966b-3253f134513a%2FCleanShot_2023-10-26_at_15.24.032x.png&optimizer=image&quality=80&width=280)
- Add the following variables:
CLIENT_ID=your_client_id
CLIENT_SECRET=your_client_secret
OPENAI_API_KEY=your_openai_api_key
NEXT_PUBLIC_BACKEND_URL='your_NGROK_URL example https://939c-136-33-253-184.ngrok.io/'
Step 5: Install Dependencies
Run
npm install
in the data-client
and designer-extension
folders as well as your main folder.Step 6: Run the App
Execute
npm run dev
to start the app and log in![notion image](https://cdn.feather.blog?src=https%3A%2F%2Fusenotioncms.com%2Fproxy-prod%2Fblock%2Fa4cf19b4-7148-4dce-9b98-85633bc1460d%2F480f0932-72ea-496f-a70d-3632da8d6e99%2Fb600d6e1-3ac5-41b4-9511-9e050f3314e1%2FCleanShot_2023-10-27_at_10.29.502x.png&optimizer=image&quality=80&width=280)
After authorization, copy your token
![notion image](https://cdn.feather.blog?src=https%3A%2F%2Fusenotioncms.com%2Fproxy-prod%2Fblock%2Fc841f6cd-b994-4be0-9bcf-16fdf100b25d%2F480f0932-72ea-496f-a70d-3632da8d6e99%2F4dec155c-77b1-4083-8624-871c0811ce64%2FCleanShot_2023-10-27_at_10.31.392x.png&optimizer=image&quality=80&width=280)
and then log into your test site, and launch your development app to start generating images
![notion image](https://cdn.feather.blog?src=https%3A%2F%2Fusenotioncms.com%2Fproxy-prod%2Fblock%2F67d9c2fd-90af-41c0-926b-2236c699de36%2F480f0932-72ea-496f-a70d-3632da8d6e99%2F17bb3e61-6edd-456e-9725-dbc878abdc55%2FCleanShot_2023-10-27_at_10.39.042x.png&optimizer=image&quality=80&width=280)
There you have it! If you try running the Webflow app example locally, I'd love to hear about it. Drop me a tweet at @ojabowlola or send a quick note to hey@lunchpaillabs.com. Always keen to learn and connect!
Dive Deeper:
- Get to know more with the Webflow docs.
- Delve into the Webflow Rest APIs.
- View the hybrid app example
- Explore the capabilities of Webflow Designer APIs.