Skip to content

Getting Started

Create your entry file

Once installed, you can easily spin-up the framework by creating yourself an entry file: ./src/main.ts and then put the following code in it:

All documentation will be written in TypeScript going forward.

typescript
import { Application } from '@sodacore/core';
import HttpPlugin from '@sodacore/http';

const app = new Application({
	autowire: true,
	// Other settings...
});

app.use(new HttpPlugin({
	port: 8080,
}));

app.start().catch(console.error);

Start the framework

You can start the framework by doing:

We suggested to put it in your package.json under scripts section and then you can do bun dev (set it as the dev script).

zsh
bun run ./src/main.ts --target=bun

We set the target to Bun by default, so that when it launches, it will utilise the bun APIs.

Application configuration

Currently there are only a few settings you can set on the Application:

SettingTypeDefaultDescription
autowirebooleantrueWhether the application should autowire, if disabled, you will need to import and register your modules manually, using app.register(ModuleClass).
basePathstringprocess.cwd()This is used to tell the autowire module where to search for packages, by default it will look in your src folder within the process.cwd(), this is an absolute path.
loggerinstanceof Loggernew Logger()The logger instance to use, by default it will use the built-in logger, which is a nicely coloured console logger, but you can extend the existing one and pass it in here.

Next Steps

Well at the moment, you have a basic bun http API application, that is running, but you have defined no paths, so let's add some...

Released under the Apache-2.0 License.