# @backkit/kernel

> The kernel is the only required dependency for a project based on backkit

Latest version **0.1.1** (published 2023-05-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install @backkit/kernel
pnpm add @backkit/kernel
yarn add @backkit/kernel
bun add @backkit/kernel
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2023-05-11 |
| First published | 2022-04-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 0 |
| Maintainers | dchapkine |

## Links

- npm: https://www.npmjs.com/package/@backkit/kernel
- Repository: https://github.com/backkit/kernel
- Homepage: https://github.com/backkit/kernel#readme
- Issues: https://github.com/backkit/kernel/issues
- npm.io page: https://npm.io/package/@backkit/kernel

## Dependencies (4)

- [glob](https://npm.io/package/glob.md) ^7.1.3
- [awilix](https://npm.io/package/awilix.md) ^4.0.0
- [camelcase](https://npm.io/package/camelcase.md) ^5.0.0
- [@backkit/autoconf](https://npm.io/package/@backkit/autoconf.md) ^0.1.1

## Recent versions

- 0.1.1 (latest) — 2023-05-11
- 0.1.0 — 2023-04-04
- 0.0.6 — 2022-04-02
- 0.0.5 — 2022-04-02

## README

# Backkit Kernel

The kernel is the only required dependency for a project based on backkit

Usualy installed when starting new project, it will install the module, create an entrypoint script (index.js), and precreate services folder if doesn't exist

## install

```sh
# init your project
npm init

# install the kernel
npm install @backkit/kernel --save
```

## runnable service example

services/hello.js

```js
class Hello {
  run() {
    console.log(`hello`) 
  }
}

module.exports = Hello;
```

then start backit app, using `hello` service as entry point

```sh
ENTRYPOINT=hello node index.js
```

## dependency injection example

first let's create a Friend service

services/friend.js

```js
class Friend {
  sayHello() {
    console.log("Hello friend")
  }
}

module.exports = Friend;
```

now let's use Friend service from existing, runnable Hello service

```js
class Hello {
  constructor({friend}) {
    this.friend = friend;
  }

  run() {
    console.log(this.friend.sayHello()); 
  }
}

module.exports = Hello;
```

run it again

```sh
ENTRYPOINT=hello node index.js
```

---
_Source: https://npm.io/package/@backkit/kernel · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
