Tech Talk 3 - Best Practices for SaaS ERP System Development
I. Introduction of PJC (Project Cost)
PJC is a cloud-type individual cost management system that makes it easy to visualize, input labor hours, and calculate individual and project costs. We have several main features:
- Man-hours, labor unit cost management
- Cost allocation, project cost calculation
- Project and department master data
- Accounting journal creation and synchronization
Challenge:
- Many complex business logic features with development time up to months.
- Risk when deploying, migration, testing a lot of sub features, code conflict with other features, increase 4keys operation.
- Sharing master data requirements between PJC and other services in MFV such as project, department..
=> To address these challenges, we decided to apply two techniques: Feature Toggle, Common Master.
II. Best Practice 1: Feature Toggle
1. What is Feature Toggle
Feature Toggles (often also referred to as Feature Flags) are a powerful technique, allowing teams to modify system behavior without changing code.
2. Benefit of Feature Toggle
3. Feature Toggle Use Cases
- A/B Testing: by using feature flags, you can enable a feature for a subset of users and compare its performance or user experience against an alternative version.
- Canary Releases: enable you to release a new feature to a small percentage of users, often referred to as a "canary group." This allows you to gather feedback and monitor performance before rolling it out to a larger audience.
- Dark Launches: enable you to release a feature to production but keep it hidden from users. This allows you to test and validate the feature's behavior and performance in a real production environment before making it visible to users.
- Operational Control: can be used to control operational aspects of your system, such as enabling or disabling certain functionality or configurations based on the current state of your system.
- License Management: can be used to control access to certain features based on licensing or subscription levels. This allows you to easily manage feature availability for different tiers of customers.
4. How to apply Feature Toggle to the PJC project
4.1. Configuration
There are some types of configuration for Feature Toggle.
We are using File Configuration for PJC project
*Note: In the future, we will target to Distributed Configuration for centralizing to all project in MFV
4.2. Implementation
We store a config file in S3 and have a CICD to update it frequently.
PJC BE service is responsible for loading toggle configuration from S3 and exposing any change to FE through restful API or server send event.
4.3. Standardization and SDK
We follow a standardization of open-feature and use Go Feature Flag as SDK.
Reference Link:
4.4. Some services for applying Feature Toggle
III. Best Practice 2: Common Master
1. Overview Common Master
Common master solves sharing master data requirement between services in MFV such as project, department..
2. Common Master UI
Common Master UI will be embedded into each related Service via Micro FE. For example in this picture, PJC service uses Common Master UI to manage Department data.
3. Challenges of implementing Common Master
How to update data from a Sub Service
Synchronize data between sub services when there is a change from Common Master
=> We apply CDC (Change Data Capture) pattern
4. Benefit of Common Master
The solution of using Common Master brings many benefit for the problem of using common data between many products in MFV
Support inject common logic in multiple services, instead of each service have to be processed separately
In the future, adding more products will also be much easier
IV. How to apply Feature Toggle & Common master to the PJC project
For more details, please watch the full talk here
V. Summarization
Two typical best practices that we have applied to the PJC project and I would to share in this tech blog:
- Feature Toggle
- Common Master
There are some other best practices such as:
- State machine
- Bitemporal Modeling
- Column Discriminator