diff --git a/cdist/conf/type/__matrix_riot/files/config.json.sh b/cdist/conf/type/__matrix_riot/files/config.json.sh
new file mode 100755
index 00000000..d15d4862
--- /dev/null
+++ b/cdist/conf/type/__matrix_riot/files/config.json.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# Upstream configuration guide/documentation:
+# https://github.com/vector-im/riot-web/blob/develop/docs/config.md
+
+generate_embedded_pages () {
+ if [ $EMBED_HOMEPAGE ]; then
+ cat << EOF
+ "embeddedPages": {
+ "homeUrl": "home.html"
+ },
+EOF
+ fi
+}
+
+cat << EOF
+{
+ "default_server_config": {
+ "m.homeserver": {
+ "base_url": "$DEFAULT_SERVER_URL",
+ "server_name": "$DEFAULT_SERVER_NAME"
+ },
+ "m.identity_server": {
+ "base_url": "https://vector.im"
+ }
+ },
+ "brand": "$BRAND",
+ "defaultCountryCode": "$DEFAULT_COUNTRY_CODE",
+ "integrations_ui_url": "https://scalar.vector.im/",
+ "integrations_rest_url": "https://scalar.vector.im/api",
+ "integrations_widgets_urls": [
+ "https://scalar.vector.im/_matrix/integrations/v1",
+ "https://scalar.vector.im/api",
+ "https://scalar-staging.vector.im/_matrix/integrations/v1",
+ "https://scalar-staging.vector.im/api",
+ "https://scalar-staging.riot.im/scalar/api"
+ ],
+ "bug_report_endpoint_url": "https://riot.im/bugreports/submit",
+ "roomDirectory": {
+ "servers": [
+ $ROOM_DIRECTORY_SERVERS
+ ]
+ },
+ $(generate_embedded_pages)
+ "terms_and_conditions_links": [
+ {
+ "url": "$PRIVACY_POLICY_URL",
+ "text": "Privacy Policy"
+ },
+ {
+ "url": "$COOKIE_POLICY_URL",
+ "text": "Cookie Policy"
+ }
+ ]
+}
+EOF
diff --git a/cdist/conf/type/__matrix_riot/gencode-remote b/cdist/conf/type/__matrix_riot/gencode-remote
new file mode 100755
index 00000000..b8935588
--- /dev/null
+++ b/cdist/conf/type/__matrix_riot/gencode-remote
@@ -0,0 +1,74 @@
+#!/bin/sh -e
+#
+# 2019 Timothée Floure (timothee.floure@ungleich.ch)
+#
+# This file is part of cdist.
+#
+# cdist is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# cdist is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with cdist. If not, see .
+#
+
+VERSION=$(cat "$__object/parameter/version")
+INSTALL_DIR=$(cat "$__object/parameter/install_dir")
+OWNER=$(cat "$__object/parameter/owner")
+
+src="riot-v$VERSION"
+archive="$src.tar.gz"
+config='config.json'
+homepage='home.html'
+url="https://github.com/vector-im/riot-web/releases/download/v$VERSION/$archive"
+
+# tar and curl are installed by the __matrix-riot manifest. mktemp is usually
+# provided by coreutils and assumed installed.
+cat << EOF
+set -e
+
+# Ensure that coreutils is installed.
+if [ ! -x \$(which mktemp) ]; then
+ echo "mktemp is not available on the remote host." >&2
+ exit 1
+fi
+
+# Create temporary working directory.
+tmpdir=\$(mktemp -d)
+cd \$tmpdir
+
+# Download and extract sources.
+curl -L '$url' > $archive
+tar xf $archive
+
+# Backup configuration deployed by __matrix_riot.
+cp '$INSTALL_DIR/$config' '$config'
+
+# Backup homepage deployed by __matrix_riot
+if [ -f '$INSTALL_DIR/$homepage' ]; then
+ cp '$INSTALL_DIR/$homepage' '$homepage'
+fi
+
+# Deploy sources and restore configuration.
+rm -r '$INSTALL_DIR'
+mv '$src' '$INSTALL_DIR'
+cp '$config' '$INSTALL_DIR/$config'
+
+# Restore homepage if available.
+if [ -f '$homepage' ]; then
+ cp '$homepage' '$INSTALL_DIR/$homepage'
+fi
+
+# Chown deployed files to requested owner.
+chown -R '$OWNER' '$INSTALL_DIR'
+
+# Remove temporary working directory.
+cd /
+rm -r \$tmpdir
+EOF
diff --git a/cdist/conf/type/__matrix_riot/man.rst b/cdist/conf/type/__matrix_riot/man.rst
new file mode 100644
index 00000000..c8d80024
--- /dev/null
+++ b/cdist/conf/type/__matrix_riot/man.rst
@@ -0,0 +1,72 @@
+cdist-type__matrix_riot(7)
+======================
+
+NAME
+----
+cdist-type__matrix_riot - Install and configure Riot, a web Matrix client.
+
+
+DESCRIPTION
+-----------
+This type install and configure the Riot web client.
+
+
+REQUIRED PARAMETERS
+-------------------
+install_dir
+ Root directory of Riot's static files.
+
+version
+ Release of Riot to install.
+
+OPTIONAL PARAMETERS
+-------------------
+default_server_name
+ Name of matrix homeserver to connect to, defaults to 'matrix.org'.
+
+default_server_url
+ URL of matrix homeserver to connect to, defaults to 'https://matrix-client.matrix.org'.
+
+owner
+ Owner of the deployed files, passed to `chown`. Defaults to 'root'.
+
+brand
+ Web UI branding, defaults to 'Riot'.
+
+default_country_code
+ ISO 3166 alpha2 country code to use when showing country selectors, such as
+ phone number inputs. Defaults to GB.
+
+privacy_policy_url
+ Defaults to 'https://riot.im/privacy'.
+
+cookie_policy_url
+ Defaults to 'https://matrix.org/docs/guides/riot_im_cookie_policy'.
+
+homepage
+ Path to custom Riot homepage, displayed once logged in.
+
+EXAMPLES
+--------
+
+.. code-block:: sh
+
+ __matrix_riot my-riot --install_dir /var/www/riot-web --version 1.5.6
+
+
+SEE ALSO
+--------
+- `cdist-type__matrix_synapse(7) `_
+
+
+AUTHORS
+-------
+Timothée Floure
+
+
+COPYING
+-------
+Copyright \(C) 2019 Timothée Floure. You can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation, either version 3 of the
+License, or (at your option) any later version.
diff --git a/cdist/conf/type/__matrix_riot/manifest b/cdist/conf/type/__matrix_riot/manifest
new file mode 100755
index 00000000..703e8b6f
--- /dev/null
+++ b/cdist/conf/type/__matrix_riot/manifest
@@ -0,0 +1,68 @@
+#!/bin/sh -e
+#
+# 2019 Timothée Floure (timothee.floure@ungleich.ch)
+#
+# This file is part of cdist.
+#
+# cdist is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# cdist is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with cdist. If not, see .
+#
+
+INSTALL_DIR=$(cat "$__object/parameter/install_dir")
+
+default_server_name=$(cat "$__object/parameter/default_server_name")
+brand=$(cat "$__object/parameter/brand")
+default_country_code=$(cat "$__object/parameter/default_country_code")
+room_directory_servers=$(cat "$__object/parameter/room_directory_servers")
+privacy_policy_url=$(cat "$__object/parameter/privacy_policy_url")
+cookie_policy_url=$(cat "$__object/parameter/cookie_policy_url")
+
+export DEFAULT_SERVER_NAME=$default_server_name
+export BRAND=$brand
+export DEFAULT_COUNTRY_CODE=$default_country_code
+export ROOM_DIRECTORY_SERVERS=$room_directory_servers
+export PRIVACY_POLICY_URL=$privacy_policy_url
+export COOKIE_POLICY_URL=$cookie_policy_url
+
+if [ -f "$__object/parameter/homepage" ]; then
+ export EMBED_HOMEPAGE=1
+ homepage=$(cat "$__object/parameter/homepage")
+fi
+
+# Owner of the uploaded files.
+owner=$(cat "$__object/parameter/owner")
+
+# Ensure that curl and tar are installed, as they will be required by the
+# gencode-remote script.
+__package curl --state present
+__package tar --state present
+
+# Generate and deploy configuration file.
+mkdir -p "$__object/files"
+"$__type/files/config.json.sh" > "$__object/files/config.json"
+
+# Install the config.json configuration file. The application's sources are
+# downloaded and deployed by gencode-remote.
+__directory "$INSTALL_DIR" \
+ --owner "$owner" --mode 0755 --parents \
+ --state present
+require="__directory/$INSTALL_DIR" __file "$INSTALL_DIR/config.json" \
+ --source "$__object/files/config.json" \
+ --mode 0664 \
+ --state present
+if [ $EMBED_HOMEPAGE ]; then
+ require="__directory/$INSTALL_DIR" __file "$INSTALL_DIR/home.html" \
+ --source "$homepage" \
+ --mode 0664 \
+ --state present
+fi
diff --git a/cdist/conf/type/__matrix_riot/parameter/default/brand b/cdist/conf/type/__matrix_riot/parameter/default/brand
new file mode 100644
index 00000000..e8095bb8
--- /dev/null
+++ b/cdist/conf/type/__matrix_riot/parameter/default/brand
@@ -0,0 +1 @@
+Riot
diff --git a/cdist/conf/type/__matrix_riot/parameter/default/cookie_policy_url b/cdist/conf/type/__matrix_riot/parameter/default/cookie_policy_url
new file mode 100644
index 00000000..04e9c2b7
--- /dev/null
+++ b/cdist/conf/type/__matrix_riot/parameter/default/cookie_policy_url
@@ -0,0 +1 @@
+https://matrix.org/docs/guides/riot_im_cookie_policy
diff --git a/cdist/conf/type/__matrix_riot/parameter/default/default_country_code b/cdist/conf/type/__matrix_riot/parameter/default/default_country_code
new file mode 100644
index 00000000..30ac4a3b
--- /dev/null
+++ b/cdist/conf/type/__matrix_riot/parameter/default/default_country_code
@@ -0,0 +1 @@
+GB
diff --git a/cdist/conf/type/__matrix_riot/parameter/default/default_server_name b/cdist/conf/type/__matrix_riot/parameter/default/default_server_name
new file mode 100644
index 00000000..5528ffdd
--- /dev/null
+++ b/cdist/conf/type/__matrix_riot/parameter/default/default_server_name
@@ -0,0 +1 @@
+matrix.org
diff --git a/cdist/conf/type/__matrix_riot/parameter/default/default_server_url b/cdist/conf/type/__matrix_riot/parameter/default/default_server_url
new file mode 100644
index 00000000..2cb92277
--- /dev/null
+++ b/cdist/conf/type/__matrix_riot/parameter/default/default_server_url
@@ -0,0 +1 @@
+https://matrix-client.matrix.org
diff --git a/cdist/conf/type/__matrix_riot/parameter/default/owner b/cdist/conf/type/__matrix_riot/parameter/default/owner
new file mode 100644
index 00000000..d8649da3
--- /dev/null
+++ b/cdist/conf/type/__matrix_riot/parameter/default/owner
@@ -0,0 +1 @@
+root
diff --git a/cdist/conf/type/__matrix_riot/parameter/default/privacy_policy_url b/cdist/conf/type/__matrix_riot/parameter/default/privacy_policy_url
new file mode 100644
index 00000000..4cdd12c1
--- /dev/null
+++ b/cdist/conf/type/__matrix_riot/parameter/default/privacy_policy_url
@@ -0,0 +1 @@
+https://riot.im/privacy
diff --git a/cdist/conf/type/__matrix_riot/parameter/default/room_directory_servers b/cdist/conf/type/__matrix_riot/parameter/default/room_directory_servers
new file mode 100644
index 00000000..4ea73ad5
--- /dev/null
+++ b/cdist/conf/type/__matrix_riot/parameter/default/room_directory_servers
@@ -0,0 +1 @@
+"matrix.org"
diff --git a/cdist/conf/type/__matrix_riot/parameter/optional b/cdist/conf/type/__matrix_riot/parameter/optional
new file mode 100644
index 00000000..c5e949fe
--- /dev/null
+++ b/cdist/conf/type/__matrix_riot/parameter/optional
@@ -0,0 +1,9 @@
+default_server_url
+default_server_name
+brand
+default_country_code
+privacy_policy_url
+cookie_policy_url
+room_directory_servers
+owner
+homepage
diff --git a/cdist/conf/type/__matrix_riot/parameter/required b/cdist/conf/type/__matrix_riot/parameter/required
new file mode 100644
index 00000000..a76477e9
--- /dev/null
+++ b/cdist/conf/type/__matrix_riot/parameter/required
@@ -0,0 +1,2 @@
+version
+install_dir