Manual

 

Contents:

While every website is written in a computer programming language like Java, Python and PHP etc., in practice, it is usually developed with higher-level toolkit called framework. Frameworks aim to alleviate the overhead associated with common activities performed in web development. The most popular frameworks include Scala (Java), Django (Python), Zend (PHP) and Rails (Ruby) etc.

Genelet is designed to be the best among all. While many frameworks grow bigger and richer in features, Genelet becomes lighter. It has kept only critical features after more than 10 years of internal development. It is especially easy to learn, to develop and to debug: Simplicity is the ultimate sophistication.

 

Development Steps

The web development steps in Genelet are:

  • Download the Framework in your language from GitHub.
  • Run the helper command to generate a skeleton of project.
  • Make the global JSON configuration config.json (see Config).
  • Make a project handler.
  • After finishing the above one-time tasks, your daily work would be to add more components. Each component contains
    • one Model class
    • one Controller class
    • one initialization file component.json for the 2 classes
    • and multiple templates as Views.

 

20 Logic Phases

Let’s explain the life cycle of Genelet. Web requests are handled in the following 20 phases. 15 of them, marked in parenthesis, are internally handled by Genelet.

  1. (Preparation: based on config.json, the server creates roles, issuers, mime types, logger, caches and etc., then waits for http requests to come.)
  2. (A request comes in.)
  3. (Inspecting URL: optional, rewrite the URL to the standard Genelet format.)
  4. (Authentication: check if visitor has a valid ticket, or redirect to role’s login.)
  5. (Filter, a subset of Controller, being specific to this component, is created)
  6. Get Action: get action in query or RESTful settings.
  7. (Input Data Collection: get them in query, POST body, and the de-crypted login cookie.)
  8. (ACL: check if the role is allowed to run the action.)
  9. (RLS, row-level-security: check the integrity of constraint key’s signature )
  10. Filter Preset: input data process.
  11. (Database handler is created.)
  12. (Model is created.)
  13. Filter Before: before acting on Model, do more processing works with the database handler.
  14. Model Action: run the action method.
  15. (Assign RLS: calculate signatures of the foreign keys in the output)
  16. Filter After: after the action, do post-processing works on the data.
  17. (Database handler is closed.)
  18. (Send Blocks: send email, push notifications etc.)
  19. (Page Creation: format the data as JSON API, or HTML)
  20. (Send the page to client)

Genelet inspects the visitor role in the URL and decide how to authenticate. You can use the database-based or OAuth for authentication.  Please see this section for details.

After the security is passed, Genelet dispatches the request to the specific component to run the specific action, both are defined in the URL too. This manual explains how to do the MVC program for component.

Genelet is multilingual. It not only has the above consistent serving phases but also a consistent implementation in all languages, including

  • always one Model class and one Filter class for each component;
  • the same initialization file, component.json, for the classes;
  • the same programming variables
  • the same method names (e.g. get_actionpreset, before, after on Filter);
  • always return nothing (or null) from a method. In case of failure, return the same error code.

You should get familiar with the configuration file component.json, before moving to the manual in your specific programming language.

Go to Initialization
or
Jump to  GO  |  Java  |  Perl