Skip to content

Quickstart

Try Verdict locally in 5 minutes without setting up external infrastructure or modifying application code.

In this walkthrough you will:

  • Install the Verdict CLI
  • Start a local Verdict Server
  • Write, validate, and publish a .vd policy
  • Insert facts and run authorization checks
  • Extend the policy to support document sharing

You need Node.js 24 or newer for this walkthrough.

Install the CLI with the shell installer:

curl -fsSL https://useverdict.dev/install.sh | sh

Or install it with your JavaScript package manager:

npm i -g @useverdict/cli

Confirm that the CLI is available and create a working directory:

verdict --help
mkdir verdict-quickstart
cd verdict-quickstart

Start a local Verdict Server in your terminal:

verdict serve

This starts Verdict Server on localhost:4891 and creates ./verdict.db to persist your policy and facts. Keep this terminal running for the rest of the guide.

Create policy.vd in the same directory:

declare is_owner(User, Document);
allow(user: User, "read", document: Document) if
is_owner(user, document);

Open a second terminal in verdict-quickstart, then validate and publish the policy:

verdict validate policy.vd
verdict policy publish --local policy.vd

Add an ownership fact to the local server:

verdict fact add --local 'is_owner(User:alice, Document:handbook)'

Check whether User:alice and User:bob can "read" Document:handbook:

verdict authorize --local User:alice read Document:handbook
# Allowed
verdict authorize --local User:bob read Document:handbook
# Denied

To let users share documents, add a shared_to fact declaration and allow rule to policy.vd:

declare is_owner(User, Document);
declare shared_to(Document, User);
allow(user: User, "read", document: Document) if
is_owner(user, document);
allow(user: User, "read", document: Document) if
shared_to(document, user);

Republish the updated policy, add a shared_to fact for User:bob, and re-run the check:

verdict policy publish --local policy.vd
verdict fact add --local 'shared_to(Document:handbook, User:bob)'
verdict authorize --local User:bob read Document:handbook
# Allowed

Stop the server in the first terminal with Ctrl+C and remove the verdict-quickstart directory when you are finished.

SymptomCheck
Connection failureKeep the server terminal running and use port 4891
Port already in useStop the process using 4891 before starting this walkthrough