Getting Started

Using SlayQ requires a few steps:

  • Install the slay-q client into your Nuxt or Next (or SvelteKit or whatever) app
  • Run the SlayQ event server
  • Optionally run the SlayQ HTTP RPC ingest server

Run the Example App

We provide a sample Nuxt app with SlayQ integrated already so that you can see how the integration works and how jobs are defined or written:

npx
npx giget@latest bitbucket:slay-pics/slay-utils/src/main/examples/nuxt-example slayq-nuxt-example --install
cd slayq-nuxt-example
pnpm install
cp example.env .env
docker compose up -d
pnpm run dev
pnpm
npx giget@latest bitbucket:slay-pics/slay-utils/examples/nuxt-example slayq-nuxt-example --install
cd slayq-nuxt-example
npm install
cp example.env .env
docker compose up -d
npm run dev
yarn
npx giget@latest bitbucket:slay-pics/slay-utils/examples/nuxt-example slayq-nuxt-example --install
cd slayq-nuxt-example
yarn install
cp example.env .env
docker compose up -d
yarn dev

Once installed, navigate to http://localhost:3000/. The UI here is just a mechanism for triggering events, it won't provide any feedback as to the result of the events running. You should watch the console to see that aspect in action.

How the Example App Works

The key directories of the example app are:

  • server/slay-q - This directory contains the example functions and the SlayQ client export to be used by the rest of the application.
  • server/api/slay-q - This is the receiving endpoint that receives events from SlayQ server (a wrapper around Graphis Worker).

Any application wanting to integrate SlayQ will have to implement something similar to the above. You'll need to define functions, create a SlayQ client and register those functions with the client.

The other aspect of the example app is a docker-compose.yml file that loads three components that work in tandem to store events and dispatch them to your application:

  • Postgresql Server - The datastore for events.
  • HTTP RPC Ingest Server - An HTTP interface your application would use to trigger jobs and otherwise interface with the system.
  • Slay Q Server - Dispatches jobs from the database and sends them to your app.