![Kickstart Webflow hybrid apps with this template](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%252F15ee8dfc-2ad9-4d3c-b602-55e43b4bcb25%252FWebflow_(2).png%3Ftable%3Dblock%26id%3D64e0a301-b9c1-4c1c-b973-7bb5447c2684%26cache%3Dv2&optimizer=image&quality=80&width=280)
Do not index
Do not index
I’ve been exploring Webflow apps at Lunch Pail Labs and in this article, I’m diving deep into a starter for Webflow hybrid apps. Drawing from Webflow's excellent hybrid app example, I slimmed it into a more generalized version for kickstarting a variety of hybrid apps.
The starter is currently spartan and incorporates some adaptable elements from Webflow’s original example, such as Webflow authentication, user login functionality, redirects, and API access. So with that said, let's dive in!
Initial setup
Ensure you have the following:
- Node.js (version 18.17+): This starter requires a newer version of Node than Webflow apps typically require due to its reliance on Next.js.
- A test-ready Webflow site.
- A Webflow app. For setup instructions, see Step 1 of this tutorial.
- Ngrok or a similar URL forwarding service for development. For setup details, consult Step 3 of this tutorial.
To get this set up:
- Clone the repository using the following command in your terminal:
git clone https://github.com/lunchpaillola/webflow-hybrid-app-starter.git
- Navigate to the project directory and install dependencies
cd webflow-hybrid-app-starter
npm install
- Install the necessary packages in the data-client directory
// Navigate to /data-client and install dependencies
cd data-client
npm install
- Install the necessary packages in the designer-extension directory
// Navigate to /designer-extension and install dependencies
cd ../designer-extension
npm install
- Copy the
.env.example
file to.env.local
in both thedata-client
anddesigner-extension
directories. Update the environment variables with your CLIENT_ID, CLIENT_SECRET, and backend URL.
![notion image](https://cdn.feather.blog?src=https%3A%2F%2Fusenotioncms.com%2Fproxy-prod%2Fblock%2Fa0dd96c7-dad2-4138-bafa-66886b15f027%25252F480f0932-72ea-496f-a70d-3632da8d6e99%25252Ff2c4fdd1-e8e7-4e4c-966b-3253f134513a%25252FCleanShot_2023-10-26_at_15.24.032x.png%253Ftable%253Dblock%2526id%253D6a5c0076-f497-489b-bb77-dfead0562b37%2526cache%253Dv2%26optimizer%3Dimage&optimizer=image&quality=80&width=280)
That’s all for setup.
How does it work?
When users visit your app’s URL, they are greeted with a Webflow login modal. This allows them to authorize the integration with an app on their site. This login functionality is implemented in the
page.js
file, located within the \login
folder of the \data-client
directory (link to page.js file)![notion image](https://cdn.feather.blog?src=https%3A%2F%2Fusenotioncms.com%2Fproxy-prod%2Fblock%2Fd980d177-e4d0-4682-832a-82f57de9aa20%2F480f0932-72ea-496f-a70d-3632da8d6e99%2F58dc8ec6-554f-4066-9490-07ea40eb4174%2FWebflow_auth_.gif&optimizer=image&quality=80&width=280)
Users proceed to the authorization step. This process is managed in the
webflow-redirect
file located in the \data-client
directory (link to webflow-redirect.jsx ).![notion image](https://cdn.feather.blog?src=https%3A%2F%2Fusenotioncms.com%2Fproxy-prod%2Fblock%2F3a85d7b9-e69e-426d-81f3-5f169e6d0a99%2F480f0932-72ea-496f-a70d-3632da8d6e99%2F23b4ea4e-503b-4418-b936-7a6cf2bb4d3d%2Fwebflow-redirect.gif&optimizer=image&quality=80&width=280)
After authorization, users can choose to copy their token. In a regular browsing session, the token will automatically be set, eliminating the need for manual copying. However, if users are in incognito mode, they'll have the option to copy and save their token for later use. This process is handled by
page.js
in the /data-client
directory (link to page.js file).![notion image](https://cdn.feather.blog?src=https%3A%2F%2Fusenotioncms.com%2Fproxy-prod%2Fblock%2F5647be7e-eba5-46bd-ad91-e83733425d27%2F480f0932-72ea-496f-a70d-3632da8d6e99%2Fbddf2719-1796-4c59-8337-edd7e079c811%2FCleanShot_2023-11-15_at_11.54.342x.png&optimizer=image&quality=80&width=280)
Within the Webflow editor, users can launch and use the application through Webflow's designer interface. The main code for this extension is located in
page.tsx
within the /designer-extension
directory. (link to page.tsx file)![notion image](https://cdn.feather.blog?src=https%3A%2F%2Fusenotioncms.com%2Fproxy-prod%2Fblock%2F6b02b125-b520-4ebe-aa17-815347b54723%2F480f0932-72ea-496f-a70d-3632da8d6e99%2Fc1ab45e6-1626-4858-8906-06003ab8ce65%2FUntitled.gif&optimizer=image&quality=80&width=280)
The next section delves deeper into the project structure and highlights key files to customize
Project structure
This starter embodies a hybrid app structure, combining a designer extension and a data client.
The table below details the key files in the root directory.
Name | Purpose |
package.json | Holds project metadata and manages the list of dependencies and scripts. |
data-client | Contains backend logic interfacing with Webflow's API and other services. |
designer-extension | Holds the files for a browser extension to enhance the Webflow design experience. |
Data client directory
This directory serves as the backend hub, handling user authorization and interactions with Webflow's REST APIs and other external APIs.
The table below outlines the critical files within the
data-client
directory. While you might need to modify several files, prioritize the ones marked with a ✎ pencil icon for app customization.File | Purpose |
✎ .env.example | Contains environment variable templates and sample values for initial setup. |
✎ /components | Holds components for the app |
✎ /app | The main area for application building, including login and API routes. |
/utils | Stores utility scripts such as webflow_helper.js for Webflow authorization. Add additional utilities here as required. |
package.json | Holds project metadata and manages the list of dependencies and scripts. |
middleware.js | Retrieves an access token from Webflow; redirects to log in if missing. |
/public | Stores logos and other public-facing assets. |
The
/app
directory is where the bulk of customization happens, from altering styles to modifying functionality or adding new API routes.Name | Purpose |
✎ globals.css | Modify the data client’s styling here. |
✎ page.js | Customizes the startup view for logged-in users. |
✎ /webflow_redirect | Manages the redirection to Webflow. |
✎ /login | Customizes the startup view and branding/styling for logged-out users. |
✎ /api | Handles interactions with third-party apps and Webflow's REST APIs. |
layout.js | Sets the globally shared UI within the data client |
Designer extension directory
The designer extension serves as the user interface for the Webflow app within Webflow, establishing the link with Webflow's designer APIs.
The table below details the key files in the designer extension directory. While you might need to modify several files, prioritize the ones marked with a ✎ pencil icon for app customization.
Name | Purpose |
✎ webflow.json | Defines your extension metadata and sets the display size options: default, comfortable, and large. |
✎ /src/app | The core of the extension where components, icons, and single-page app logic are unified. |
✎ .env.example | Contains environment variable templates and sample values for the initial setup. |
package.json | Holds project metadata and manages the list of dependencies and scripts. |
/public | Stores logos and other public-facing assets. |
The
/src/app
directory is where you'll build the core logic for the single-page application within the extension. Users see and interact with the page.tsx
, making it the central file for the extension's user interfaceName | Purpose |
✎ page.tsx | Customizes the extension's interface and functionality. |
✎ /types | Stores any necessary types for files in the /designer-extension |
✎ /components | Hosts components useful for organizing and managing distinct screens in the page.tsx |
globals.css | Modify the designer extensions styling here. |
/icons | Contains all the icon assets for the extension. |
layout.tsx | Sets the globally shared UI within the extension |
This starter is just the beginning – it's a living project that will evolve with new utilities and app UI components for Webflow. If there's something specific you're looking to include or if you have any ideas, I'd be thrilled to hear from you! Don't hesitate to drop a line at hey@lunchpaillabs.com.