Traditional Custom App
- It is part of the same server, database, site, environment, assets.
- Upgrades along with other apps.
- Migration and retirement of the app is complex and endangers whole system
- Can compromise data integrity or system security
- Privileges of app to access system and user resource cannot be restricted by user
- Based on Frappe Framework only and communicates via Python and JS api
Microservice Custom App
- It is on different server with own database, site, environment, assets etc.
- Can have its own release cycle
- Migration and retirement of the app is independent of production ERP
- In case of compromise or failure, ERP Data and system is safe
- User has the control to allow or disallow app from using ERP resource. App access can be revoked
- Can be based on any framework including Frappe on any device and communicates via OAuth 2.0 and REST API
Why
- Frappe ERPNext is fast changing
- Not upgrading ERPNext as per the release schedule means missing out on lot of features and fixes
- Custom app blocks upgrade and may have migration complexities
- Custom app fails and takes down whole system
- What is not worth going into core as a pull request may be unreviewed patch work or hack
How
- Setup Social Login such that the primary ERPNext server is in your Frappe Server URL. e.g. SaaS Server URL
- The microservice always signs in using primary ERPNext account
- OAuth2Authenticator for android, ERPNext Connector or equivalent OAuth 2.0 Client is installed on Microservice app
- If microservice is a frappe app, relevant Link fields must show upstream doctypes. ERPNext Connector is hacking this in with Connector DocTypes which query upstream server db for instances saved there instead of showing local data
- Whenever user enters such link field the upstream docnames start showing and latest docnames are saved locally for saving data in link field
- If there is any change on upstream server, Webhook can inform it to app
- Even Android app can use login via Frappe. Check out MN Technique’s App Showcase for Android app using this approach
Note: Read Documentation Frappe > Integration for more information
Signed in to Primary ERPNext Server with nothing installed e.g. SaaS Server
Item List on ERPNext
Custom App login with Frappe
Signed into Custom App
Upstream Items in Custom App Query
Service Providers can now deliver customization / integration to cloud users and promote cloud usage.
Anyone interested can send PR to erpnext_connector and extend it as needed.