npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

godprotocol

v3.0.0

Published

A distributed computing environment for Web 4.0 — integrating Agency AI, decentralisation, and virtual computation.

Readme

GodProtocol

A distributed computing environment for Web 4.0 — integrating AI, decentralization, and virtual computation.

GodProtocol is the core implementation of Trinity, a modular, extensible runtime designed to organize computation through Objects, Instances, Datatypes, and Callables (action primitives). It enables developers to build distributed, AI-native applications while abstracting computation into composable virtual components.


Highlights

  • Purpose: Build a flexible virtual computation environment (Trinity) that can be embedded, extended, and deployed locally or across distributed systems.
  • AI Native: Designed for intelligent, autonomous computation.
  • Decentralized: Built with distributed execution in mind.
  • Runtime: Modern Node.js (ES Modules).
  • Minimum Node Version: 18+

Quick Start

Prerequisites

  • Node.js 18 or newer

Install

npm install

Development

Runs using nodemon.

npm run start

Production

Runs the application once without nodemon.

npm run dev

Note

  • npm run start uses nodemon and automatically reloads on file changes.
  • npm run dev executes the runtime a single time.
  • GodProtocol is an ES Module package ("type": "module").

Programmatic Usage

The runtime is bootstrapped from Index.js, which creates a Trinity instance.

import trinity from "./Index.js";

// Trinity runtime instance

Index.js exports the instantiated runtime so it can be embedded inside another project.


Service Interface Lifecycle

Registered service interfaces may define a static boot method. GodProtocol calls each unique interface's hook during gp.boot(), after all registered on_start callbacks complete. Multiple callbacks may be registered; they run in registration order. Each callback can provide a should_skip predicate to selectively omit it when gp.boot(args, { skip: true }) is used, either as a boolean or a function. A function receives the protocol instance, boot arguments, and boot options (including skip). In skip mode, callbacks not marked with should_skip still run; service-interface boot hooks are skipped. Without skip mode, all on_start callbacks run regardless of should_skip, then each unique service interface's static boot hook runs. The interface hook receives the protocol instance and the arguments passed to gp.boot():

gp.on_start(async (gp, args) => {
  // This callback runs even when interface boots are skipped.
}, {
  should_skip: ({ gp, args, skip }) => Boolean(skip),
});

gp.on_start(async (gp) => {
  // This callback runs unless explicitly configured to skip.
}, { should_skip: false });

class ExampleService {
  static boot = async ({ gp, args }) => {
    // Initialize interface-level resources here.
  };

  constructor({ gp, call }) {
    this.gp = gp;
    this.call = call;
  }
}

Interfaces without a static boot method need no lifecycle implementation.

When a request is forwarded to a service, GodProtocol invokes a same-named function on that service's configured interface with the request body and forwarding options. If the interface does not define that operation, the request is forwarded directly to the service as before.

The capabilities object passed to GodProtocol determines which configured services are loaded. Each service config is matched against the supported capabilities and preserved, including an optional interface:

const capabilities = {
  identity: { uri: "profiles.example.com", url: "https://profiles.example.com" },
  workflows: {
    uri: "custom.example.com",
    url: "https://custom.example.com",
  },
};

The same service configuration can be supplied once through the services_config constructor option. GodProtocol hydrates it into capability loading, router registration, and local package routers. The value may be an object or a synchronous/asynchronous function returning an object. GodProtocol invokes the function once with the current instance and waits for the result:

const services_config = () => ({
  identity: {
    uri: process.env.IDENTITY_URI,
    url: process.env.IDENTITY_URL,
  },
});

const gp = new GodProtocol({ services_config, db_config: {}, server: {} });
await identity.router(gp);
await gp.boot();

capabilities remains supported as a backwards-compatible constructor alias. Explicit services_config options passed to add_router or load_locals still override the instance configuration for that registration.

Local Aircode execution

Aircode services execute through the framework's shared Trinity/Manager and each service URI reuses one registered Account. The instance supplies the GodProtocol Service capability and its miner credential; it does not create a compiler, VM manager, resolver, or second Account registry:

const gp = new GodProtocol({
  no_javascript: true,
  miner_key: process.env.MINER_KEY,
  db_config: {},
  server: { domain: process.env.INSTANCE_URI },
  services_config: {
    godprotocol: {
      api_version: "v1",
      uri: process.env.GODPROTOCOL_SERVICE_URI,
      url: process.env.GODPROTOCOL_SERVICE_URL,
    },
  },
});

no_javascript prevents hosting or executing legacy JavaScript routers marked is_old. It does not disable the Node.js server, networking, or Aircode. miner_key authenticates GodProtocol Service capability calls and is used at boot to register the miner and instance runtime. services_config remains the framework capability configuration and is not Aircode service configuration. Call await gp.boot() during instance startup to perform registration.

An Airditor service publishes a release using publish_service_release. Airditor pins the repository's current commit SHA and sends the route metadata and .air source snapshot to GodProtocol Service. Configure GODPROTOCOL_SERVICE_URL (and optionally GODPROTOCOL_SERVICE_URI) for Airditor and invoke POST /api/v1/publish_service_release with the service ID while authenticated as its owner. Runtime requests use X-Service as the service URI and optionally X-Service-Revision as a commit SHA. GodProtocol Service confirms miner acceptance, discovers the published release, and serves source through its version_control operation. On a source-cache miss, GodProtocol Service asks Airditor for that module at the pinned commit revision, then stores the source in the shared Cache for subsequent requests. Runtime imports use the same release-scoped source loader and Account compiler; they do not depend on a VM Oracle. The Cache stores source text and release metadata, never a live HTTP response object.

Aircode route handlers read invocation data from standalone environment identifiers, not a request-object function argument. req is an Aircode object with method, path, matched route, query, params, filtered headers, body, request_id, service_uri, service_revision, and handler. profile contains the authenticated profile (or void when absent). gp is a read-only, credential-free facade exposing version, instance_uri, runtime_type, platform_uri, and no_javascript. These bindings are isolated per execution thread, so concurrent requests do not share request state. platform is the platform object supplied by Identity at req.headers.platform. services and req.services resolve services through the current GodProtocol instance, using the request's authenticated profile and platform unless overridden in the options.

The profile passed to get_service(name, { profile }) is also the default profile for calls made through that service. GodProtocol resolves a linked session for that profile and target service; the session cache is scoped by source profile, source platform, and service URI. When the service config includes a profile_key, GodProtocol checks that key's /me profile matches the linked session's profile before sending a request with the user's session. Missing or mismatched identities fail closed. If no target session exists, Identity signs in or provisions a target profile using the source profile's email and the target platform's matching user profile type.

For API-key-authenticated requests without a user profile, service crossover uses the authenticated platform's owner profile (platform.profile). An explicit request profile takes precedence.

A service route can constrain the authenticated profile type with a single allowed value in its header schema:

schema: {
  headers: {
    "profile.profile": {
      type: "string",
      required: true,
      enum: ["<target-profile-type-id>"],
    },
  },
}

If that check fails, the validation response includes expected_profile_type. Profile-bound service calls use it to request a target session for that profile type from Identity, then retry the route once with that typed session.

For example, a handler can read req.params.item_id, req.body.name, profile._id, platform.name, or gp.runtime_type directly. It can resolve a service with req.services("socket", { interface: true }) or services("socket", { interface: true }) and call its interface methods. These values can be assigned to local variables; aliases to Aircode objects retain their reference when the original variable is reassigned. It may return a JSON-compatible value or an HTTP response object with status/statusCode, headers, and body.

Packages declare their required and optional services alongside the package's service configuration in services/index.js:

const services = async (services_config, gp) => {
  // Build the routes and interfaces consumed by this package.
};

services.dependencies = {
  settings: {
    required: true,
    package_name: "@web4.0/settings",
    version: "^1.0.5",
  },
};

export default services;

The router already imports this factory, so it only needs to pass the package name and factory to GodProtocol:

if (!(await gp.load_package_services("example", services))) return;

required: true means the host must configure that service with either a remote url or local local route. A remote route imports no package code. A local route imports package_name and loads its router. version records the package version range the host should install for local use; npm resolves the actual version in the host application. The dependency declaration does not install that package or its dependency chain. GodProtocol tracks packages currently being loaded so cyclic local dependencies do not register routers recursively.

The loader uses the package manager's installed resolution for package_name; version is the host's install range, not a runtime version selector. If two packages need different versions of the same implementation, install an npm alias for the desired version and set that alias as package_name.

GodProtocol prints each passing dependency as soon as it is verified. If checks fail, it prints one combined report with all failures found and a copy-paste npm install command for the local packages that need installing. Each failure names both the package that declared the dependency and the service it could not use, for example:

- @web4.0/identity requires service "settings", but it is not configured.
  Set services_config.settings with a remote url or local route.

To install the local packages (if you choose local routes), run:
  npm install '@web4.0/settings@^1.0.5'

Supported capabilities define their API versions (v3 for identity, v2 for workflows, and v1 for cache). Configs for services not listed as supported capabilities are ignored.

For service configuration checks, gp.utils.validateService(names, config) returns a boolean without logging. Use gp.utils.assertServices(names, config) when the services are required; it throws one error listing missing or malformed entries. To decide whether a package should mount local routes, use gp.utils.getLocalServicePrefix(name, config). It returns the configured local prefix, or null for a remote or omitted service. The older validateRouter method remains as a deprecated alias.


Environment Variables

| Variable | Description | | --------- | --------------------------------------------------------- | --- | --------------- | | Trinity | Runtime name passed into new Trinity(process.env.Trinity | | "GodProtocol") |


Project Structure

.
├── Index.js
├── package.json
├── Objects/
├── Instances/
├── Datatypes/
├── callables/
├── html/
└── utils/

Index.js

Entry point that instantiates the Trinity runtime.


Objects/

Contains the core runtime classes.

Examples include:

  • Trinity
  • Oracle
  • Repository
  • Manager
  • Virtual Machine
  • Block

These implement the primary execution model of GodProtocol.


Instances/

Contains runtime-specific objects such as:

  • Accounts
  • Events
  • Folders
  • Responses

These represent live entities within the runtime.


Datatypes/

Contains the primitive and compound data structures used throughout Trinity.

Examples include:

  • String
  • Number
  • Boolean
  • Array
  • Callable wrappers

Also includes:

Datatypes/functions/

which provides helper modules like storage and wallet utilities.


Callables/

Contains the runtime's action primitives.

Each callable is a lightweight executable module registered through:

callables/register.js

HTML/

Provides utilities for:

  • Loading
  • Parsing
  • Rendering
  • Executing HTML-based runtime assets

Utils/

Contains shared infrastructure including:

  • HTTP services
  • Socket server
  • HTTPS server creation
  • Cryptography
  • Hashing
  • Certificates

Important files:

  • create_server.js
  • socket_server.js
  • services.js

Files to Read First

If you're exploring the codebase, start here.

Objects/Trinity.js

The heart of the runtime.

Responsible for wiring together:

  • Objects
  • Instances
  • Datatypes
  • Callables

Objects/Oracle.js

Implements communication with Oracle endpoints using the HTTP service layer.


utils/create_server.js

Server initialization.


utils/socket_server.js

Socket infrastructure for runtime communication.


Core Concepts

Trinity

The root runtime.

Responsible for orchestrating every component in GodProtocol.


Objects

Large runtime components.

Examples:

  • Repository
  • Block
  • Manager
  • Oracle
  • Virtual Machine

Instances

Runtime-bound entities representing live state.

Examples:

  • Accounts
  • Events
  • Responses

Datatypes

Strongly typed wrappers responsible for:

  • Validation
  • Serialization
  • Runtime consistency

Callables

Small executable modules that perform runtime actions.

They are dynamically registered and invoked throughout Trinity.


Development

Creating a Callable

  1. Create a module inside:
callables/functions/
  1. Register it in:
callables/register.js

Creating a Datatype

Follow the existing patterns inside:

Datatypes/

Examples:

  • str.js
  • num.js
  • bool.js
  • arr.js

Creating Runtime Objects

Core runtime behavior belongs inside:

Objects/

Whenever adding a new runtime capability, implement it as an Object and wire it into Trinity.


Runtime State

Per-runtime state should live inside:

Instances/

Keep Objects as stateless as possible.


HTTPS Certificates

Development certificates are included:

utils/server.cert
utils/server.key

These are intended only for local development.

Do not use them in production.


Dependencies

Runtime

  • aircode4
  • generalised-datastore

Development

  • nodemon

Install everything with:

npm install

Testing

GodProtocol ships with a custom test runner and test harness under server/Testing. It supports suites, lifecycle hooks, assertions, mocks, route requests, handlers, services, and an in-memory database.

See TESTING.md for the complete test authoring and execution guide, including CLI usage, test-file conventions, available helpers, and current repository status.


Troubleshooting

Node Version Errors

Ensure you're using:

  • Node.js 18+

ES Module Errors

Verify that your environment respects:

"type": "module"

inside package.json.


Missing Imports

Reinstall dependencies:

npm install

If using VS Code or another IDE, restart the language server.


HTTPS Issues

Development certificates are included.

Either:

  • trust the local certificates, or
  • switch to HTTP during development.

Contributing

  1. Fork the repository.
  2. Create a feature branch.
  3. Implement your changes.
  4. Add tests where appropriate.
  5. Open a Pull Request with a clear description.

Please follow the existing architecture and coding conventions.


License

Licensed under the ISC License.

See package.json for details.


Author

Savvy


Repository

https://github.com/immanuel-savvy/GodProtocol


Roadmap

Future improvements include:

  • GitHub Actions CI
  • Automated testing
  • Public Trinity API documentation
  • Architecture diagrams
  • Runtime examples
  • Embedding examples
  • Oracle client tutorials
  • Distributed execution examples

GodProtocol is the computational substrate behind Trinity—a virtual runtime where AI, decentralized systems, and programmable computation converge to power the next generation of intelligent applications.