https://github.com/tsedio/tsed
:triangular_ruler: Ts.ED is a Node.js and TypeScript framework on top of Express to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline to make your code more readable and less error-prone. ⭐️ Star to support our work!
https://github.com/tsedio/tsed
cli contribution decorators dependency-injection express hacktoberfest ioc koa lifecycle-hooks middleware multer nodejs nodejs-api nodejs-framework open-source rest-api socket-io swagger typescript typescript-framework
Last synced: 10 days ago
JSON representation
:triangular_ruler: Ts.ED is a Node.js and TypeScript framework on top of Express to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline to make your code more readable and less error-prone. ⭐️ Star to support our work!
- Host: GitHub
- URL: https://github.com/tsedio/tsed
- Owner: tsedio
- License: mit
- Created: 2016-02-21T18:38:47.000Z (over 9 years ago)
- Default Branch: production
- Last Pushed: 2025-05-07T07:13:31.000Z (18 days ago)
- Last Synced: 2025-05-07T19:47:41.114Z (17 days ago)
- Topics: cli, contribution, decorators, dependency-injection, express, hacktoberfest, ioc, koa, lifecycle-hooks, middleware, multer, nodejs, nodejs-api, nodejs-framework, open-source, rest-api, socket-io, swagger, typescript, typescript-framework
- Language: TypeScript
- Homepage: https://tsed.io/
- Size: 81.6 MB
- Stars: 2,958
- Watchers: 42
- Forks: 294
- Open Issues: 54
-
Metadata Files:
- Readme: readme.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome - ts-express-decorators - :triangular_ruler: A TypeScript Framework on top of Express. It provide a lot of decorators and guideline to write your code. (TypeScript)
- awesome-nodejs - Ts.ED - Intuitive TypeScript framework for building server-side apps on top of Express.js or Koa.js. (Packages / Web frameworks)
- awesome-nodejs-cn - Ts.ED - **star:2894** 直观的TypeScript框架,用于在Express.js或Koa.js之上构建服务器端应用。 ![star > 2000][Awesome] (包 / Web 框架)
- fucking-awesome-nodejs - Ts.ED - Intuitive TypeScript framework for building server-side apps on top of Express.js or Koa.js. (Packages / Web frameworks)
- fucking-awesome-nodejs - Ts.ED - Intuitive TypeScript framework for building server-side apps on top of Express.js or Koa.js. (Packages / Web frameworks)
README
[](https://github.com/tsedio/tsed/actions?query=workflow%3A%22Build+%26+Release%22)
[](https://github.com/tsedio/tsed/blob/master/CONTRIBUTING.md)
[](https://badge.fury.io/js/%40tsed%2Fcommon)
[](https://github.com/semantic-release/semantic-release)
[](https://github.com/prettier/prettier)
[](https://github.com/sponsors/romakita)
[](https://opencollective.com/tsed)
## What it is
Ts.ED is a modern Node.js framework built with TypeScript. It offers a flexible structure with a fast learning curve, specifically designed to improve the developer experience. Ts.ED provides numerous decorators and guidelines to make your code more readable and less error-prone. It supports various platforms and tools, including Node.js/Bun.js, Express.js/Koa.js, CLI, and serverless architectures (e.g., AWS).
- Multi-platform: Easily build your server-side application using Express.js, Koa.js, CLI, or serverless platforms (e.g., AWS). It supports both Node.js and Bun.js runtimes. Learn more here.
- Configuration: Stop wasting time on configuration—your application comes preconfigured for a fast start! Try our CLI.
- Decorators: Use a wide range of decorators to structure your code, define routes, and implement methods with ease. Learn more here.
- Class-based: Define classes as Controllers, Models, Providers (DI), Pipes, and more, with JSON Schema and OpenAPI at the core of the framework.
- Testing: Testing is not optional—it's essential! Ts.ED includes built-in features to make testing your code simple and efficient. Learn more here.## Features
- Use our CLI to create a new project: https://tsed.dev/introduction/getting-started.html#installation
- Support TypeORM, Mongoose, GraphQL, Socket.io, Swagger-ui, Passport.js, etc...
- Define class as Controller,
- Define class as Service (IoC),
- Define class as Middleware and MiddlewareError,
- Define class as Json Mapper (POJ to Model and Model to POJ),
- Define root path for an entire controller and versioning your Rest API,
- Define as sub-route path for a method,
- Define routes on GET, POST, PUT, DELETE and HEAD verbs,
- Define middlewares on routes,
- Define required parameters,
- Inject data from query string, path parameters, entire body, cookies, session or header,
- Inject Request, Response, Next object from Express request,
- Template (View),
- Testing.## Links
- [Board/Roadmap](https://github.com/orgs/tsedio/projects/4/views/1)
- [Documentation](https://tsed.dev)
- [Guideline](./CONTRIBUTING.md)
- [Tutorials](https://tsed.dev/tutorials/)
- [Community Slack](https://slack.tsed.dev)
- [Support us](https://github.com/sponsors/romakita)
- [Team](https://tsed.dev/team.html)## Getting started
See our [getting started here](https://tsed.dev/getting-started) to create new Ts.ED project or use
our [CLI](https://tsed.dev/introduction/getting-started.html#installation)## Overview
### Server example
Here an example to create a Server with Ts.ED:
```typescript
import {Configuration, Inject} from "@tsed/di";
import {PlatformApplication} from "@tsed/platform-http";
import "@tsed/platform-express";
import cookieParser from "cookie-parser";
import compress from "compress";
import methodOverride from "method-override";@Configuration({
port: 3000,
middlewares: ["cookie-parser", "compression", "method-override", "json-parser", "urlencoded-parser"]
})
export class Server {}
```To run your server, you have to use Platform API to bootstrap your application with the expected
platform like Express.```typescript
import {$log} from "@tsed/logger";
import {PlatformExpress} from "@tsed/platform-express";
import {Server} from "./Server.js";async function bootstrap() {
try {
$log.debug("Start server...");
const platform = await PlatformExpress.bootstrap(Server);await platform.listen();
$log.debug("Server initialized");
} catch (er) {
$log.error(er);
}
}bootstrap();
```To customize the server settings see [Configure server with decorator](https://tsed.dev/docs/configuration.html)
#### Controller example
This is a simple controller to expose user resource. It use decorators to build the endpoints:
```typescript
import {Inject} from "@tsed/di";
import {Summary} from "@tsed/swagger";
import {
Controller,
Get,
QueryParams,
PathParams,
Delete,
Post,
Required,
BodyParams,
Status,
Put,
Returns,
ReturnsArray
} from "@tsed/schema";
import {BadRequest} from "@tsed/exceptions";
import {UsersService} from "../services/UsersService.js";
import {User} from "../models/User.js";@Controller("/users")
export class UsersCtrl {
@Inject()
private usersService: UsersService;@Get("/:id")
@Summary("Get a user from his Id")
@Returns(User)
async getUser(@PathParams("id") id: string): Promise {
return this.usersService.findById(id);
}@Post("/")
@Status(201)
@Summary("Create a new user")
@Returns(User)
async postUser(@Required() @BodyParams() user: User): Promise {
return this.usersService.save(user);
}@Put("/:id")
@Status(201)
@Summary("Update the given user")
@Returns(User)
async putUser(@PathParams("id") id: string, @Required() @BodyParams() user: User): Promise {
if (user.id !== id) {
throw new BadRequest("ID mismatch with the given payload");
}return this.usersService.save(user);
}@Delete("/:id")
@Summary("Remove a user")
@Status(204)
async deleteUser(@PathParams("id") @Required() id: string): Promise {
await this.usersService.delete(user);
}@Get("/")
@Summary("Get all users")
@(Returns(200, Array).Of(User))
async findUser(@QueryParams("name") name: string) {
return this.usersService.find({name});
}
}
```## Repository stats

## Contributors
Please read [contributing guidelines here](./CONTRIBUTING.md).
## Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/tsed#backer)]
## Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/tsed#sponsor)]
## License
The MIT License (MIT)
Copyright (c) 2016 - 2023 Romain Lenzotti
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.