Templates

Aman Negi

Introduction

AppFlowy is a powerful Open-Source Notion alternative, and we are rapidly improving the application to provide a seamless experience. As of writing this doc, we support nested documents, grids, boards, calendars, and referenced documents/grids. Using these tits and bits you can combine and create your own perfect workspace. While having all these features is excellent, creating your ideal workplace from scratch every time can be cumbersome.

Goal

The goal of this project is to provide a template feature, where users can create templates from a Zip File, and can also export a template. Users can use a template created by the community or reuse their own templates. Later, we plan to have a Template Marketplace where users can share their templates with others. However, that would be out of the scope of this project and a different feature altogether.

Scope

By the completion of this project, the user will be able to:

Implementation Design

To implement the template feature, we came ahead with a simple but efficient solution. Further, we will discuss the implementation of the import and export templates separately.

Export Template:

In AppFlowy, we previously provided the following features for exporting:

  • Export a document as .json or .md file.

  • Export a database as .csv file.

In the export template feature, we wanted to provide the user with the capability of exporting multiple pages and documents as a whole package. Another critical decision was to decide how to save the data regarding the structure of the pages, which could be then used as a reference to import the pages in the same structure.

To store the document structure and configuration, we decided to generate a config.json file during exporting that would contain all the details about the template. During, importing a template the same config file would be used to understand the structure of the template.

  • To generate the config file we created a ConfigService which does all the heavy lifting i.e. generating config.json using the current ViewPB.

  • Once, the config file is generated we then use TemplateService to simply export all the pages, databases, and the config file.

By default the exported files are stored in documents/template/ folder.

The export process is completed at this point and the exports can be Zipped into a single .zip file which is then ready to be imported!

Import Template:

Importing documents and databases was previously supported in AppFlowy, however, under this feature, we would support importing a complete structure of documents and databases. Previously we created a config.json file while exporting, we would now use it for importing the template.

  • Click on the add button and select the template option as shown.

  • Now the file picker will be opened and you can now select the tempate.zip generated in the export section. Once you select the template ZIP it will be added to your editor.

Schedule

This project is expected to be completed halfway by Mid-September, the features to be expected by then are:

The final version of this project will be completed by September, and the features to be expected are:

Last updated