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:
| App | What it does | Open it | Source |
|---|---|---|---|
| DER | Draws the database of an app as a diagram. | der.frameworkphp.com.ar | GitHub |
| Diff | Shows what changed between two files. | diff.frameworkphp.com.ar | GitHub |
| JSON | Edits, queries and compares JSON documents. | json.frameworkphp.com.ar | GitHub |
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.
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:
| Layout | What you get |
|---|---|
| Side by side | The old file on the left and the new file on the right, with the lines that changed beside each other. |
| Unified | Both files in one column, the removed lines over the added ones. |
| Structure | Two 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:
| View | What you get |
|---|---|
| Text | The document as it is written, with line numbers and colours. Brackets fold, and long lines can wrap. |
| Tree | A 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. |
| Table | A 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:
| Tool | What it does |
|---|---|
| Format | Writes the document with a line for each key and each item. |
| Smart format | Keeps what fits in a line on one line, and lines up the colons of each object. |
| Compact | Writes the document in a single line. |
| Repair | Mends 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. |
| Sort | Puts the keys of an object in order, or the items of a list by any value they have. |
| Transform | Runs 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. |
| Search | Finds a text in the keys and the values, and replaces it. |
| JSON Schema | Checks 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.
Open one from a link
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:
| Form | Looks like | Use it for |
|---|---|---|
| Written out | #old=…&new=… in Diff, #json=… in JSON | Short content. Each value is percent-encoded. |
| Packed | #z=… | Anything longer. The fields go in a JSON object, which is gzipped and written in base64. |
The fields of a Diff link
A Diff link takes these fields:
| Field | What it holds |
|---|---|
old | The text of the old file. |
new | The text of the new file. |
oldName, newName | The names of the files. They are optional, and the extension picks the colours of the code. |
layout | The layout to open in: split, unified or tree. It is optional. |
The fields of a JSON link
A JSON link takes these fields:
| Field | What it holds |
|---|---|
json | The document. In a packed link it can be the JSON itself or its text. |
name | The name of the document. It is optional. |
mode | The view to open in: tree, table or text. It is optional. |
right, rightName | A second document for the other panel, and its name. They are optional. |
compare | true to compare the two documents. It is optional. |
Write a packed link
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.