The first step in using fastCode's application generator is to design your database. fastCode currently supports PostgreSQL and MySQL databases, with support for Oracle and Microsoft SQL server databases coming soon.
To allow you to rapidly experience the value proposition of fastCode, we have provided a sample database for a Timesheet application. This database has 9 tables.
In order to generate an application that uses the sample database, first click on Create Application button in the Application Generator Portal screen. This will bring up the application generation wizard where we need to provide information.
Below, we describe the information that needs to be provided to the application generation wizard on each screen.
The first screen requires you to provide information on the database to be used to generate the application. In order to use the sample database, select Use sample database radio button. This should bring up the screen shown below.
Click the Next button to go to the next screen.
The following application information is pre-filled because it's a sample application.
Repository Name: The name of the repository that will be created in fastCode's GitHub account.
Application Name: The name of the application
Description: An optional application description
The next two fields, Group and Artifact, together constitute the Java package name that will be used when generating the application.
Group: The group name of the application
Artifact: The artifact name of the application
Generation Type: fastCode allows for the generation of both the back-end and front-end of the application or just the back-end of the application. The latter option is useful when you want to generate a only the back-end ReST API and not the application UI.
Click the Next button. The application generator will perform initial checks and take you to the next screen.
NOTE: Either during this step or at any time prior to you generating the application, you can configure GitHub account to allow fastCode application generator to create a private repository in your GitHub account for the sample Timesheet application. In this case, fastCode does not create a public repository in fastCode GitHub account.
fastCode currently supports two methods of authentication: database and LDAP (Active Directory).
For the sample application, we will use database authentication and store user credentials in the application database.
When using this authentication method, we also need to specify whether the application's database consists of a User table. We need to specify this information because, by default, fastCode generates its own User, Role, and Permission tables and we don't want to generate a User table if the application's schema already has an existing User table.
The sample Timesheet database has a User table (named users) and therefore we have selected Yes as the option.
In this step, we select optional add-on modules that we want to include in the generated application. In the current community version of fastCode, the following add-on modules are supported:
Document Management API
The document management API can be used by the application development team to store, lock, and version documents (ex: Pdf, Word, images). Documents can be stored in the application’s database, a file system, AWS S3 buckets, and other locations, although only the File System store is supported in the current release.
The email API can be used by the application development team to send HTML emails with embedded attachments and inline images. The embedded attachments and inline images sent with emails will be stored using the Document Management API to the storage type configured for the application.
The entity audit module can be used by the application development team for production debugging. This module displays any changes to the properties of application’s entities, displaying the previous property value, the current property value, the type of change, and the change author.
Internationalization & Localization
The internationalization (I18N) and localization (L10N) module can be used by the application development team to provide their application UI in languages other than the default U.S. English. For each additional language that needs to be supported, the application development team only needs to provide the translation strings for that language in a JSON file.
The ad-hoc reporting module can be used by the application’s end-users to generate reports and dashboards on an ad-hoc basis. Initially, the application’s reporting schema has to be set up by the application development team before end-users can generate reports and dashboards.
A job is a Java method that will execute when triggered. Initially, the application development team develops jobs (Java methods) and these jobs can then be triggered by setting up trigger schedules through the Job Scheduler UI.
The user registration module can be used to allow users to self-register to the application instead of manually being added either to the application’s database in case of database authentication or to your organization’s LDAP directory service (ex: Active Directory) in case of LDAP authentication.
For the sample Timesheet application, from this screen onwards, you can skip the rest of the screens and generate the application by clicking the "Skip & Generate" button. For your own applications, when the "Skip & Generate" is visible/enabled, you can generate the application skipping the rest of the steps. fastCode uses the defaults provided in each of the remaining screens and generates the application.
NOTE: After the add-on modules screen, we can generate the application. There are other screens after this screen, but default values are provided for settings on these additional screens. In order to explain the purpose and settings of these additional screens, we will review them.
This step only appears when the database schema has a custom User table. In the case of the sample Timesheet application, we have a users table in the database schema. In this step, we need to map fields in the users table to the fields that correspond to UserName, Password, EmailAddress, and isActive. In case you have selected the **User Registration" add-on, an additional field, isEmailConfirmed, also needs to be mapped.
For this step, for each entity, we need to select a field that will be used to describe the entity in the UI.
In a 1: many relationship, when creating/updating an entity on the many-side, we need to select the descriptive fields. For example, in our authorization model, we have Roles and Permissions. A Role can have one or more permissions and permission can belong to one or more Roles. Therefore, we represent this relationship in the database using a Join Table. There are 3 tables involved - Role table – RolePermission join table – Permission table. The Role table has a 1-to-many relationship with the RolePermission table. When we are creating a new RolePermission entity, we will be asked to specify a Permission and a Role. The drop-down for Permission and the Role displays the descriptive fields that are selected in this step for the Permission and Role entities.
The descriptive field is also used for navigation. For example, when we click on a specific role in the UI, it lists all the permissions that are associated with that role. In the breadcrumb of the UI, the role is displayed using the descriptive field for the Role we have selected in this step.
In this screen, we need to provide the default sort columns for each table. The default sort column will be used in the UI to display the list of records for the entity. By default, the primary key of the table is chosen as the default sort column.
An entity is a Java (Java persistence API) representation of a database table.
In this step, we need to select entities for which you want to generate both UI components and TypeScript services. If you don't select an entity, only TypeScript services will be generated for the entity.
If you generate UI components for an entity, the generated UI components can be used perform Create, Read, Update, and Delete (CRUD) operations on that entity. If you generate only TypeScript services for an entity, you can call these services from a custom developed UI screen for CRUID operations.
Typically, you want to generate both the UI components (and TypeScript services) for an entity if you need separate screens to perform CRUD operations on the entity. Typically, these entities will correspond to lookup database tables such as a list of countries.
As an example, if your database has 100 tables, around 20 of these tables could be look up tables. You need a way for your application users (perhaps in an admin role) to be able to update the data in these lookup table. Therefore, you would generate UI components for entities corresponding to these 20 tables.
The rest of the 80 tables don’t need CRUD screens. Instead, there could be, for example, 20 custom UI screens and each of these custom UI screens could be performing CRUD operations on more than one table simultaneously. As an example, consider a custom UI screen that has a form. Let’s assume that fields of the form correspond to fields from two different database tables. When the form is
submitted, the system needs to save the values of some fields into the first table and the values of the other remaining fields into the second table. To make this happen, you would custom develop this form, create a TypeScript service that would be called when the form is submitted, and within this
TypeScript service, call the Create TypeScript service for each of the two entities that have been pre-generated by fastCode Application generator.
In this step, for each entity, we select the fields that we want to display (a) in the entity list grid UI screen (b) the create entity and update entity UI screens. For example, if we have a field named createDate, we may want to display this in the entity list grid UI but we don't want to include this field
in the entity creation and update UI screens as this field value is automatically populated on the back-end.
Therefore, in this step, for each entity, de-select the fields where we either don’t want to display in the entity list UI screen or don’t want to gather user input for the create/update screens.
Finally, click on the orange Generate button to start generating the application.
The number of lines of code and tests generated for the front-end and back-end is displayed to the right of the screen.
Once the application is generated, click on the "Go back Home" or the fastCode logo in the upper left corner of the screen to back to the Application Generator Portal screen.
The generated application will be displayed in the portal. In order to download the generated application, as shown below, click on the three dots that appear on the application card and select the Download Application menu item. Be patient - the application will be downloaded as a ZIP file to your local machine.
Updated 6 months ago