This is a demo app of the Hacker News website clone, which shows Next.js App Router with support for React Server Components combined with server-side OPA evaluation via @styra/opa.
First start OPA with the included policies:
opa run -ldebug -w -s policies
When using Enterprise OPA, the @styra/opa
SDK as used here will benefit from its Batch API.
Then spin up the Next.js dev setup:
pnpm install
pnpm dev
Go to localhost:3000
.
Click on any story's comments. You'll find them all comments by users with karma less than 1000 (indicated in parenthesis after their name) collapsed.
This happend on the server: it used @styra/opa
to process the comments before returning them to the client, with the policies comment.rego and users.rego.
This demo is MIT licensed.