The TypeScript Framework
for Enterprise Scale

High-quality TypeScript libraries and next-gen backend framework.
Leverage TypeScript to the fullest, in completely new ways.

npm init @deepkit/app my-deepkit-app

What is Deepkit Framework?

Deepkit Framework is a NodeJS Framework written in and for Typescript focusing on enterprise scale web applications while also providing tools for the whole tech-stack including frontend. It is a set of reusable Typescript libraries that can be used standalone and a framework that brings them together.

Learn more

ORM

MySQL, PostgreSQL, SQLite, MongoDB

Runtime TypesValidationReflection
SerializationWorkflow Engine
HTTP Router

Framework

A framework that brings aligned libraries together to make web application development faster, more productive, and easier than ever.

Event System
ConfigurationBrokerModules
ProfilerDebuggerBSON
Template EngineDependency InjectionRPCCLI

Major Leap in Efficiency

By using TypeScript for frontend and backend with a framework that fully utilises all advantages of a single technology stack and allowing you to share code like models, validations, business logic, it skyrockets your performance enabling you to build web applications much more robust and much faster.

By applying enterprise design patterns with the power of TypeScripts's type system at runtime, you accelerate the development speed and increase quality dramatically.

Learn more
Major Leap in Efficiency

Runtime Types

A revolutionary runtime type system for JavaScript, powered by TypeScript types. Deepkit's type compiler makes it possible to use the whole TypeScript type system in any JavaScript runtime for the first time enabling completely new ways of writing data driven applications.

Define your types in powerful TypeScript expression without workarounds and use them as real values in frontend, API, database, documentation, and much more.

Learn more
type status = 'pending' | 'running' | 'finished';
// ['pending', 'running', 'finished']
valuesOf<status>();

interface User {
    id: integer & PrimaryKey;
    created: Date;
    username: string & MinLength<3> & Unique;
    email: Email;
    firstName?: string;
    lastName?: string;
}

// Full access to all computed type information
const reflection = ReflectionClass.from<User>();

// Type information of arbitrary type expressions
// {kind: ReflectionKind.class, types: [...]
type CreateUser = Omit<User, 'id'>;
typeOf<CreateUser>();

Validation and Serialization

Run validation and serialization at runtime with the full power of TypeScript types, without making any compromises in expressiveness or performance.

With support for all TypeScript type expression, including generics, classes, interfaces, unions, intersections, and more. Feel the power of one of the most versatile type systems in the world in runtime.

Learn more
type Username = string & Unique & MinLength<4>;

interface User {
    id: number & Positive;
    created: Date;
    username: Username;
    email?: Email;
    firstName?: string;
}

is<User>({
    id: 1, username: 'Peter',
    created: new Date
}); //true, automatic runtime type guard

cast<User>({
    id: '2', username: 'Peter',
    created: '2023-09-15T14:24:06.439Z'
}); //{id: 2, username: 'Peter', ...}

HIGH PERFORMANCE

High performance in every fiber. From execution time to development time.

We are committed to building a framework that utilizes the power of isomorphic TypeScript and an ecosystem of libraries that are perfectly optimized to work with each other to empower you to build applications faster than ever before.

End to End Types

Define your data models with database and validation information once in TypeScript and share it with your whole stack without type checking performance penalties: Frontend, Transport, Message Broker, Micro-Service, Backend, Database — end to end.

Don’t split types prematurely but derive when necessary and keep a single source of truth.

Learn more
import {AutoIncrement, PrimaryKey,
    MinLength, Unique} from '@deepkit/type';

type Username = string & Unique & MinLength<4>;

class User {
    id: number & PrimaryKey & AutoIncrement = 0;

    created: Date = new Date;
    firstName: string = '';
    lastName: string = '';
    birthDate?: Date;

    constructor(
        public username: Username
    ) {}
}

type CreateUser = Omit<User, 'id' | 'created'>;
sections

Dependency Injection

One of the most powerful design pattern in enterprise software architecture — Dependency Injection. Brought to a whole new level.

Type your services, listeners, controllers against abstractions and enjoy the power of a fully auto-wiring high-performance Dependency Injection Container.

With support for functions and parameter injection: HTTP routes, CLI commands, event listeners, and more.

Learn more
interface DatabaseInterface {
    query<T>(model: Class<T>): Query<T>;
}

class Database implements DatabaseInterface {
    query<T>(model: Class<T>): Query<T> {
        // ...
    }
}

class UserAPI {
    // database is automatically injected
    constructor(private database: DatabaseInterface) {
    }

    @http.GET('/user/:id')
    async user(id: integer & Positive): Promise<User> {
        return await this.database.query(User)
            .filter({id})
            .findOne();
    }
}

router.get('/user/:id', async (
    id: integer & Positive, database: DatabaseInterface
) => {
    return await database.query(User)
        .filter({id})
        .findOne();
});

HTTP Router

Define HTTP routes as controller classes or functions and separate correctly with Dependency Injection.

Define all inputs (query, header, path parameters, body) as well as dependencies in the arguments and the router automatically deserialises and validates all incoming traffic.

Learn more
// GET /user/34
router.get('/user/:id', async (
    id: integer & Positive,
    database: Database
): Promise<User> => {
    return await database.query(User)
        .filter({ id })
        .findOne();
});

// GET /user?limit=5
router.get('/user', async (
    limit: HttpQuery<integer> & Maximum<100> = 10,
    database: Database
): Promise<User[]> => {
    return await database.query(User)
        .limit(limit)
        .find();
});

Command Line Interface

It has never been easier to write fully separated and validated CLI commands. Define the command either as a function or a class and define your command parameters and dependencies in the arguments.

Dependency injection as well as parameter deserialisation and validation happen automatically.

Learn more
new App({
    providers: [Database]
})
.command('user:find', async (
    name: string & MinLength<3>,
    withDeleted: boolean & Flag = false,
    database: Database
) => {

    let query = database.query(User)
        .filter({name: {$like: name + '%'});

    if (!withDeleted) {
        query = query.filter({deleted: false});
    }

    const users = await query.find();
})
.run();

// $ ./app.ts user:find Pete --with-deleted

Remote Procedure Call

The fastest way to connect your frontend with your backend or interconnect your micro-services using WebSockets or TCP with automatic serialisation, validation, error forwarding, fully typsafe interface, and streaming capabilities using RxJS — without code generation.

Learn more
// @app/server/controller.ts
import {rpc} from '@deepkit/rpc';

@rpc.controller('/main')
class MyController {
    constructor(protected database: Database) {}

    @rpc.action()
    async getUser(id: number): Promise<User> {
        return await this.database.query(User)
            .filter({id: id}).findOne();
    }
}
// @app/client.ts
import {DeepkitClient} from '@deepkit/rpc';
import type {MyController} from '@app/server/controller';

const client = new DeepkitClient('localhost');
const myController = client.controller<MyController>('/main');
const user = await myController.getUser(42); //fully type-safe

App Configuration

Auto-loading typesafe application configuration with automatic deserialisation and validation.

Values can be directly injected into all your services from the Dependency Injection Container.

Learn more
export class AppConfig {
    pageTitle: string & MinLength<2> = 'Cool site';
    databaseUrl: string = 'mongodb://localhost/mydb';
    debug: boolean = false;
}

new App({
    config: AppConfig,
    providers: [DefaultDatabase],
}).loadConfigFromEnv().run();
class DefaultDatabase extends Database {
    constructor(
        databaseUrl: AppConfig['databaseUrl']
    ) {
        super(new MongoDatabaseAdapter(databaseUrl));
    }
}

function Website(
    props: {page: string, children: any},
    title: AppConfig['pageTitle'],
) {
    return <>
        <h1>{this.title}</h1>
    <h2>{props.page}</h2>
    <div>{props.children}</div>
    </>;
}

class PageController {
    constructor(
        protected debug: AppConfig['debug']
    ) {
}

Template Engine

Easy to use and safe template engine based on JSX with full access to the Dependency Injection Container.

Compiled via a JIT compiler to native JavaScript functions for maximum performance.

Learn more
router.get('/user/:id', async (id: number) => {
    return <User user={id}></User>
});
function User(
    props: {user: number, children: any},
    database: Database)
{
    const user = await database.query(User)
        .filter({id: props.user})
        .findOne();
    return <>
        {html('<!DOCTYPE html>')}
    <html>
        <head>
            <title>{this.props.title}</title>
    <link rel="stylesheet" href="/style.css"/>
        </head>
        <body>
        <h1>User {user.username}</h1>
    // ...
    </body>
    </html>
    </>;
}

TypeScript ORM

One of the fastest full-featured database ORM for TypeScript. An high-performance ORM for TypeScript with enterprise patterns Data Mapper, Unit Of Work, and Identity Map as well as migration capabilities, relation support, and easy to define entities — No code generator needed.

Learn more
import { AutoIncrement, MaxLength, MinLength,
    PrimaryKey, Unique } from '@deepkit/type';
import { Database } from '@deepkit/orm';
import { SqliteDatabaseAdapter } from '@deepkit/sql';

type Username = string & Unique & MinLength<3> & MaxLength<20>;

class User {
    id: number & AutoIncrement & PrimaryKey = 0;
    created: Date = new Date;

    constructor(
        public username: Username
    ) {
    }
}


const database = new Database(SqliteDatabaseAdapter(':memory:'), [User]);
await database.migrate(); //create tables

database.persist(new User('Peter'));

const user = await database.query(User)
    .find({ username: 'Peter' })
    .findOne();

Deepkit ORM Browser

Deepkit ORM Browser is a web application that allows you to browse your database schema, edit your data, see migration changes, and seed your database. Everything based on your TypeScript entity types.

It is part of Framework Debugger but can also be used standalone.

Learn more

g

Deepkit API Console

Auto documentation of your HTTP and RPC API right in the browser showing all your routes, actions, parameters, return types, status codes, in TypeScript type syntax.

Interactively explore and test your API with the API Console.

It is part of Framework Debugger but can also be used standalone.

Learn more

g

Deepkit Debugger

Deepkit Framework Debugger is a web application giving you insights into your application.

Module hiarchy, configuration, APIs, database, profiler, and much more.

Learn more

g
NOW

LETS GO

Start now and get to know the new runtime type system in action.

Get started
Made in Germany