Skip to content

Code Architecture

K Sashi Kumar edited this page Jul 25, 2017 · 2 revisions

Documentation on the code structure

The backend Rails app follows Fat Model Skinny Controller design pattern. The code is organized in MVC hierarchical way.

  • All database model class are inside models directory.
  • All constants that are used across the app are inside constants directory.
  • For the response JSON generation, Forli uses Active Model Serializer. The serializers directory contains all model serializers.
  • For background jobs, Forli depends on Active Job. The jobs directory holds the code for jobs.

The lib directory holds the classes and modules for the core business logic. For now, the modules that are implemented are:

  • MetaInfo - Handles Voting and View count
  • Notification - Handles Notifications
  • Redis - Contains keys and wrapper code to interact with Redis
  • Reports - Contains code to update/get Reports data. For now, the data is persisted in Redis.
  • Search - Contains code for indexing data to Elasticsearch.
  • Sentiment - Contains client code for Algorithmia service and the sentiment analyzer util code that are used across app.
  • SpamFilter - Contains client code for Akismet and the spam filter util code that are used across app.
  • tasks - Contains rake tasks required for the app.
Clone this wiki locally