{"id":24014971,"url":"https://github.com/express-ts/starter","last_synced_at":"2026-04-07T22:31:08.145Z","repository":{"id":143749822,"uuid":"200068714","full_name":"express-ts/starter","owner":"express-ts","description":"A simple framework for building efficient and scalable server-side applications, heavily inspired by Spring MVC.","archived":false,"fork":false,"pushed_at":"2019-08-01T16:03:55.000Z","size":86,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T17:48:50.285Z","etag":null,"topics":["create-npack-app","express-boilerplate","express-template","express-ts","expressjs","nodejs","template","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/express-ts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-01T14:45:44.000Z","updated_at":"2020-08-08T21:08:29.000Z","dependencies_parsed_at":"2023-05-25T09:00:17.273Z","dependency_job_id":null,"html_url":"https://github.com/express-ts/starter","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/express-ts/starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/express-ts%2Fstarter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/express-ts%2Fstarter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/express-ts%2Fstarter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/express-ts%2Fstarter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/express-ts","download_url":"https://codeload.github.com/express-ts/starter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/express-ts%2Fstarter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31532153,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["create-npack-app","express-boilerplate","express-template","express-ts","expressjs","nodejs","template","typescript"],"created_at":"2025-01-08T07:38:22.245Z","updated_at":"2026-04-07T22:31:08.126Z","avatar_url":"https://github.com/express-ts.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @express.ts/starter\r\n A simple framework for building efficient and scalable server-side applications, heavily inspired by \u003ca href=\"https://spring.io\" target=\"blank\"\u003eSpring MVC\u003c/a\u003e.\r\n \r\n### Setup\r\nCreate a project using this repository as a template.\r\n\r\n``` bash\r\n# install dependencies\r\nnpm install\r\n\r\n# serve at localhost:3000\r\nnpm run start:dev\r\n\r\n# build for production\r\nnpm run build\r\n```\r\n### Status\r\n- ~@express.ts/starter: A simple setup for @express.ts~\r\n- create detailed documentation\r\n- @express.ts/cli: A command line interface for @express.ts\r\n\r\n### How does it work\r\napp.module.ts\r\n```typescript\r\nimport {\r\n  ComponentScan,\r\n  ExpressBootApplication,\r\n  IExpressApplication,\r\n  Middleware\r\n} from \"@express/stereotype\";\r\n\r\nconst config = require(\"../config/appConfig.json\");\r\n\r\n// Create Express server\r\n@ComponentScan([\r\n  path.join(__dirname, \"./services/impl\"),\r\n  path.join(__dirname, \"./controllers\"),\r\n])\r\n@ExpressBootApplication({\r\n  settings: [{\r\n    key: \"async\", value: false }, {\r\n    key: \"port\", value: process.env.PORT || 3000 }, {\r\n    key: \"httpPort\", value: process.env.PORT || 3000 }, {\r\n    key: \"createForkWorkers\", value: true }, {\r\n    key: \"views\", value: path.join(__dirname, \"../views\") }, {\r\n    key: \"view engine\", value: \"pug\"\r\n  }],\r\n  properties: [\r\n    config\r\n  ],\r\n  middlewares: [\r\n    compression(),\r\n    lusca.xssProtection(true),\r\n    express.static(path.join(__dirname, \"public\"), { maxAge: 31557600000 })\r\n  ]\r\n})\r\nexport class AppModule implements IExpressApplication {\r\n  public expressApp: core.Express;\r\n  public startServers: () =\u003e Promise\u003cany\u003e;\r\n  public bootstrap: () =\u003e Promise\u003cany\u003e;\r\n\r\n  createConnection () {\r\n    // Connect to MongoDB\r\n    // createConnection()\r\n    //   .then(connection =\u003e console.log(\"Connect to MongoDB: \", connection.isConnected))\r\n    //   .catch(errors =\u003e console.log(errors));\r\n  }\r\n\r\n  public $OnInit () {\r\n    console.log(`$OnInit worker ${process.pid}`);\r\n  }\r\n\r\n  public $OnReady () {\r\n    console.log(`$OnReady worker ${process.pid}`);\r\n  }\r\n\r\n  @Middleware\r\n  setLocalsUser (req: any, res: any, next: any) {\r\n    res.locals.user = req.user;\r\n    next();\r\n  }\r\n\r\n  @Middleware\r\n  goToDistanition (req: any, res: any, next: any) {\r\n    // After successful login, redirect back to the intended page\r\n    if (!req.user \u0026\u0026\r\n      req.path !== \"/login\" \u0026\u0026\r\n      req.path !== \"/signup\" \u0026\u0026\r\n      !req.path.match(/^\\/auth/) \u0026\u0026\r\n      !req.path.match(/\\./)) {\r\n      req.session.returnTo = req.path;\r\n    } else if (req.user \u0026\u0026\r\n      req.path == \"/account\") {\r\n      req.session.returnTo = req.path;\r\n    }\r\n    next();\r\n  }\r\n}\r\n\r\nexport const appModule = new AppModule();\r\n\r\nexport default appModule;\r\n\r\n```\r\nserver.ts\r\n```typescript\r\nimport errorHandler from \"errorhandler\";\r\n\r\nimport appModule from \"./app.module\";\r\n\r\nconst { expressApp } = appModule;\r\n\r\nappModule\r\n  .bootstrap()\r\n  .then((msg: any) =\u003e {\r\n\r\n    console.info(msg);\r\n\r\n    /**\r\n     * Error Handler. Provides full stack - remove for production\r\n     */\r\n    expressApp.use(errorHandler());\r\n\r\n    /**\r\n     * Start Express server.\r\n     */\r\n    appModule.startServers()\r\n      .then(msg =\u003e console.log(msg))\r\n      .catch(err =\u003e console.error(err));\r\n  });\r\n\r\nexport default appModule;\r\n```\r\n./controllers/UserController.ts\r\n```typescript\r\nimport { GetMapping, PostMapping, RequestMapping, RequestMethod } from \"@express/router\";\r\nimport { Autowired, Controller, PathVariable, Request, Response } from \"@express/stereotype\";\r\n\r\nimport IMailService from \"../services/IMailService\";\r\nimport IMetierService from \"../services/IMetierService\";\r\n\r\n\r\n@Controller()\r\nexport default class UserController {\r\n\r\n  @Autowired()\r\n  protected mailService: IMailService;\r\n\r\n  @Autowired()\r\n  protected metierService: IMetierService;\r\n\r\n  /**\r\n   * GET /login\r\n   * Login page.\r\n   */\r\n  @GetMapping(\"/login\")\r\n  getLogin (@Request() req: any,\r\n            @Response() res: any) {\r\n    console.log(\"getLogin(): ========\u003e\", this.metierService.getTemperature());\r\n    if (req.user) {\r\n      return res.redirect(\"/\");\r\n    }\r\n    res.render(\"account/login\", {\r\n      title: \"Login\"\r\n    });\r\n  }\r\n}  \r\n```\r\n./services/IMetierService.ts\r\n```typescript\r\n\r\nexport default interface IMetierService {\r\n  getTemperature (): number;\r\n}\r\n```\r\n./services/impl/MetierService.ts\r\n```typescript\r\n\r\nimport { Service } from \"@express/stereotype\";\r\nimport IMetierService from \"../IMetierService\";\r\n\r\n\r\n@Service()\r\nexport default class MetierService implements IMetierService {\r\n\r\n  getTemperature(): number {\r\n    return Date.now();\r\n  }\r\n\r\n}\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpress-ts%2Fstarter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexpress-ts%2Fstarter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpress-ts%2Fstarter/lists"}