Why donate
API Explorer
App Extension Development

This section of the docs deals with creating your own App Extensions.

It is assumed you have already installed one of the official App Extensions. Having this experience at your disposal is going to be very valuable when you start building your own App Extensions. If you run into problems, please visit our Discord server’s channel #app-extensions.

An App Extension is essentially just an npm package that Quasar CLI loads to provide the functionality that you supplied.

Creating the App Extension

PNPM v11+ only!

pnpm create quasar@latest
# then pick the AppExtension option

It will prompt you about your specific needs. Do you need an install script, an uninstall script, will you be prompting the user with some questions? Pick only what you will be using. You can manually add these later if you decide otherwise.

For the sake of this documentation page, let’s assume we answered with my-ext to the App Extension ext-id question (regarding the prompts above). Remember that the folder name for the App Extension source folder can be different from the actual ext-id. At the end, we will publish our new npm package (quasar-app-extension-my-ext) from the /ae folder.

Based on your responses, a folder for your App Extension will be created with the following structure:

package.json
templates/
# optional folder for spawning files
runtime/
# optional folder with UI stuff
index.js
# (or .ts) Described in Index API
install.js
# (or .ts) Described in Install API
prompts.js
# (or .ts) Described in Prompts API
uninstall.js
# (or .ts) Described in Uninstall API
playground/
# A @quasar/app-vite project folder to test/develop with

App Extension Scripts description

Except for /ae/src/index.js|ts, all the other files are optional. You can manually add or remove them at any point in time.

NameDescription
/ae/src/prompts.jsHandles the prompts when installing the App Extension
/ae/src/install.jsExtends the installation procedure of the App Extension
/ae/src/index.jsIs executed on quasar dev and quasar build
/ae/src/uninstall.jsExtends the uninstallation procedure of the App Extension

Handling package dependencies

If your App Extension has its own dependencies over some packages in order for it to be able to run (except for packages supplied by Quasar CLI, like “quasar”, “@quasar/extras”, “@quasar/app-vite” – you should use “api.compatibleWith()” for those in your /install.js and /index.js scripts – check Install API and Index API), then PNPM installing them into your App Extension folder will supply them into the hosting app.

Example: You are creating a UI component that depends on “my-table” npm package (name is bogus, just for making a point here), then you should PNPM install “my-table” in your App Extension folder.

WARNING

Never PNPM install packages that are supplied by the Quasar CLI, because App Extensions should not be so intrusive and force the user to use a certain Quasar version. Instead, make use of “api.compatibleWith()” for those, which is equivalent to softly saying “Sorry, you need to install this version of Quasar if you want to take advantage of my App Extension”.

Developing

Commands to use

Notice /package.json scripts that you can use:

Run from root folder

# Lint & format
# (if you selected oxlint + oxfmt option)
pnpm run lint
pnpm run lint:check

# Use playground to develop;
# Helps you test the Index script as well
pnpm run dev
pnpm run dev -m ssr
# ...etc

# Invokes the AE into /playground when needed
# (like when changing the scripts themselves);
# Helps you run the Install & Prompts scripts
pnpm run invoke

# Uninstall & re-install AE;
# Helps you mainly to run the Uninstall script
pnpm run cycle

Install and Prompts scripts

TIP

Learn more about what you can do with the Prompts API and the Install API.

You will notice mentions of invoking an AE. The invoking procedure, as opposed to the “adding” one, assumes that the App Extension’s package is already pnpm/yarn/npm/bun installed into the host app (and so, Quasar CLI skips that step).

End-user commands using Index script

quasar ext add <ext-id>
# or:
quasar ext invoke <ext-id>

Uninstall script

TIP

Learn more about what you can do with the Uninstall API.

You will notice mentions of uninvoking an AE. The un-invoking procedure, as opposed to the “remove” one, un-registers the App Extension from the host app, but does NOT uninstalls its npm package.

End-user commands using Uninstall script

quasar ext remove <ext-id>
# or:
quasar ext uninvoke <ext-id>

Index script

The Index script is the heart of your App Extension.

This is where you can tamper with all quasar.config file options, extend the Vite configuration, register Quasar CLI commands, start up external services required for developing your app and many more.

End-user commands using Index script

quasar dev
quasar build

TIP

Learn more about what you can do with the Index API.

A common use-case of what you can do with your Index script is to extend the host app’s Vite config as follows:

/ae/src/index.js (or .ts)

import { defineIndexScript } from '#q-app'

export default defineIndexScript(api => {
  api.extendViteConf (viteConf, { isClient, isServer }, api) {
    // similar in use to /quasar.config > build > extendViteConf
  }
})

Publishing

When you finalized your App Extension and you’re ready to deploy it, all you need to do is to publish it to the npm repository.

  • Make sure to edit /ae/README.md.
  • Also edit /ae/package.json > peerDependencies if needed.
  • In order to publish the AE, do it from within the /ae folder:
# from /ae folder ONLY:
pnpm login
pnpm publish

WARNING

It’s important to remember to NOT strip out the quasar-app-extension- prefix from the name property of your extension’s /ae/package.json, otherwise Quasar CLI will not recognize it.