Skip to content

Latest commit

 

History

History
30 lines (17 loc) · 1.17 KB

File metadata and controls

30 lines (17 loc) · 1.17 KB

Next.js App Router + React Server Components

Introduction

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.

Running Locally

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:

  1. pnpm install
  2. 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.

License

This demo is MIT licensed.