Better Core
API Reference

BetterCore

The BetterCore class is the main class for the Better-Core library. It's responsible for allowing you to define custom BetterCore configurations and provides all of the functionality to make Better Core run.

Imports

import { BetterCore } from "better-core";
import BetterCore from "better-core";

Example Definition

import {  } from "better-core";

const  = new ();

Parameters

The BetterCore constructor takes one optional parameter, which is the options object.

The options object is typed as BetterCoreOptions, however it's expected to be passed as a satisfies object to preserve type inference.

import { , type  } from "better-core";

const  = {
	: "/api/core",
	: "http://localhost:3000",
} satisfies ; // Use `satisfies` to correctly infer.

const  = new ();

BetterCoreOptions

The BetterCoreOptions type defines the configuration options for a BetterCore instance.

import type { BetterCoreOptions } from "better-core";
type BetterCoreOptions = {
    basePath?: LiteralString;
    baseOrigin?: LiteralString;
    auth?: BetterAuthOptions;
}

Properties

Methods

On this page