Stonyx Framework Core

0.2.2 · active · verified Sun Apr 19

Stonyx is an early-stage, TypeScript-first framework module designed for building modular applications, emphasizing a structured, object-oriented approach. It provides foundational concepts such as an `Application` class, `Context` management, and decorators like `@Component` and `@Service`, hinting at a dependency injection pattern. The package is currently in a pre-release state, with version 0.2.2 being the latest stable release, but development is active with frequent `0.2.3-beta` versions being published. This rapid iteration indicates that the API is subject to change and may not be stable. Stonyx aims to provide a robust core for larger application ecosystems, though specific use cases (e.g., web server, CLI tool) are not explicitly detailed in its current minimal documentation.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a Stonyx application, define a basic component and service using decorators, inject a configuration, and run the service.

import { createApplication, Component, Service } from 'stonyx';

interface MyConfig { message: string; }

@Component()
class MyComponent {
  constructor(private config: MyConfig) {}

  run() {
    console.log(`Component running with message: ${this.config.message}`);
  }
}

@Service()
class MyService {
  constructor(private myComponent: MyComponent) {}

  start() {
    console.log('Service starting...');
    this.myComponent.run();
  }
}

async function bootstrap() {
  const app = createApplication({
    components: [MyComponent, MyService],
    providers: [
      { provide: 'MyConfig', useValue: { message: 'Hello from Stonyx!' } }
    ]
  });

  await app.start();
  const service = app.resolve(MyService);
  service.start();

  // In a real app, you might listen for termination signals or keep the process alive
  // app.stop(); // Example of stopping the application
}

bootstrap().catch(console.error);

view raw JSON →