Small demo application to demonstrate how Digital Product Passport -style usage might work for sharing real-time data about their products.
Goals:
- Simple to extend with new items, new data products, etc.
- Durable, attempts to self-recover from errors and should not blow up seriously if e.g. network connection isn't good
- Support mocking APIs as necessary
- Filter available data based on role
- Deployment
- Full user data as needed to render login + menu
- Correct user data
- Log out
- Menu updates based on login state
- All styles
- Correct images for items
- Full list of items
- Full list of supported data products
- Configure data products per role correctly
- Social metadata, favicon, etc.
- Some unit tests?
Prerequisites:
Prepare
pre-commit install
bun install
Run dev server
bun dev
Autoformat files
bun format
Build + run
bun run build
bun start
You can run unit tests with
bun run test
To configure supported items, what they're connected to, and what data is available for each of them, you need to edit src/lib/items.ts.
You should configure the access control keys for new sources in
src/lib/secrets.server.ts, using a ACK_DEFINITION_PATH_SOURCE_NAME
-pattern for
environment variables.
Add new environment variables to .env.example. When testing copy it to .env
and fill in the
keys from https://developer.ioxio.io/access-control-keys/.
To support a data product, we need a component for it in src/lib/dataproducts and that component to be exported in src/lib/dataproducts.ts. The component will get as input the request props and response props, with whatever data has been given.
You can implement mock responses in src/lib/api/mocks.ts. Mocked responses skip requests to the server completely while pretending to take a bit of time.
API Tokens are cached on the server-side for 50 minutes in src/lib/api/dataspace.server.ts.
Data Products are cached on the client-side for 5 minutes in src/lib/api/dataproduct.ts. Invalidated by reload.