Framework
Introduction

Apps

The framework comes with three small apps that run in the browser. DER draws a database, Diff compares two files, and JSON edits a JSON document.

Each app is a single page with no server behind it. Everything you put in an app stays in your browser. Nothing is sent anywhere, and the app opens the way you left it.

These are the apps and where each one lives:

AppWhat it doesOpen itSource
DERDraws the database of an app as a diagram.der.frameworkphp.com.arGitHub
DiffShows what changed between two files.diff.frameworkphp.com.arGitHub
JSONEdits, queries and compares JSON documents.json.frameworkphp.com.arGitHub

DER

DER reads the Schema JSON the build writes and draws it as a diagram. Every table is a box on a board. Every foreign key is a line between the two tables it joins.

You pick the tables to show, drag them around and gather them into groups. A database can have several boards, one for each part of it.

The DER guide covers loading a database, building the board, the settings and the shortcuts.

Diff

Diff compares two files and shows what changed. Paste the old file on one side and the new file on the other, or drop them in, and click Compare.

The result can be read in three ways:

LayoutWhat you get
Side by sideThe old file on the left and the new file on the right, with the lines that changed beside each other.
UnifiedBoth files in one column, the removed lines over the added ones.
StructureTwo JSON files compared by what they hold, key by key. The order the keys were written in does not count as a change.

Inside a line that changed, the words that changed are marked. The lines that did not change are folded away, and Unfold brings them back. Wrap breaks the long lines. A strip beside the result shows where every change is, and the arrows at the top walk from one change to the next.

The code is coloured by the language of the file. Diff takes the language from the name of the file, or from what the text looks like when it has no name.

JSON

JSON is an editor for JSON documents. It has two panels, so two documents can be open at once. Each panel shows its document in one of three ways:

ViewWhat you get
TextThe document as it is written, with line numbers and colours. Brackets fold, and long lines can wrap.
TreeA row for each key and each value, set in under what holds it. Rows open and close. A key or a value is edited in place.
TableA list shown as a table, with a row for each item and a column for each value. A click on a column sorts by it.

The toolbar of a panel works on its document:

ToolWhat it does
FormatWrites the document with a line for each key and each item.
Smart formatKeeps what fits in a line on one line, and lines up the colons of each object.
CompactWrites the document in a single line.
RepairMends a text that is almost JSON: single quotes, keys without quotes, comments, missing or extra commas, brackets that were never closed. It shows only when the text is not valid.
SortPuts the keys of an object in order, or the items of a list by any value they have.
TransformRuns a query over the document and shows the result before applying it. A form writes the query that filters, sorts and picks, or you write it by hand.
SearchFinds a text in the keys and the values, and replaces it.
JSON SchemaChecks the document against a schema and lists every place that does not match.

A query for Transform can be written in three languages. The first is a small language of steps joined by a bar, where each step hands its result to the next:

.users | filter(.age >= 18) | sort(.name) | pick(.name, .age)

The other two are JSONPath and JavaScript.

The buttons between the two panels copy a document to the other side and compare the two. While they are compared, the two trees are drawn row by row and scroll together, and every difference is marked.

JSON also reads a CSV file as a list of objects, and saves a list as a CSV file.

What the apps share

The three apps look and work the same way:

  • The logo switches apps. Click the logo at the top left and pick another app, or these docs.
  • The title opens what you kept. DER lists the databases you loaded. Diff keeps every pair of files you compare, and JSON keeps every document you work on. In Diff and JSON, an entry you save with a name stays for good.
  • The address follows the history. In Diff and JSON each entry has its own address, so the back and forward buttons of the browser walk through them.
  • Everything has a key. Press ? in any app to see its shortcuts.
  • Light and dark. The switch at the top right picks light, dark, or the choice of the system.

Diff and JSON can open what a link carries. The content goes after the # of the address, and the browser never sends that part to a server. A script or an LLM can then hand you a diff or a document as a link, with no file to send.

A link is written in one of two forms:

FormLooks likeUse it for
Written out#old=…&new=… in Diff, #json=… in JSONShort content. Each value is percent-encoded.
Packed#z=…Anything longer. The fields go in a JSON object, which is gzipped and written in base64.

A Diff link takes these fields:

FieldWhat it holds
oldThe text of the old file.
newThe text of the new file.
oldName, newNameThe names of the files. They are optional, and the extension picks the colours of the code.
layoutThe layout to open in: split, unified or tree. It is optional.

A JSON link takes these fields:

FieldWhat it holds
jsonThe document. In a packed link it can be the JSON itself or its text.
nameThe name of the document. It is optional.
modeThe view to open in: tree, table or text. It is optional.
right, rightNameA second document for the other panel, and its name. They are optional.
comparetrue to compare the two documents. It is optional.

This writes a packed link to a diff of two files in Python:

import base64, gzip, json

fields = { "old": old_text, "new": new_text, "oldName": "a.json", "newName": "b.json" }
packed = base64.urlsafe_b64encode(gzip.compress(json.dumps(fields).encode())).decode()
print("https://diff.frameworkphp.com.ar/#z=" + packed)

A link to JSON is written the same way, with its own fields and https://json.frameworkphp.com.ar/ as the address.

Each app publishes this format as plain text for an LLM to read, at diff.frameworkphp.com.ar/llms.txt and json.frameworkphp.com.ar/llms.txt.