Publish with Next.js

Next.js can publish the declaration as an ordinary static file.

Add the declaration

Create this directory and file in the Next.js project’s public directory:

public/
  .well-known/
    josh

A participant affirming Josh identity:

{
  "version": 1,
  "josh": true
}

josh may instead be false for Declined Josh Identity, or omitted for Undeclared Josh Identity. The implementation guide defines those three declarations. Do not invent other values. Publishing any valid version 1 declaration establishes participation according to RFC-JOSH-0002.

next dev and next start serve files from public/ at the site root. With static export (output: "export"), a normal build copies them into out/. After:

next build

the export should contain:

out/
  .well-known/
    josh

The deployed resource is then:

https://example.invalid/.well-known/josh

Check the Next.js build

Before deploying a static export, confirm that Next.js produced the exact extensionless file:

test -f out/.well-known/josh
cat out/.well-known/josh

You can also check the local app server while developing:

next dev

Then:

curl -i http://localhost:3000/.well-known/josh

Treat next dev, next start, and static export as separate modes when you verify. The local check confirms that the resource exists at the expected path. Always repeat the check against the deployed site because production response headers are controlled by the hosting platform.

Serve it as JSON

RFC-JOSH-0002 associates the declaration with the application/json media type. A server SHOULD return:

Content-Type: application/json

next dev may serve the extensionless file as application/octet-stream. Static export does not apply Next.js headers configuration. The host chooses the production media type.

Sites published below the origin root

A well-known URI belongs at the root of an origin.

For a site whose public URL is:

https://example.invalid/app/

the Joshternet declaration is still:

https://example.invalid/.well-known/josh

It is not:

https://example.invalid/app/.well-known/josh

Next.js basePath does not relocate the well-known URI under that prefix. A deployment that only controls a path under someone else’s origin cannot declare for that origin unless the host routes /.well-known/josh appropriately.

Check the deployed URL

Check the live origin with Check a declaration.

Or check the live URL directly:

curl -i https://example.invalid/.well-known/josh

Confirm all of the following:

Publishing the file declares participation. It does not separately notify JoshBot or require registration with joshternet.org.

Stop publishing

To stop declaring participation from a Next.js site, remove public/.well-known/josh, rebuild, and redeploy so the live origin no longer serves a valid declaration. Remove any host header rules that exist only for that path.

A deliberate 404 Not Found or 410 Gone at /.well-known/josh indicates that no declaration is currently published. Temporary timeouts, TLS problems, DNS failures, and server errors do not mean the participant intentionally left.

Tested