Stone.jsDocs
Paradigm

Essentials

Application & bootstrap

Every Stone.js app has one manifest: a class marked with @StoneApp (or a defineStoneApp value). It names the app, lists the adapters that give it a context, and sets app-wide options. It is the only file that knows about platforms.

#Declaring the app

The manifest carries no logic of its own. Adapters and blueprints stack on it as decorators (or as an array, imperatively); options go to @StoneApp.

app/Application.tsdeclarativeimperative
import { StoneApp } from '@stone-js/core'
import { Routing } from '@stone-js/router'
import { NodeHttp } from '@stone-js/node-http-adapter'

@NodeHttp()
@Routing()
@StoneApp({
  name: 'tasks',
  logger: { level: 'info' }
})
export class Application {}
import { defineStoneApp } from '@stone-js/core'
import { routerBlueprint } from '@stone-js/router'
import { nodeHttpAdapterBlueprint } from '@stone-js/node-http-adapter'

export const App = defineStoneApp(
  { name: 'tasks', logger: { level: 'info' } },
  [routerBlueprint, nodeHttpAdapterBlueprint]
)

#App options

OptionTypeDefaultDescription
namestring·The application name, used in logs and tooling.
logger{ level, ... }{ level: 'info' }Logger configuration (see Logging).
debugbooleanfalseVerbose diagnostics and richer error output.
middlewareMixedPipe[]·Global middleware for every event.
providersMixedServiceProvider[]·Service providers to register.

#One handler, or a router

A minimal app can implement a single handler right on the manifest. The moment you need more than one entry point, add @Routing() and delegate to controllers, which is what most apps do.


Stone.js

Your app exists in every runtime. Until you run it.

An open-source project by Stone Foundation
Created by Mr. Stone (Evens Pierre)