Components and their location

Hi team,

so after setting up penpot locally what I am trying to achieve is I have made a component in one file and I want it to be enable to all the files to use that component instead of recreating them in each file.
So if I could capture where is the component or its details stored like if in postgresql then I would write some code and make it available to all the files.

Can you tell me where’s the component part stored in database or the logic in code.
Thanks & Regards

A reply from the penpot developers would really be appreciated !
Trying some customisation here that could really be helpful!

hello @vatron

The components are stored in the bytea blob on data column on file table. But you don’t need to touch here and you probably will not be able to do directly from postgresql.

To be able access to this component, you should mark a file as a shared library:

update file set is_shared=true where id = '<file-id-you-want-to-be-shared-as-library>';

Then you will need create relations between the library and the files witch you want to access this library:

insert into file_library_rel values ('<file-id>', 'file-library-id', now(), now());

I hope this helps you.

1 Like

I don’t know if this is helpful, but how I achieve this is to simply copy component designs into a common file and then import that common file as a library in all the other files in the space. Any time the common file / library is updated, the individual files will automatically update.