Nubia: what's going on?
As of now, Nubia has 2 major systems: The Client & Server. The Server does the story generation while the client side handles all of the rendering and display of articles. The Server was built using Express Js, a framework for serving nodeJs apps. The API requests are captured by controllers and then these controllers call the services required based on the specification of the reqeust.
Before a route can be valid for use, a series of things have to be put in place. These things include
Major server language is Typescript
Client → NextJs/React, Tailwind, SWR, Zustand
Server → ExpressJs, Rosaenlg, csv-parser
After successful wiring up of the various components, the route is ready to be queried by a client and used to generate stories.
For templating, Nubia uses Rosaenlg which is an NLG open-source tool built ontop of Pug (Actually, it's pug on steroids). Rosaenlg adds additional features to pug, making able to perform tasks pug normally would not ba able to achieve. This can be a little bit tricky as there is no syntax highling for rosae and a lot of the commands would be flagged as in-appropriate by the IDE or syntax formating plugins.
After creation of the temoplate and adding of data, a service should be created to house the logic of the story creation: parsing the data, calling the template engine, storing data to database and all other major logic.
There is a data parsing utility provided in the code repo that supports csv and takes in 3 parameters which are
After completion of service, a controller is created to handle incoming requests, assign classnames and call the appropriate services.
After the controller is ready and sends a valid response object to the user, a route would be created specifying the story end-points. The typical naming convention for this is host.com/story-name and the route for getting the corresponding data is host.com/story-name/data