MCPcopy
hub / github.com/tsedio/tsed

github.com/tsedio/tsed @v8.32.2 sqlite

repository ↗ · DeepWiki ↗ · release v8.32.2 ↗
9,044 symbols 27,763 edges 2,664 files 421 documented · 5%
README

Ts.ED logo


Build & Release PR Welcome npm version semantic-release code style: prettier github opencollective

Website   •   Getting started   •   Slack   •   Twitter


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

Getting started

See our getting started here to create new Ts.ED project or use our CLI

Overview

Server example

Here an example to create a Server with Ts.ED:

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.

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

Controller example

This is a simple controller to expose user resource. It use decorators to build the endpoints:

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<User> {
    return this.usersService.findById(id);
  }

  @Post("/")
  @Status(201)
  @Summary("Create a new user")
  @Returns(User)
  async postUser(@Required() @BodyParams() user: User): Promise<User> {
    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<User> {
    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<User> {
    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

Alt

Contributors

Please read contributing guidelines here.

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a 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.

Extension points exported contracts — how you extend this code

OnInstall (Interface)
(no doc) [12 implementers]
packages/security/passport/src/interfaces/OnInstall.ts
OnDestroy (Interface)
(no doc) [16 implementers]
packages/di/src/common/interfaces/OnDestroy.ts
AlterHook (Interface)
(no doc) [38 implementers]
packages/third-parties/formio/src/domain/AlterHook.ts
ExceptionFilterMethods (Interface)
(no doc) [14 implementers]
packages/platform/platform-exceptions/src/interfaces/ExceptionFilterMethods.ts
JsonMapperMethods (Interface)
(no doc) [14 implementers]
packages/specs/json-mapper/src/interfaces/JsonMapperMethods.ts
EngineFunction (Interface)
(no doc) [8 implementers]
packages/engines/src/utils/getEngines.ts
ConfigSource (Interface)
(no doc) [10 implementers]
packages/config/core/src/interfaces/ConfigSource.ts
ConfigService (Interface)
(no doc) [151 implementers]
docs/docs/snippets/providers/custom-provider-use-class-declaration.ts

Core symbols most depended-on inside this repo

get
called by 1550
packages/platform/platform-multer/src/common/constants/constants.ts
Property
called by 664
packages/specs/schema/src/decorators/common/property.ts
set
called by 654
packages/di/src/common/domain/ProviderBuilder.ts
Get
called by 399
packages/specs/schema/src/decorators/operations/route.ts
Controller
called by 278
packages/di/src/common/decorators/controller.ts
Returns
called by 272
packages/specs/schema/src/decorators/operations/returns.ts
injector
called by 261
packages/di/src/common/fn/injector.ts
resolve
called by 220
packages/third-parties/formio/src/domain/FormioAction.ts

Shape

Class 3,981
Method 3,171
Function 1,391
Interface 438
Enum 63

Languages

TypeScript100%

Modules by API surface

packages/specs/schema/src/domain/JsonSchema.ts123 symbols
packages/specs/json-mapper/src/domain/JsonSerializer.spec.ts72 symbols
packages/specs/schema/src/decorators/operations/returns.ts52 symbols
packages/specs/json-mapper/src/domain/JsonDeserializer.spec.ts50 symbols
packages/platform/platform-test-sdk/src/tests/testResponse.ts44 symbols
packages/third-parties/socketio/test/app/services/RoomWS.ts41 symbols
packages/orm/mongoose/src/utils/createSchema.spec.ts39 symbols
packages/specs/schema/src/domain/JsonOperation.ts38 symbols
packages/platform/platform-http/src/common/services/PlatformResponse.ts38 symbols
packages/specs/schema/test/integrations/discriminator.integration.spec.ts32 symbols
packages/specs/schema/test/integrations/discriminator.enum.integration.spec.ts32 symbols
packages/specs/json-mapper/src/domain/Writer.ts32 symbols

Dependencies from manifests, versioned

@agendajs/mongo-backend4.0.2 · 1×
@apidevtools/swagger-parser10.1.0 · 1×
@apollo/datasource-rest6.4.1 · 1×
@apollo/server5.2.0 · 1×
@as-integrations/express41.1.2 · 1×
@as-integrations/express51.1.2 · 1×
@babel/core7.25.7 · 1×
@babel/plugin-transform-runtime7.25.7 · 1×
@babel/preset-env7.27.2 · 1×
@babel/preset-react7.25.7 · 1×

Datastores touched

(mongodb)Database · 1 repos
agendaDatabase · 1 repos
db2Database · 1 repos
pulseDatabase · 1 repos
my_databaseDatabase · 1 repos
db1Database · 1 repos
defaultDatabase · 1 repos
formioappDatabase · 1 repos

For agents

$ claude mcp add tsed \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact