include::{partialsdir}/attributes.adoc[]
= Flatpak Concepts
== Application ID
Every application needs a unique application ID, based on a reversed domain name. For example `org.gnome.Maps`.
All resources exported by the application must be prefixed by this identifier. This includes the
https://standards.freedesktop.org/desktop-entry-spec/latest/[desktop file], the appdata file for the
application, and any icons referenced by the desktop file.
See xref:in-depth.adoc#_picking_an_application_id[Picking an application ID].
== Appdata
The appdata file for a Flatpak is used for displaying information about the application prior to
installation. See https://fedoraproject.org/wiki/Packaging:AppData[Fedora Packaging Guidelines for AppData Files].
== Runtimes and bundled libraries
When a Flatpak is executed, the files that the application see come from two places:
* The Flatpak _runtime_, mounted at `/usr`. This contains libraries and data files shared by all Fedora Flatpaks. There are runtimes for each Fedora release.
* The Flatpak _application_, mounted at `/app`. This contains the application code itself, but also contains any libraries that are bundled with the application. The application and libraries must be rebuilt with this prefix - this is done by rebuilding them for flatpaks.
== RPM builds
Packaging flatpaks in Fedora makes use of RPM builds. The application and bundled libraries are rebuilt in Fedora's build system (Koji) with a special build target - this gives a couple of advantages:
* The same RPM spec file used to create the regular RPM build is also used to create the Flatpak RPM build.
* The Flatpak RPM build target has a different buildroot configuration with macros that result in RPMs being built with a prefix of `/app`.
Note that Flatpak RPM builds will not work outside the Flatpak context, since they are rebuilt with a prefix of `/app` with the same name as system libraries - you cannot use `dnf install` to install them.
== OCI Images
For Fedora, Flatpak runtimes and applications are built as https://github.com/opencontainers/image-spec/blob/master/spec.md[OCI Images] and distributed via https://registry.fedoraproject.org. This allows Flatpaks to be handled in a very similar way to server side containers. (Flatpaks are also commonly distributed via https://ostree.readthedocs.io/en/latest/[ostree].)