# Deepkit

> Deepkit is a TypeScript framework with runtime types: its type compiler makes TypeScript types available at runtime, so one type is used for validation, serialization, the database (ORM), HTTP, RPC and dependency injection, without schemas, decorators for dependency injection or code generation.

The complete documentation in one file: [llms-full.txt](https://deepkit.io/llms-full.txt)

Important for writing Deepkit code:

- Runtime types need the type compiler in the build: `"reflection": true` in tsconfig.json, and `npx deepkit-type-install` to install it into TypeScript (or the Vite and Bun plugins). Without it, types are not available at runtime.
- Validation and database options are intersections with the type: `string & MinLength<3>`, `number & PrimaryKey & AutoIncrement`, `string & Email`.
- Dependency injection resolves constructor parameters by their type, interfaces included. No decorators are needed for it.
- HTTP routes and CLI commands take their parameters from the function signature: `HttpBody<T>`, `HttpQuery<T>`, `Flag`.
- A new project: `npm init @deepkit/app@latest my-app`.

Every documentation page is available as markdown by adding `.md` to its URL, package pages include their API reference.

## Overview

- [Overview](https://deepkit.io/en/documentation.md): Deepkit is an open-source TypeScript framework for backend applications freely available under the MIT license, designed to help you build scalable and maintainable backend applications.
- [Introduction](https://deepkit.io/en/documentation/introduction.md): TypeScript has emerged as a highly scalable superset of JavaScript, engineered for the development of more secure and robust applications.

## App

- [Getting started](https://deepkit.io/en/documentation/app.md): The Deepkit App abstraction is the most fundamental building block of a Deepkit application.
- [Arguments & Flags](https://deepkit.io/en/documentation/app/arguments.md): Command arguments in the terminal of your command are just regular arguments of the `execute` method or the function.
- [Dependency Injection](https://deepkit.io/en/documentation/app/dependency-injection.md): All commands have full access to the Dependency Injection Container.
- [Modules](https://deepkit.io/en/documentation/app/modules.md): Deepkit is highly modular and allows you to split your application into several handy modules.
- [Services](https://deepkit.io/en/documentation/app/services.md): Service is a broad category encompassing any value, function, or feature that an application needs.
- [Events](https://deepkit.io/en/documentation/app/events.md): An event system allows application components within the same process to communicate by sending and listening to events.
- [Logger](https://deepkit.io/en/documentation/app/logger.md): Deepkit Logger is a standalone library with a primary Logger class that you can use to log information.
- [Configuration](https://deepkit.io/en/documentation/app/configuration.md): In Deepkit applications, modules and your application can have configuration options.

## Framework

- [Getting started](https://deepkit.io/en/documentation/framework.md): Deepkit Framework is based on Deepkit App in `@deepkit/app` and provides the `FrameworkModule` module in `@deepkit/framework`, which can be imported in your application.
- [Database](https://deepkit.io/en/documentation/framework/database.md): Deepkit has its own powerful database abstraction library called Deepkit ORM.
- [Testing](https://deepkit.io/en/documentation/framework/testing.md): The services and controllers in the Deepkit framework are designed to support SOLID and clean code that is well-designed, encapsulated, and separated.
- [Deployment](https://deepkit.io/en/documentation/framework/deployment.md): In this chapter, you will learn how to compile your application in JavaScript, configure it for your production environment, and deploy it using Docker.
- [Public Assets](https://deepkit.io/en/documentation/framework/public.md): The `FrameworkModule` provides a way to serve static files such as images, PDFs, binaries, etc.

## Runtime Types

- [Introduction](https://deepkit.io/en/documentation/runtime-types.md): Runtime type information in TypeScript unlocks new workflows and features that were previously unavailable or required workarounds.
- [Getting started](https://deepkit.io/en/documentation/runtime-types/getting-started.md): To install Deepkit's runtime type system two packages are needed: The Deepkit Type Compiler and the Deepkit Type package itself.
- [Type Annotations](https://deepkit.io/en/documentation/runtime-types/types.md): Type annotations are normal TypeScript types that contain meta-information that can be read and change the behavior of various functions at runtime.
- [Reflection](https://deepkit.io/en/documentation/runtime-types/reflection.md): To work directly with the type information itself, there are two basic variants: Type objects and Reflection classes.
- [Serialization](https://deepkit.io/en/documentation/runtime-types/serialization.md): Serialization is the process of converting data types into a format suitable for transport or storage, for example.
- [Validation](https://deepkit.io/en/documentation/runtime-types/validation.md): Validation is the systematic process of verifying data for accuracy and integrity.
- [Extend](https://deepkit.io/en/documentation/runtime-types/extend.md): You can extend the serialization of a type by defining either write your own `Serializer` or extend the default `serializer`.
- [Custom serializer](https://deepkit.io/en/documentation/runtime-types/custom-serializer.md): By default, `@deepkit/type` comes with a JSON serializer and type validation for TypeScript types.
- [External Types](https://deepkit.io/en/documentation/runtime-types/external-types.md): Since TypeScript does not include type information per default, imported types/classes from other packages (that did not use @deepkit/type-compiler) will not have type information available.
- [Bytecode](https://deepkit.io/en/documentation/runtime-types/bytecode.md): To learn in detail how Deepkit encodes and reads the type information in JavaScript, this chapter is intended.

## Dependency Injection

- [Introduction](https://deepkit.io/en/documentation/dependency-injection.md): Dependency Injection (DI) is a design pattern in which classes and functions _receive_ their dependencies.
- [Getting started](https://deepkit.io/en/documentation/dependency-injection/getting-started.md): Since Dependency Injection in Deepkit is based on Runtime Types, it is necessary to have Runtime Types already installed correctly.
- [Providers](https://deepkit.io/en/documentation/dependency-injection/providers.md): There are several ways to provide dependencies in the Dependency Injection container.
- [Injection](https://deepkit.io/en/documentation/dependency-injection/injection.md): It's called Dependency Injection since a dependency is injected.
- [Configuration](https://deepkit.io/en/documentation/dependency-injection/configuration.md): The dependency injection container also allows configuration options to be injected.
- [Scopes](https://deepkit.io/en/documentation/dependency-injection/scopes.md): By default, all providers of the DI container are singletons and are therefore instantiated only once.

## Filesystem

- [Getting started](https://deepkit.io/en/documentation/filesystem.md): Deepkit Filesystem is a filesystem abstraction for local and remote filesystems.
- [App](https://deepkit.io/en/documentation/filesystem/app.md): Although Deepkit Storage works standalone, you probably want to use it in your Deepkit App using Dependency Injection.
- [Local](https://deepkit.io/en/documentation/filesystem/local.md): The local filesystem adapter is one of the most common filesystems and provides access to the filesystem on which the application is running.
- [Memory](https://deepkit.io/en/documentation/filesystem/memory.md): For the memory filesystem, the filesystem is stored in memory.
- [Database](https://deepkit.io/en/documentation/filesystem/database.md): This adapter allows you to use an Database ORM as filesystem backend.
- [AWS S3](https://deepkit.io/en/documentation/filesystem/aws-s3.md): The AWS S3 filesystem adapter allows you to use the AWS S3 service as Deepkit Filesystem.
- [FTP](https://deepkit.io/en/documentation/filesystem/ftp.md): This adapter allows you to use an FTP server as filesystem.
- [sFTP (SSH)](https://deepkit.io/en/documentation/filesystem/sftp.md): This adapter allows you to use an sFTP (SSH) server as filesystem.
- [Google Storage](https://deepkit.io/en/documentation/filesystem/google-storage.md): This adapter allows you to use Google Storage as filesystem.

## Broker

- [Getting started](https://deepkit.io/en/documentation/broker.md): Deepkit Broker is a high-performance abstraction for message queues, message bus, event bus, pub/sub, key/value store, cache, and atomic operations.
- [Cache](https://deepkit.io/en/documentation/broker/cache.md): Deepkit Broker Cache class is a multi-level (2 levels) cache that keeps a volatile local cache in memory and only fetches data from the broker server if the data is not in the cache, stale, or was…
- [Message Bus](https://deepkit.io/en/documentation/broker/message-bus.md): Deepkit Message Bus is a message bus system (Pub/Sub, distributed event system) that allows you to send messages or events between different parts of your application.
- [Message Queue](https://deepkit.io/en/documentation/broker/message-queue.md): Deepkit Message Queue is a message queue system that allows you to send messages to the queue server and have workers process them.
- [Atomic Locks](https://deepkit.io/en/documentation/broker/atomic-locks.md): Deepkit Broker Locks is a simple way to create atomic locks across multiple processes or machines.
- [Key Value](https://deepkit.io/en/documentation/broker/key-value.md): Deepkit Broker Key-Value class is a simple key/value store abstraction that works with the broker server.

## HTTP

- [Introduction](https://deepkit.io/en/documentation/http.md): Processing HTTP requests is one of the most well-known tasks for a server.
- [Getting started](https://deepkit.io/en/documentation/http/getting-started.md): Since Deepkit HTTP is based on Runtime Types, it is necessary to have Runtime Types already installed correctly.
- [Input & Output](https://deepkit.io/en/documentation/http/input-output.md): The input and output of an HTTP route is the data that is sent to the server and the data that is sent back to the client.
- [Views](https://deepkit.io/en/documentation/http/views.md): Deepkit HTTP comes with a built-in HTML view rendering system.
- [Dependency Injection](https://deepkit.io/en/documentation/http/dependency-injection.md): The router functions as well as the controller classes and controller methods can define arbitrary dependencies, which are resolved by the dependency injection container.
- [Events](https://deepkit.io/en/documentation/http/events.md): The HTTP module is based on a workflow engine that provides various event tokens that can be used to hook into the entire process of processing an HTTP request.
- [Middleware](https://deepkit.io/en/documentation/http/middleware.md): HTTP middlewares allow you to hook into the request/response cycle as an alternative to HTTP events.
- [Security](https://deepkit.io/en/documentation/http/security.md): This section is still under construction.

## RPC

- [Introduction](https://deepkit.io/en/documentation/rpc.md): RPC, which stands for Remote Procedure Call, allows functions on a remote server to be called as if they were local functions.
- [Getting started](https://deepkit.io/en/documentation/rpc/getting-started.md): To use Deepkit RPC, it is necessary to have `@deepkit/type` correctly installed because it is based on Runtime Types.
- [Dependency Injection](https://deepkit.io/en/documentation/rpc/dependency-injection.md): Controller classes are managed by the Dependency Injection Container from `@deepkit/injector`.
- [Security](https://deepkit.io/en/documentation/rpc/security.md): By default, all RPC functions can be called from any client, and the peer-to-peer communication feature is enabled.
- [Errors](https://deepkit.io/en/documentation/rpc/errors.md): Thrown errors are automatically forwarded to the client with all its information like the error message and also the stacktrace.
- [Transport](https://deepkit.io/en/documentation/rpc/transport.md): Deepkit RPC supports several transport protocols.

## Database ORM

- [Introduction](https://deepkit.io/en/documentation/orm.md): Deepkit ORM is a high-performance TypeScript ORM (Object-Relational Mapper).
- [Getting started](https://deepkit.io/en/documentation/orm/getting-started.md): Deepkit provides a Database ORM that allows databases to be accessed in a modern way.
- [Entity](https://deepkit.io/en/documentation/orm/entity.md): An entity is either a class or an object literal (interface) and always has a primary key.
- [Session](https://deepkit.io/en/documentation/orm/session.md): A session is something like a unit of work.
- [Query](https://deepkit.io/en/documentation/orm/query.md): A query is an object that describes how to retrieve or modify data from the database.
- [Transaction](https://deepkit.io/en/documentation/orm/transactions.md): A transaction is a sequential group of statements, queries, or operations such as select, insert, update, or delete that are executed as a single unit of work that can be committed or rolled back.
- [Inheritance](https://deepkit.io/en/documentation/orm/inheritance.md): There are several ways to implement inheritance in Deepkit ORM.
- [Relations](https://deepkit.io/en/documentation/orm/relations.md): Relationships allow you to connect two entities in a certain way.
- [Events](https://deepkit.io/en/documentation/orm/events.md): Events are a way to hook into Deepkit ORM and allow you to write powerful plugins.
- [Migrations](https://deepkit.io/en/documentation/orm/migrations.md): Migrations are a way to make database schema changes in a structured and organized manner.
- [ORM Browser](https://deepkit.io/en/documentation/orm/orm-browser.md): Deepkit ORM Browser is a web-based tool to explore your database schema and data.
- [Raw Access](https://deepkit.io/en/documentation/orm/raw-access.md): It's often necessary to access the database directly, for example to run a SQL query that is not supported by the ORM.
- [Seeding](https://deepkit.io/en/documentation/orm/seeding.md): Database seeding is the initial seeding of a database with data.
- [Composite primary key](https://deepkit.io/en/documentation/orm/composite-primary-key.md): Composite Primary-Key means, an entity has several primary keys, which are automatically combined to a "composite primary key".
- [Soft-Delete](https://deepkit.io/en/documentation/orm/plugin-soft-delete.md): The Soft-Delete plugin allows to keep database records hidden without actually deleting them.

## API

- [@deepkit/angular-ssr](https://deepkit.io/en/documentation/package/angular-ssr.md): Serve and server-side render your Angular app from your Deepkit application. API reference.
- [@deepkit/api-console](https://deepkit.io/en/documentation/package/api-console.md): Interactive documentation of your HTTP and RPC API in the browser, generated from your types.
- [@deepkit/app](https://deepkit.io/en/documentation/package/app.md): The foundation of an application: CLI commands, typed configuration from environment variables, dependency injection, events and modules. API reference.
- [@deepkit/bench](https://deepkit.io/en/documentation/package/bench.md): Benchmark suites with statistics, the tool behind Deepkit's own benchmarks. API reference.
- [@deepkit/broker](https://deepkit.io/en/documentation/package/broker.md): Shared state for all instances of your app: message bus, queues, key-value store, cache and distributed locks, all typed. API reference.
- [@deepkit/broker-redis](https://deepkit.io/en/documentation/package/broker-redis.md): Runs the broker on Redis when you already operate one. Same API, only the adapter changes. API reference.
- [@deepkit/bson](https://deepkit.io/en/documentation/package/bson.md): BSON encoder and decoder compiled from your types, faster than the official bson package. API reference.
- [@deepkit/bun](https://deepkit.io/en/documentation/package/bun.md): Bun plugin for runtime types. API reference.
- [@deepkit/core](https://deepkit.io/en/documentation/package/core.md): JavaScript utilities used by all packages, including the context for compiled functions. API reference.
- [@deepkit/core-rxjs](https://deepkit.io/en/documentation/package/core-rxjs.md): API reference.
- [@deepkit/devtool](https://deepkit.io/en/documentation/package/devtool.md): Chrome devtools extension to inspect the RPC traffic of your app.
- [@deepkit/event](https://deepkit.io/en/documentation/package/event.md): Typed events, synchronous and asynchronous, with listeners from the dependency injection container. API reference.
- [@deepkit/filesystem](https://deepkit.io/en/documentation/package/filesystem.md): The common API to read, write, list and move files, with adapters for the local disk and memory included. API reference.
- [@deepkit/filesystem-aws-s3](https://deepkit.io/en/documentation/package/filesystem-aws-s3.md): API reference.
- [@deepkit/filesystem-database](https://deepkit.io/en/documentation/package/filesystem-database.md): Files stored in your database via Deepkit ORM, no extra storage service needed. API reference.
- [@deepkit/filesystem-ftp](https://deepkit.io/en/documentation/package/filesystem-ftp.md): Files on FTP servers, behind the same API. API reference.
- [@deepkit/filesystem-google](https://deepkit.io/en/documentation/package/filesystem-google.md): Google Cloud Storage, behind the same API. API reference.
- [@deepkit/filesystem-sftp](https://deepkit.io/en/documentation/package/filesystem-sftp.md): Files on any server reachable via SSH, behind the same API. API reference.
- [@deepkit/framework](https://deepkit.io/en/documentation/package/framework.md): The complete server: HTTP and RPC in one process, workers, debugger and profiler, and a testing facade for integration tests. API reference.
- [@deepkit/http](https://deepkit.io/en/documentation/package/http.md): Routes as functions or controllers. Parameters, query strings and bodies are validated and converted from their types, responses serialized. API reference.
- [@deepkit/injector](https://deepkit.io/en/documentation/package/injector.md): Dependency injection by type, interfaces included, without decorators. Modules, scopes and configuration. API reference.
- [@deepkit/logger](https://deepkit.io/en/documentation/package/logger.md): Logging with scopes, colors, and your own transports and formatters. API reference.
- [@deepkit/mongo](https://deepkit.io/en/documentation/package/mongo.md): Adapter for MongoDB with its own driver and BSON compiled from your types, faster than the official driver. API reference.
- [@deepkit/mysql](https://deepkit.io/en/documentation/package/mysql.md): Adapter for MySQL and MariaDB. API reference.
- [@deepkit/orm](https://deepkit.io/en/documentation/package/orm.md): Data mapper ORM with unit of work, identity map, relations, migrations and a type-safe query API. API reference.
- [@deepkit/orm-browser](https://deepkit.io/en/documentation/package/orm-browser.md): Browse and edit the data of your entities, and see the schema and migrations, in the browser. API reference.
- [@deepkit/postgres](https://deepkit.io/en/documentation/package/postgres.md): Adapter for PostgreSQL. API reference.
- [@deepkit/rpc](https://deepkit.io/en/documentation/package/rpc.md): Call server methods from the browser or other services like local functions: typed, validated and binary encoded, with streams via RxJS. API reference.
- [@deepkit/rpc-tcp](https://deepkit.io/en/documentation/package/rpc-tcp.md): TCP transport for RPC between backend services. API reference.
- [@deepkit/run](https://deepkit.io/en/documentation/package/run.md)
- [@deepkit/sql](https://deepkit.io/en/documentation/package/sql.md): API reference.
- [@deepkit/sqlite](https://deepkit.io/en/documentation/package/sqlite.md): Adapter for SQLite, for development, tests and embedded apps. API reference.
- [@deepkit/stopwatch](https://deepkit.io/en/documentation/package/stopwatch.md): Measures where the time of a request goes, shown in the profiler of the debugger. API reference.
- [@deepkit/template](https://deepkit.io/en/documentation/package/template.md): JSX templates on the server with access to the dependency injection container. API reference.
- [@deepkit/topsort](https://deepkit.io/en/documentation/package/topsort.md): Topological sorting, e.g. for dependencies between modules or entities. API reference.
- [@deepkit/type](https://deepkit.io/en/documentation/package/type.md): TypeScript types at runtime: validation, serialization, type guards and reflection, without schemas. API reference.
- [@deepkit/type-compiler](https://deepkit.io/en/documentation/package/type-compiler.md): TypeScript transformer that makes your types available at runtime. API reference.
- [@deepkit/vite](https://deepkit.io/en/documentation/package/vite.md): Vite plugin for runtime types in frontend and backend builds. API reference.
- [@deepkit/workflow](https://deepkit.io/en/documentation/package/workflow.md): State machines for processes like orders or payments: only allowed transitions happen, and each step can trigger events. API reference.

## Optional

- [Benchmarks](https://deepkit.io/benchmarks): performance compared with other libraries and across releases
- [Blog](https://deepkit.io/en/blog): releases and articles
- [Source code](https://github.com/deepkit/deepkit-framework)
