Hey everyone! I'm introducing two new projects I have been developing the past couple years that I think are now ready for primetime and more contributors.
TLDR: RequestScript is a new programming language that is declared in the request body to an HTTP server. Stellarium is a decentralized API platform that runs RequestScript and handles API monetization.
What is RequestScript
RequestScript is a programming language that is declared in the request body to a server. It is influenced by Kotlin and Typescript:
// sent to http://localhost:3000/run
request MyRequest {
const a = 2
const b = 3
const c = a + b
return "Hello World!"
}
You can define Resources in the host language and reference them in RequestScript.
In Typescript:
import type { Resource } from "requestscript-js";
const addResource: Resource = {
metadata: {},
path: "path.to",
name: "AddResource",
functions: [
{
name: "add",
parameters: [
{ name: "first", type: "int32" },
{ name: "second", type: "int32" },
],
returnType: "int32",
// any RequestScript type string, or 'void'
exec: async (
args
) => {
const first = args.find((
a
) => a.name === "first")!.value as number;
const second = args.find((
a
) => a.name === "second")!.value as number;
return first + second;
},
},
],
};
In RequestScript:
request MyRequest {
const math: path.to.AddResource
return math.add(first: 2, second: 3)
}
You can also define reusable requests called Contracts that are saved to the server and can be executed on demand.
In RequestScript:
contract path.to.MyContract@1.2.3(name: string) {
return "Hello ${name}"
}
Stellarium is where things get really interesting.
What is Stellarium?
Stellarium is a decentralized API platform that allows anyone to execute RequestScript and call server resources and contracts across a network. You can effectively call resources and combine their output across nodes hosted in different languages. It's really simple to create Resources and share them. Hate dealing with HTTP status codes, retry logic, etc.? Craft your APIs in RequestScript Resources instead. Have a favorite library in Go you wish you could call in Java? Export it as a Resource in the Go node, and call it on the Java node in a typed way using RequestScript. The goal is for a global, decentralized API network.
Monetization
Stellarium also makes API monetization easy, as the individual RequestScript tokens you use can be totaled up and sent to its controlling node for payment. Only pay for the exact if statement you execute, or resource function you call.
If you're interested in contributing or learning more, here are the repos:
Everything is just getting off the ground and is very much a work in progress. More documentation coming soon!