This template serves as a quick way to start building your own decentralized renderer using OpenAttestation stack.
This repository boilerplate code is spinned up from Create Vite. As of now, Create React App is no longer featured in React documentation. Can observe future roadmap on CRA meanwhile.
The decentralized renderer code here is based off OpenAttestation's decentralized-renderer-react-template, but with some changes as mentioned below.
To stay as simple and less opinionated as possible, these are omitted:
- Styling libraries. (Recommended to use Tailwind, otherwise can use module.css directly)
- Testing frameworks.
- Core components.
- CI pipelines.
- Avoid CRA ejected webpack config, leave it to Vite.
You are expected to setup your own tests, styling according to your needs.
@govtechsg/decentralized-renderer-react-components
@govtechsg/open-attestation
(If you need types, else can be omitted)react
react-dom
- Node (optionally, use nvm to manage node version)
- Node version 14 onwards.
npm i
npm run start
Head off to http://localhost:6006/
to see storybook, while http://127.0.0.1:8080/
to see your actual document rendered in a dummy application.
-
Create your new sample documents json in
src/documents/<YOUR_SAMPLE>/<YOUR_DOCUMENT>.json
. Be sure they conform to either OpenAttestation v2 or v3 schema. -
Create a new "Layout" within
src/components/<YOUR_LAYOUT>
. Ensure your "Layout" name is the same astemplate.name
defined in your sample documents json. -
Create your "Views" (templates) within
src/components/<YOUR_LAYOUT>/<YOUR_TEMPLATES>
. -
Develop whatever you need using storybook, passing in your sample documents json.
-
When done, remember to register the new template to
templateRegistry
insrc/components/DecentralizedRenderer
.
You can follow the template samples provided in
src/components/SampleV2
andsrc/components/SampleV3
.
npm run build
Host your dist
folder in your favourite hosting provider. One example could be netlify.