JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q62998F
  • License MIT

VoltX framework engine — config loader, plugin system, runtime

Package Exports

  • @voltx/core

Readme

@voltx/core
Framework engine — config, plugins, app lifecycle

npm downloads license


The core engine of the VoltX framework. Provides createApp(), defineConfig(), plugin system, and app lifecycle management. Wires together server, AI, database, and auth into a single entry point.

Installation

npm install @voltx/core

Quick Start

// voltx.config.ts
import { defineConfig } from "@voltx/core";

export default defineConfig({
  name: "my-app",
  port: 3000,
  ai: { provider: "cerebras", model: "llama3.1-8b" },
  server: {
    routesDir: "src/routes",
    cors: true,
  },
});
// src/index.ts
import { createApp } from "@voltx/core";
import config from "../voltx.config";

const app = createApp(config);
app.start();

API

defineConfig(config)

Type-safe configuration helper. Merges your config with sensible defaults.

const config = defineConfig({
  name: "my-app",
  port: 3000,
  ai: { provider: "openai", model: "gpt-4o" },
  db: { url: process.env.DATABASE_URL },
  plugins: [myPlugin],
});

createApp(config)

Creates a VoltX application instance with server, plugins, and lifecycle hooks.

const app = createApp(config);

// Register plugins
app.use({ name: "analytics", setup: (ctx) => { /* ... */ } });

// Graceful shutdown hooks
app.onShutdown(async () => { /* cleanup */ });

// Start the server
await app.start();

createLogger(prefix?)

Creates a structured logger with info, warn, error, and debug methods.

const logger = createLogger("my-app");
logger.info("Server started");

Configuration Options

Option Type Default Description
name string "voltx-app" Application name
port number 3000 Server port
ai object AI provider config
db object Database config
auth object Auth config
server object Server overrides
plugins array [] Plugin list

Part of VoltX

This package is part of the VoltX framework. See the monorepo for full documentation.

License

MIT — Made by the Promptly AI Team