Let's assume you are using localhost
for your local services.
- Install mkcert.
mkcert -install
(this just installs the CA to your system)mkcert -client localhost
(this makes all ourlocalhost
servers ok for HTTPS)- Note that it creates
localhost-client.pem
andlocalhost-client-key.pem
files in our root dir - We will use these from our different servers to serve over https where needed
- Note that it creates
App
The UI is all in on SvelteKit.
Data
The UI is all in on GraphQL:
- CodeGen: codegen
- Client: urql
- Subscriptions: graphql-sse.
Style
The UI is all in on
- TailwindCSS
- With some help from DaisyUI
References
- https://svelte.dev/
- https://the-guild.dev/graphql/tools/docs/introduction
- https://the-guild.dev/graphql/sse/get-started
Logging
The UI is all in on roarr.
You can just run_web
and open https://localhost:{.env/WEB_PORT}
.
Or you want to isolate this:
- Set environment variables with
.env
in theui/web
root. npm run dev
starts an HTTPS dev server.
We use vitest
to test our UI.
The describe
, beforeEach
, etc are globally available because we drop the types
to vitest/globals
here.
Be sure you have the global:true
in your test.globals
set up in
your vitest.config.ts
also.
Note we are using the msw package for mock server testing.
Check out the mock-server-urql-integration to see how to stub out requests to your GraphQL API.
The urql client in the UI uses GraphQL subscriptions backed by Server-Side events (SSE). You can learn how to leverage GraphQL Subscriptions by visiting the diag pages pages.
Support for a simple "ping pong" subscription can be done by:
cd <ROOT>/ui/server
npm start
- Starts a SSE Server that emits current time prepended by subscription input args
cd <ROOT>/ui/web
npm run dev
Visit the page at https://localhost:<port>/diag
.
The urql
client instance in this UI delegates to a graphql-sse
client instance for handling GraphQL Subscriptions.
You must provide a PUBLIC_SUBSCRIPTIONS_URL
environment variable to point to your SSE Server.
References
- urql SubscriptionStore docs
- urql Subscriptions with Svelte docs
- GraphQL-SSE client and server package
- Putting urql and graphql-sse all together here