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