The easiest way to use fortjs is by installing - fort-creator. fort-creator is a cli package which helps you with fortjs development.

So, Install the fort-creator globally by runing command -

  • Using npm - npm i fort-creator -g

  • Using yarn - yarn global add fort-creator


After you have successfully installed, run the below commands -

  • create new project - fort-creator new my-app

  • move to the project path - cd my-app

  • start dev server - fort-creator start


Browser the url mentioned in the console (http://localhost:4000/)

You will see something like below -


Understanding project


Now you must be thinking - where is the code which is rendering output to browser ? Let's see -

  • Open folder controllers. Inside the controllers you will see a file name - default_controller, lets open it and observe the code. The file contains a class DefaultController - this is a controller class and it contains list of resources of particular type. Please check out controller doc for knowing about controller.

  • Inside the class DefaultController -> you will see a method 'index' - this is the one which is rendering output to browser. On top of 'index' method we are using decorator 'defaultWorker'. It tells fortjs to make this method visible for http request. Please check out worker doc for more info about worker.

  • Inside the method, we are using viewResult to return a view with location "default/index.html". But where is the view code ?

  • Under Views folder - > open default folder - > open index.html. This is our view code. Please check view doc for more info.



*Check out some other links


Alternatively you can also clone/download starter template -


After downloading the repo - open the console, move to project directory and run the commands -

  • npm install - It will install all the dependency
  • npm run start - It will run the app.