{"id":19972449,"url":"https://github.com/bougarfaoui/back","last_synced_at":"2025-07-22T00:31:29.698Z","repository":{"id":57153783,"uuid":"79746736","full_name":"bougarfaoui/back","owner":"bougarfaoui","description":"Back.js : MVC Framework for Node.js written in Typescript and built on top of Express.js","archived":false,"fork":false,"pushed_at":"2017-03-23T16:27:03.000Z","size":53,"stargazers_count":48,"open_issues_count":1,"forks_count":9,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-07-02T02:05:15.053Z","etag":null,"topics":["mvc-framework","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/bougarfaoui.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}},"created_at":"2017-01-22T21:25:02.000Z","updated_at":"2024-07-05T06:49:40.000Z","dependencies_parsed_at":"2022-09-07T12:20:58.255Z","dependency_job_id":null,"html_url":"https://github.com/bougarfaoui/back","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bougarfaoui/back","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bougarfaoui%2Fback","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bougarfaoui%2Fback/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bougarfaoui%2Fback/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bougarfaoui%2Fback/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bougarfaoui","download_url":"https://codeload.github.com/bougarfaoui/back/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bougarfaoui%2Fback/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264763238,"owners_count":23660314,"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":["mvc-framework","typescript"],"created_at":"2024-11-13T03:08:14.784Z","updated_at":"2025-07-22T00:31:29.674Z","avatar_url":"https://github.com/bougarfaoui.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"**NOTE: This project is deprecated and no longer being actively developed or maintained**\n\n\n:sparkles: Back.js: MVC Framework for Node.js written in Typescript and built on top of Express.js :sparkles:\n\n[![Build Status](https://travis-ci.org/bougarfaoui/back.svg?branch=master)](https://travis-ci.org/bougarfaoui/back)\n\n\n\u003cp align=\"center\"\u003e\n\n  \u003cimg  height=\"300\" src=\"http://i67.tinypic.com/2h807k1.png\" \u003e\n\n\u003c/p\u003e\n\n\nback.js is a new MVC framework for node written totally in Typescript and inspired from the popular spring MVC in java,\nit has a system of dependency injection and it's easy to use. Back.js is very new, it's not ready for production yet and needs some contributions.\n\n\n:star2: There are a lot of javascript frameworks for node.js out there. This one is different :\n - Provides great TypeScript developer experience\n - Simple and flexible API\n - MVC Architecture\n\n## Quick start\n\n```\n$ npm install -g back-starter\n```\nCreate the app\n```\n$ back\n```\nInstall dependencies\n```\n$ npm install\n```\nStart your app at ``` http://localhost:3000/ ```\n```\n$ npm start\n```\n## Quick Tutorial\n### Example 1 (simple GET request):\n```ts\nimport {Controller ,Get ,Route } from \"back-js\";\n\n@Controller\n@Route(\"/\")\nclass HomeController{\n\n    constructor(){}\n\n    @Get(\"/\")\n    greet() {\n        console.log(\"hello World\");\n    }\n    \n    @Get(\"/greet\")\n    anotherGreet() {\n        console.log(\"another hello World\");\n    }\n} \n\n```\n - ```@Controller``` : class Decorator used to mark the class as request handler.\n - ```@Route``` : class Decorator used to specify the route handled by the controller.\n - ```@Get``` : method Decorator, when used on a method ,this method will handle all the GET requests corresponding to its route.\n\nin this example we created a controller ```HomeController``` that handles all requests coming from ```/``` route, inside the controller we have two methods ```greet``` and ```anotherGreet```, these methods point to ```/``` and ```/greet``` respectively. We used ```@Get(route)``` to indicate that the method will handle any web request ```GET``` coming from the route specified in the Decorator.\n\n\n### Example 2 (Request ,Reponse and Route parameter):\n```ts\nimport {Controller ,Get ,Post,Route ,Request ,Response } from \"back-js\";\n\n\n@Controller\n@Route(\"/product\")\nclass ProductController{\n\n    constructor(){}\n\n    @Get(\"/:id\")\n    getProduct(req : Request ,res : Response, id : number) {\n        console.log(id);\n        // do something\n        res.send(\"not found\");\n    }\n    \n    @Post(\"/\")\n    addProduct(res : Response,id : number, name : string, price : number){\n        res.end(\"done\");\n    }\n\n}\n```\nHere we have acontroller ```ProductController``` that points to ```/product``` route and has two methods ```getProduct``` and ```addProduct``` :\n\nthe first method ```getProduct``` has ```@Get(\"/:id\")``` decorator on it, this means that it points to the ```/product/anything``` route .The route parameter in this case ```id``` can be accessed as a parameter of ```getProduct``` method. The ```req``` and ```res``` objects are the same as those in Express.js .\n\nthe second method ```addProduct``` points to the ```/product/``` route and handles requests of type ```POST```. it has four parameters the last three ones are ```id```, ```name``` and ```price``` ,each parameter holds the value of the property that has the same name in the request body , fro example if the client send the object below :\n\n```json\n{\"id\":12,\"name\":\"nutella\",\"price\":20}\n```\n\nthe result :\n```ts\n    @Post(\"/\")\n    addProduct(res : Response, id : number, name : string, price : number, other : string){\n        console.log(id); // 12\n        console.log(name); // nutella\n        console.log(price); // 20\n        console.log(other); // undefined\n    }\n```\n \n### Example 3 (@RequestBody, @ResponseBody, @Service):\n \n ```ts\n    import {Controller,Service ,Get ,Post,Route ,Request ,Response, RequestBody, ResponseBody } from \"back-js\";\n    \n    class Product{\n        constructor(\n            private id : number,\n            private label : string,\n            private price : number,\n        ){}\n    }\n    \n    @Service\n    class ProductService{\n    \n        constructor(){}\n\n        getProduct() : Promise\u003cProduct\u003e{\n            return new Promise((resolve)=\u003e{\n                resolve(new Product(1,\"Bimo\",45));\n            });\n        }\n\n    }\n   \n    @Controller\n    @Route(\"/product\")\n    class ProductController{\n    \n        constructor(\n            private productService : ProductService\n        ){}\n\n        @Get(\"/\")\n        @ResponseBody\n        getProduct(req : Request ,res : Response ) : Promise\u003cProduct\u003e {\n            return this.productService.getProduct();\n        }   \n\n        @Post(\"/\")\n        @ResponseBody\n        addProduct(@RequestBody product) : string{\n            console.log(product);\n            return \"done\";\n        }\n    } \n \n ```\n - ```@Service``` : class Decorator used to indicates that the class is injectable\n - ```@ResponseBody``` : method Decorator , indicates that the method return value should be bound to the web response body (if the return value is a promise the data holded by this promise will be sent).\n - ```@RequestBody``` : parameter Decorator , indicates that the method parameter should be bound to the web request body\n \nin this example we have a controller```ProductController``` with one dependency ```productService``` that will be injected automatically by the framework,this controller has also two methods :\n\nthe first one ```getProduct``` it has ```@ResponseBody``` decorator on it and returns a promise this means that the value holded in the promise will be sent in the web response body.\n\nthe second one ```addProduct``` has ```@ResponseBody``` decorator on its parameter ```product``` this means that web request body will be bound to the ```product``` parameter.\n\n## Contribution\n\n1- Fork\n\n2- Do your magic :sparkles:\n\n3- Pull request :smile:\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbougarfaoui%2Fback","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbougarfaoui%2Fback","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbougarfaoui%2Fback/lists"}