# kern is a backend language that refuses to compile security bugs.

> kern is a backend language that refuses to compile security bugs. European, cloud-native, and verifiable all the way down.

Source: https://kern-lang.eu/

European. Cloud-native.   
Verifiable all the way down.

[Get started](https://kern-lang.eu/get-started) [Try it in the browser](https://kern-lang.eu/playground) 

`curl -fsSL https://kern-lang.eu/install.sh | sh`

main.kern

```
fn main():
    email = personal_data("marie@eu.org", "signup confirmation")
    reply = llm_complete("mistral", email)
    print(reply)
```

```console
$ kern build main.kern
error[E0302]: PersonalData<T> cannot be passed to 'llm_complete'
— use pd_anonymize() or pd_access() with explicit reason first
```

## Why kern

### Secure by compilation

```console

```

They fail the build, not production.

[Try it in the playground](https://kern-lang.eu/playground) 

### One small binary

```console

```

A web service compiles to about 115 KB.

[Get started](https://kern-lang.eu/get-started) 

### Verifiable all the way down

```console

```

The part you take on trust: 46,006 named lines of C, with a written ledger.

[Read the source (opens in a new tab)](https://codeberg.org/PUAGroup/kern-lang) 

[Why kern exists ](https://kern-lang.eu/why-kern) 

## Mistakes stop at the compiler.

Not a linter warning you can ignore. A build that does not pass.

#### Personal data

```
fn send_email(user: User):
    analytics.track(user.email.value)
```

```console
$ kern build main.kern
error[E0302]: PersonalData<str> cannot reach a sink that does not declare PersonalData
```

#### Injection

```
from db.postgres import pg_query_one
from std.cap_db import db_root

fn main():
    db = db_root()
    user_id = "42"
    pg_query_one(db, 0, "SELECT name FROM users WHERE id = " + user_id)
```

```console
$ kern build main.kern
error[E0300]: must be a string literal — got a string concatenation (a + b)
```

#### Capabilities

```
# Authority is explicit. Only main can mint it.
from std.cap_net import net_root, net_http_serve

fn main():
    net = net_root()
    # No cap, no IO. That is E0404.
    net_http_serve(net, 8080)
```

#### Model output

```
from std.cap_ai import ai_root, ai_complete
from std.untrusted import untrusted_validate_length

fn answer(ai: Cap<Ai>, question: str) -> Result<str>:
    reply = ai_complete(ai, "mistral", question)
    # Straight to a sink would be E0303.
    return untrusted_validate_length(reply, 1, 4000)
```

Personal data: tag a field as personal once and the compiler follows it into every sink.

Injection: this rule prevents SQL injection by construction.

Capabilities: authority is an argument you pass, so an audit reads the grants.

Model output: anything an LLM returns comes back marked untrusted.

tests, 100% pass

2,241

stdlib modules

435

compiler files bootstrap

13/13

US dependencies

0

## A running service in three commands.

No runtime to install, no container to build, nothing to configure.

[Read the guide](https://kern-lang.eu/get-started) [Open the playground](https://kern-lang.eu/playground) 

$ curl -fsSL https://kern-lang.eu/install.sh
    | sh
$ kern new api my-service
    && cd my-service
$ kern run

  my-service listening on :8080

$ curl localhost:8080/health
  {"status": "ok"}

1. ### Install  
`curl -fsSL https://kern-lang.eu/install.sh | sh`
2. ### Create a service  
`kern new api my-service && cd my-service`
3. ### Run it  
`kern run`my-service listening on :8080

## Latest releases

### [v1.2.0](https://kern-lang.eu/releases/1.2.0) 

Egress control  
Descriptor ownership

Second minor  
release

Security hardening

### [v1.1.2](https://kern-lang.eu/releases/1.1.2) 

Pool-mode liveness  
Cooperative Mutex

Patch  
release

mbedTLS ABI fix

### [v1.1.1](https://kern-lang.eu/releases/1.1.1) 

Concurrent HTTP fix  
Boxed union layout

Patch  
release

Release pipeline

[All releases ](https://kern-lang.eu/releases) 

## Keep it independent

kern is EUPL-licensed and community-funded. No venture capital, no US parent company, no strings. Contributions go directly to compiler and stdlib development.

BTC`3HcHaeq9gYrxxLqzbpBSuy3e6cGAw6GwZc`
