An App for the Pluriverse
A web application baseline for many possible worlds.
Table of Contents
- Introduction
- Set up local development environment
- Set up production deployment flows and envs
- Describe your domain via context.json
- Create resources with HTML forms
- Create connections between resources
- Edit, update, and delete resources
- Query data with REST endpoints
- Query data with SPARQL
- App-level access control with read-only data
- Route-level access control
- Resource-level access control
Introduction
This is a small starter application for rapid development of web projects to contemporary best practices in terms of server-side rendering and delivery of HTML, progressively enhanced JavaScript, clear and concise CSS, delivering high-performance and highly-accessible projects for the open web.
The application itself is build to the vision of a Transitional Web App with SvelteKit. The primary data format is built around JSON-LD, and data is stored in a standards-implementing triplestore. The application uses SPARQL to interface with the data store and provide efficient, graph-based data queries.
Developing projects with this applications follows the approaches described by Arturo Escobar and Keller Easterling respectively as “designing for the pluriverse” and “medium design”.
This guide will walk you through the process of setting up, deploying, and developing a project.
Set Up Local Development Environment
The starter kit uses Docker and Docker-Compose to run the application and the data store.
The application itself is built with SvelteKit. The data store is Oxigraph, but any triplestore that implements SPARQL will also work.
Download the Repository with Degit
This is a temporary measure until I figure out how npm create works>
npm install -g degit
degit git@github.com:nikolaswise/pluriverse.git my-project
cd my-project Set the Environment Variables
The only variable that you need to set is sparql_endpoint. If you are using the standard docker-compose workflow provided, this will be http://oxigraph:7878. Copy the .env.example file into .env.
Alternatively, this can be any URL of a SPARQL endpoint. If you are using a remote endpoint like this, you can run the application by itself, without docker.
Run With Docker
Build the application image with Docker, than run it and the datastore image together:
docker build
docker-compose up Run Without Docker
If you’re using a remote SPARQL endpoint, you can run the application by itself.
npm run dev Set up production deployment flows and envs
We’ll be setting up a production data store and authentication proxy services on Fly.io.
Clone Configuration & Container Files
Get the sample dockerfile and fly configuration files.
degit https://github.com/nikolaswise/fly-triplestore my-store Install Fly
Sign up for an account with Fly.io and install flyctl.
Deploy Oxigraph
First, deploy the Oxigraph container to your fly account.
cd my-store/oxigraph
fly launch This will walk you through building the containers and deploying an application to Fly. At the prompts, select you region, and pick N to Upstash Redis and Postgres deployments.
Pick y to deploy the app now.
Aside: I went ahead and deleted one of the two default machines assigned to the app. I’m not sure how to make two volumes with data replication work, so Im just ignoring that for now.
Create a Volume
fly volumes create data --region sea --size 3 --region should match your app deployment region.
--size is an integer in GB.
Deploy the NGINX proxy
Scoot over the NGINX directory.
cd ../nginx/ Run the following with a username and password for the basic authentication.
htpasswd -Bbn <usename> <password> >> .htpasswd Keep track of this password. It can’t be recovered.
Lastly, deploy the nginx app to Fly:
fly launch Again, pick the same region, select N for Redis and Postgres, and y to deploy the app right now.
Celebrate
Visit the URL for the NGINX server that Fly provides. Use the credentials from the previous step to authenticate, and start playing with SPARQL queries.
Describe your domain
Now we should have a little application running, ready to create items and relationships.
- Ecosystem
- sveltekit
- Oxigraph
- Triplestore
- Auth Proxy
- rdf-kv.js
- sparql-helpers.js
- svelte-magic-link.js
- shipyard.svelte
- Getting Started
.envvariablessparql_endpointsparql_usersparql_password
docker-compose builddocker-compose up. -->. --> -->
- Staging & Production Environments
- https://pushbroom.co/hosting-a-triplestore
- fly.io triplestore & auth proxy
ToDo
- Stucco Software Repo for Fly.io triplestore config and code