The DevXP engineering team hosts office hours every Thursday at 11 a.m.
Pacific Time where we answer your questions live and help you get up and
running with Flatfile. Join
us!
Before you begin
Get your keys
To complete this tutorial, you'll need to retrieve your Publishable key from yourdevelopment
environment.
Note: The Publishable Key is safe to be used in client-side applications as it
has limited access to the Flatfile API.
init
command.
Create your file structure
Setup your app to look something like this:src
.
Depending on how you want to handle styling your application, you can have a
styles.css
file in your src directory, create sub-directories to contain style
files, or even create directories outside of src
if you prefer. The only
requirement is that the files can be imported into vue files.
The heart of your vue app will be App.vue
, as this will configure and render
your component(s) to the index.html.
Build your importer
1. Add a Flatfile Button
Add a button to your application to open Flatfile in a modal. Pass in yourpublishableKey
and a new Space will be created on each page load. Optionally,
add the content here to your styles.css
.
2. Configure your project
In your environment file, you’ll need to define your keys. In this example, you will need yourpublishableKey
. You can find these under “Developer settings”
when logged into platform.flatfile.com.
You can create your .env
file via the template below, as well as your
App.vue
, tsconfig.json
, tsconfig.node.json
, and vite.config.ts
, which
are the remaining top-level config files. After these are initialized properly
we can configure the app files under src
.
3. Initialize Flatfile
In yourApp.vue
you’ll need to pass in a minimum of the publishableKey
from
your .env
.
Also, add the content here to your main.ts
, and vite-env.d.ts
. Optionally
you can also add shims-vue.d.ts
if you have the need.
4. Start your client
- Update your package.json to include this script:
- Now, start your front end by heading to the terminal and running the following command.
- To view your app, copy the url and paste it into your browser. Click the button and see that an Empty Space gets created.
5. Build a workbook
Now, let’s build a Workbook inside the Space for next time. Add yourconfig.ts
file, and place the following code in it. After you have
done so, import the configuration to App.vue
, and update spaceProps
to have
the value of config
under workbook
(this will be around line 36
). This
config file has the configuration settings for your workbook, so feel free to
edit however necessary to meet your needs.
6. Transform Data
Next, we’ll listen for data changes and respond using an event listener.- Add a
src/listener.ts
file with this simplerecordHook
. - Update
App.tsx
to import the listener.
7. Match your brand
By attaching athemeConfig
to spaceProps
in src/App.tsx
, we will now
override colors in your Space to match your brand. See all of the options here
in the Theming Reference.
8. Add customizations
You can stop here or explore additional configuration options:- Common Configuration - Shared properties and basic configuration options
- Simple Mode Configuration - Quick setup configurations for common use cases
- Advanced Configuration - Advanced customizations and complex scenarios