File Directory

The skeleton of Truman actually comes from the outline of another Node.js project (https://github.com/sahat/hackathon-starter).

That repository has a lot of helpful and relevant information on the libraries, organization, setup, and FAQs on web development. Feel free to read through their README.md as well for a more expansive understanding of the project structure.

The Truman Platform (Truman) is a web application that uses a Node.js, MongoDB, Express.js and Pug templating engine webstack.

The Model View Controller (MVC) framework

The project follows a basic MVC (Model View Controller) framework. The Model-View-Controller (MVC) framework is an architectural/design pattern that separates an application into three main logical components: Model, View, and Controller. Each architectural component is built to handle specific development aspects of an application.

  • The View components handles all the user interface logic for the application. It generates the user interface for the user.

  • The Model components handles all the database schemas, i.e. it defines what the database "structure" looks like and defines what information is stored.

  • The Controller components handles the interaction between the views and the models (i.e. between what appears to a user of an application and the database). The controller components act as intermediaries.

    • The controller receives input from the view, uses logic to translate the input to a demand for the model, the model grabs the data, then the controller passes data from the model back to view for the user to see in a nice display.

More information about the MVC framework can be found online if you are interested.

Project Structure

The main node application (that defines the express server, connects to the MongoDB, and defines all the routes) is in app.js.

Below is a breakdown of the project files, with the name of each file and a brief description of each file's purpose.

Below are libraries that Truman uses and references to each library’s documentation.

Pug.js: https://pugjs.org/api/getting-started.html

  • Why do we use Pug?

    • Pug.js is a templating language rather than raw HTML. Most sites use some kind of templating language rather than raw HTML.

    • Using a templating language decreases the likelihood of bugs and security risks. It also is easier to write code in this templating language than in raw HTML.

Semantic UI: https://semantic-ui.com/

  • Semantic UI is a front-end development framework that helps create beautiful, responsive layouts using human-friendly HTML. Almost all of our components are borrowed and customized from Semantic UI.

Last updated