Nightprint

Nightprint draws software architecture as machines: a Next.js site renders published machines in the browser from an engine, a 3D scene and a UI kit that share design tokens.

Assembling the machine…

Step 1 / 7

Build writes the machine pages

At build time, the page's generateStaticParams lists the machine slugs, and each page is written into the static export.

Event log · 1
  1. 0.00 msWRITEgenerateStaticParams → /m/[slug]

The concept

Nightprint draws software architecture as machines: a Next.js site renders published machines in the browser from an engine, a 3D scene and a UI kit that share design tokens.

The project has three zones, read left to right. Readers hold the visitor's browser, a search crawler or a link-preview fetcher; they reach the site only through the web app's pages and image endpoints. The delivery zone holds the code that turns a machine into a page: the Next.js app, the site views, the 3D scene, the UI kit and the film package.

The core zone holds what the rest depends on: the engine, which defines the machine format and plays it; the design tokens; and the catalogue of published machines, which is written with the engine's definition function.

The imports keep one rule: they point inward, from delivery to core, and not back. The engine imports only zod. The UI kit imports the tokens and no engine code, and the site views are the seam that turns the engine's snapshot into the plain props the UI kit takes.

The web app builds its pages once, at build time, into static files; the browser then runs the stage. Each step of a machine moves a token along a route, and the two what-if switches show what would break if an import crossed a boundary the code keeps today.

The run, step by step

Every scenario, in words.

What the machine plays, step by step. Every route it travels stands on an import in the code.

Open a machine page

7 steps
  1. Play

    Build writes the machine pages

    At build time, the page's generateStaticParams lists the machine slugs, and each page is written into the static export.

  2. Play

    A visitor asks for a machine page

    The visitor's browser asks for a machine's page: one of the web app's pages, already built for that slug.

  3. Play

    The page hands the slug to the views

    The page route passes the slug to the site views, which build the machine's view.

  4. Play

    The views read the machine

    The site views read the published machine from the catalogue by its slug.

  5. Play

    The views ask the engine for a snapshot

    The site views call the engine to resolve the machine's scenario into a snapshot for the page.

  6. Play

    The visitor gets the page

    The page's HTML was written at build time: the web app sends it as a file, and no server runs on the way back.

  7. Play

    The stage draws the machine in the browser

    In the browser, the stage hands the machine to the scene, which draws the plate, the parts and the routes.

Share a machine's preview image

4 steps
  1. Play

    A fetcher asks for the image

    A crawler or a social network asks for the preview image of a machine's page.

  2. Play

    The image route builds a card

    The image route hands the machine to the og card, which takes its headline from the machine.

  3. Play

    The card reads the machine

    The site views read the machine from the catalogue by its slug, so the card follows the published definition.

  4. Play

    The image goes back to the fetcher

    The image returns along the route it came by, from the views through the web app to the fetcher.

Play a step on the stage

4 steps
  1. Play

    The visitor presses Play

    The visitor presses Play on the stage, and the site views advance the machine's player by one step.

  2. Play

    The engine advances the player

    The site views call the engine, which advances the simulation in fixed steps and works out which tokens move.

  3. Play

    The scene lights the step

    The site views hand the playing state to the scene, which lights the parts and routes of the current step.

  4. Play

    The scene reads the route geometry

    The scene asks the engine for the points of each route, so each token travels along its drawn pipe.

    • With Import the scene in the engine · adds a step after it

      Play

      The engine imports the scene

      With this switch on, the engine imports the scene package, so the core depends on three.js and on an adapter. The rule breaks.

    • With Import engine in the UI kit · adds a step after it

      Play

      The UI kit imports the engine

      With this switch on, the UI kit imports the engine directly, skipping the site views. The UI kit no longer stays free of the data layer.

Real projects

Draw your own repository.

Paste a public JavaScript or TypeScript repository: it comes back drawn the same way, every route standing on an import its code has. It takes two or three minutes, and the drawing gets a link you can share.