{"id":18947668,"url":"https://github.com/asciphx/asciphx","last_synced_at":"2025-04-15T23:30:24.609Z","repository":{"id":42723083,"uuid":"284409919","full_name":"asciphx/asciphx","owner":"asciphx","description":"It is the fastest HTTP/2 Node Web Framework that it look like iris framework of golang language","archived":false,"fork":false,"pushed_at":"2023-07-19T11:19:13.000Z","size":3365,"stargazers_count":6,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-10-20T17:45:44.489Z","etag":null,"topics":["babel","ejs","esnext","fastify","framework","gulp","mvc","server","typeorm","web-framework"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asciphx.png","metadata":{"files":{"readme":"README-zh_CN.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-08-02T07:04:20.000Z","updated_at":"2023-10-21T10:12:57.466Z","dependencies_parsed_at":"2023-10-20T17:53:43.281Z","dependency_job_id":null,"html_url":"https://github.com/asciphx/asciphx","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asciphx%2Fasciphx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asciphx%2Fasciphx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asciphx%2Fasciphx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asciphx%2Fasciphx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asciphx","download_url":"https://codeload.github.com/asciphx/asciphx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223688709,"owners_count":17186298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["babel","ejs","esnext","fastify","framework","gulp","mvc","server","typeorm","web-framework"],"created_at":"2024-11-08T13:10:52.838Z","updated_at":"2024-11-08T13:10:54.100Z","avatar_url":"https://github.com/asciphx.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Asciphx\n\u003e 使用 Babel + typeORM + Mysql + Fastify + gulp构建，一个类似于Java的SpringBoot架构，但同时具有.net Core的性能。\n\u003e 插件nodemon也能配合其他协同工作，让开发更集中，更专注于编写代码。\n\n## 主要特性\n- **Babel**使用下一代js语法糖，堪称史上最简洁，代码可读性最棒\n- 支持 **TypeORM**，最好的 Typescript ORM 框架，轻松编写 DAO 层的各类逻辑\n- **Fastify**加持下，性能进入世界前五，复杂度也进一步提升，并能完成最好的功能\n- **gulp**堪称自动化之王，有了gulp打包使得pro环境的代码更健壮，但体积却更加小\n- **nodemon**可以帮助在dev环境下，更友好的开发，但也需要先`npm run watch:pro`\n- 各种插件联手，允许部分使用静态类型修饰、类型推断，为后端开发和维护提供支持\n- 模块化开发，让应用程序更容易分层，提供了易于使用的模块化管理机制\n- 最低调编写 AOP 代码，面向切面编程，却轻松实现日志、拦截器、过滤器等功能\n- 最快，最迅速，最猛烈构建 MVC、API、websocket、微服务等系统\n- 若是请求了个没有的地址如`user/1000`（假设实际上没有id为1000的），会看起来一直加载，\n实际是没返回（为了服务器性能），所以请设置超时时间为4秒\n\n## Demo\n- [KOA](https://github.com/asciphx/asciphx/tree/master/sample/koa-babel) KOA框架，写起来稍微麻烦但速度兼具的框架🎁\n- [express](https://github.com/asciphx/asciphx/tree/master/sample/express-babel) express架构，写起来方便，只是性能稍微略低点🎁\n\n## 特征\n- [x] Class类装饰器默认值为 \"/\"+实体类名 ,当然也可以自定义\n- [x] 自动扫描controller目录，并且配置Routes路由\n- [x] 自动扫描entity，并且生成schema.properties\n- [x] 自动生成配置路由文件以便查阅，在dist/routes目录下，也可删除，或者去src/config.js下更改printRoute为false\n- [x] babel用下一代js语法糖可以巨幅降低代码行数，还可以兼容ts类型检查，而解决ts代码过于沉长的问题\n- [x] 有几乎相近于C#:.net core架构的速度，还有java:SpringBoot框架的可维护性，前提是关闭日志打印，还有尽可能少用插件\n- [x] 如不采用typeORM库，也可以使用Sequelize，并重写entity类，采用index_old.js里面的方式查询数据库获取实体类或者自行查找映射的方法\n- [x] 精确到字母大小写的路由，大小写不匹配也会导致无法连接，遗憾的是几乎所有网站路由转成了小写，实战场景似乎较少\n- [x] 装饰器中，若是返回的非Object类型，还需在method装饰器第一个参数改数字来判断，在src/config.js的jsonSchema中，并且第二个值会是url\n- [x] 还未使用schema中的querystring,headers；如需使用，只能修改src/utils/decorator.js里面的方法，自行想办法添加。使用后估计性能会提升5%\n\n\n## 目录结构\n1. dist:`babel编译后的文件`\n2. src:`后端文件入口`\n3. src/controller:`控制层`\n4. src/entity:`实体层`\n5. src/service:`服务层`\n6. src/migration:`迁移层`\n7. src/utils:`工具层`\n8. views:`后台ejs模板渲染文件夹`\n9. windows-lib:`windows的linux指令包（放系统path变量中或nodejs安装目录下）`\n10. dist/routes:`输出查看的路由文件，每个controller会创建一个`\n\n## 插件支持\n1. such as:obj::func、?.、??、|\u003e、#、||=、\u0026\u0026=、@decorators、function*、do{...}\n2. support strip-types. eg:function foo(one: any, two: number, three?): string {}\n3. 在fastify的point-of-view组件能让静态路由可采用.html来避免与普通路由发生的冲突\n\n## 需要更改的配置\n1. vsCode settings:\n```json\n    \"emmet.includeLanguages\": {\n        \"vue-html\": \"html\",\n        \"javascript\": \"javascriptreact\"\n    },\n    \"javascript.validate.enable\": false,\n```\n2. 请勿将await语法内用插件支持的操作符，可能会导致await失效;\n解决方案，await(...)。使用括号包裹，阻止babel翻译失败。\n3. 需要npm i -g eslint@7.6.0 以便支持内部的语法检查。\n4. ormconfig.json中的synchronize，设置为true则自动同步实体类到数据库。\n\n## 注意\n1. **如何运行**：\n看看有没有全局安装eslint,如果没有也可以安装在本地npm i --save-dev eslint。\n请先看配置文件在ormconfig.js，找到mysql需要的数据库，登录并创建该数据库。\n\n先开一个终端`npm run watch`,（以便看到babel编译后的代码）或者`npm run watch:pro`，(gulp编译后代码会被压缩，但是性能会提升)\n再开一个新终端`npm run dev`用于运行项目的开发环境。\n\nor\n只开一个终端，每次都用`npm run start:build`，但这就不是实时编译了,而且可能会慢。\n```json\n    \"build\": \"rm -rf dist \u0026\u0026 babel src -d dist --no-comments\",\n    \"build:pro\": \"rm -rf dist \u0026\u0026 gulp build\",\n    \"old\": \"node dist/index_old.js\",\n    \"start\": \"node dist/index.js\",\n    \"start:build\": \"babel src --out-dir dist --no-comments \u0026\u0026 node dist/index.js\",\n    \"watch\": \"rm -rf dist \u0026\u0026 babel src --watch --out-dir dist --no-comments\",\n    \"watch:pro\": \"rm -rf dist \u0026\u0026 gulp build \u0026\u0026 gulp watch\",\n    \"dev\": \"nodemon\"\n```\n2. **保持命名规范**：\ncontroller层下的请尽量保持大小驼峰命名规范\n3. **暂时没有查询验证**：\n在schema中缺少的是querystring,headers,但是不会影响使用,可以自行添加\nschema验证目前采用src/util/tool下的ctx方法，得配合@Ctx一起使用，才行\nFastify也是作为世界排名前五的服务端框架之一，前五还有iris，有.net core\n虽然Fastfify并不是最快的，但是论扩展和可维护性，代码可读性都非常强\nKOA和express版本的Babel框架已经出品，在sample目录\n4. **请赞助本项目**：\n如你觉有收获，请给我打赏\n\n![微信打赏](http://www.91huanwei.com/1.jpg)\n![支付宝打赏](http://www.91huanwei.com/0.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasciphx%2Fasciphx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasciphx%2Fasciphx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasciphx%2Fasciphx/lists"}