github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/docs/doctype.md (about)

     1  [Table of contents](README.md#table-of-contents)
     2  
     3  # Adding a new doctype
     4  
     5  There is currently several steps to add a new doctype. We hope to improve that
     6  in the near future. For the moment, this guide can help you to not forget a step.
     7  
     8  ## Choosing a name for your doctype
     9  
    10  The doctype name is something like `io.cozy.contacts`. The `io.cozy` prefix is
    11  reserved for doctypes created and managed by Cozy Cloud. If you have an
    12  official website, you can use it (in reversed order) for the prefix. Else, you
    13  can use your github or gitlab handle: `github.nono` or `gitlab.nono`.
    14  
    15  Then, you can add a plural noun to indicate what is the type of the documents.
    16  If you have several related doctypes, it is common to nest them. For example,
    17  `io.cozy.contacts.accounts` is the accounts of external services used to
    18  synchronize the `io.cozy.accounts`.
    19  
    20  The name of the doctype must be composed of only lowercase letters, digits, `.`
    21  and `_` characters.
    22  
    23  ## Add documentation about your doctype
    24  
    25  The doctypes are documented on https://docs.cozy.io/en/cozy-doctypes/docs/
    26  to help other developers to reuse the same doctypes. If you think that your
    27  doctype may be useful to others, you can make a pull request on the
    28  https://github.com/cozy/cozy-doctypes repository.
    29  
    30  ⚠️ Do not forget to put a link to this new doc into:
    31  
    32  - the `toc.yml` file so that it appears in the navigation menus.
    33  - the `Readme.md` file so that it appears the index page.
    34  
    35  **Note:** it's the **docs** directory that you should update. The other
    36  directories are used by [remote doctypes](./remote.md).
    37  
    38  ## Add your doctype to the store and stack
    39  
    40  Both the store and the stack knows of the doctypes, for showing permissions.
    41  For the store, it is shown to the user before installing an application that
    42  uses this doctype. For the stack, it is used for showing permissions for
    43  sharings and OAuth clients. In both cases, there is a short description of
    44  the doctype, localized on transifex, and an icon to illustrate it.
    45  
    46  Here are the relevant places:
    47  
    48  - [https://github.com/cozy/cozy-store/blob/master/src/locales/en.json](https://github.com/cozy/cozy-store/blob/master/src/locales/en.json)
    49  - [https://github.com/cozy/cozy-store/blob/master/src/config/permissionsIcons.json](https://github.com/cozy/cozy-store/blob/master/src/config/permissionsIcons.json)
    50  - [https://github.com/cozy/cozy-store/tree/master/src/assets/icons/permissions](https://github.com/cozy/cozy-store/tree/master/src/assets/icons/permissions)
    51  - [https://github.com/cozy/cozy-stack/blob/master/assets/locales/en.po](https://github.com/cozy/cozy-stack/blob/master/assets/locales/en.po)
    52  - [https://github.com/cozy/cozy-stack/blob/master/assets/styles/cirrus.css](https://github.com/cozy/cozy-stack/blob/master/assets/styles/cirrus.css)
    53  
    54  ## Using the doctype in your application
    55  
    56  Of course, after all those efforts, you want to use your new doctype in your
    57  application. Do not forget to add a permission in the manifest to use it!