Enterprise X SAAS Administration Module Overview
The SAAS Admin module is a complete but smaller version of the Enterprise X system. We kept all of the accounting screens in place and the financials and the inventory so you can use the accounting software to run your hosting business as well as using it to administer your SAAS Hosted Customers.

The SAAS Administration Module is broken into several parts, the SAAS Admin Module with the dashboard and the accounting screens, the Hosting Cart where the customers sign-up to purchase your hosted app, a Hosting Manager that dose a lot of the processing and administration work internally, all of which communicate via an EnterpriseXAdmin AJAX API

Here is some information on each of the modules and how they work together and their specific functions:

SAAS Admin Module
The SAAS Admin module has it’s own separate database and it’s own special dashboard screens. Some of these screens contain usefully information like:
- list of all created by Admin EnterpriseX applications
- list of errors from Customers installations
- lists of current, expiring, and expired customers
- dashboards with most important statistics.
- App Installation screen for working with installations and to manage it
- any other screens for admin hoster convenience

The SAAS Admin module acts as the backend for the Hosting Cart which is where customers sign-up for your hosted service


EnterpriseXAdmin AJAX API
There is an EnterpriseXAdmin AJAX AI which performs the following tasks:
- Checkout, all other processes like creating order, post etc are done over EnterpriseXAdmin using AJAX API


Hosting Manager
This module is consists from two parts.
- as part of EnterpriseX Admin.
- as separated worker(script) which is executed as daemon(service) process

This module does following tasks:
- creates new databases for customers
- uploads cleanenterprise database into the customers database
- grant privileges to db user

Since the database creation process takes some time, the new databases are created in advance by daemon. It always keeps about 5 fresh and ready to go databases with uploaded cleanenterprise image. We do this to allow the application to create a new installation fast, without lags because of uploading database image to database can take several minutes.

Information about all the databases is written to appinstallation tables.


Hosting Cart
It is special version of Enterprise X Cart application with own custom pages, designed specifically to support the hosting module. In most cases it will work just like the standard Enterprise X Shopping Cart. For example, all of the hosting item prices, and other information are taken from the InventoryItems table just like the regular cart.

The Hosting cart also loads the configuration for each different Hosting Product from Hosting Manager. Configuration for each product contains information like:
+ modules(Main, AR, AP, GL, Cart etc) for adding to product
+ list of included modules in price(for Trial version etc).
When user chooser preffered modules, they are sent to Hosting Manager during checkout process
- checkout worked with EnterpriseX API(Create Order, Post, print doc) like regular Cart checkout process.
After checkouting, Hosting Cart send request to Hosting Manager to create application for user and receives uniq id for application.
- Links to applications in Account
Link is created from received uniq id for applications. When user click to Account or Account Page is result of checkout procees Hosting Cart requests list of applications for Customer from Hosting Manager.
List of applications is list from uniq id, status and other information.
Hosting cart creates table with applications information and links to applications.
Links are generated from uniq id and standard part of url like EnterpriseX/index.php?config= Each application uses same application code EnterpriseX, but it uses different databases and configs.


Hosting Cart uses AJAX API to do this:
+ creating applications as result of checkout process
+ listing of Customer applications and their status
+ changing access, shuting down and other things
For doing it EnterpriseX Admin uses Hosting Manager because of some operations takes a time and cannot be done in request
handler process, only in background process



Hosting Cart Scenario / WalkThrough
Here are the basic steps and some of the calls that are used to create a new hosting customer
User comes to your website
User goes to Hosting Cart and does registration
System calls Cart EnterpriseX Admin API(this API is EnterpriseX) to create Customer and Customer Financials User choose Hosting product, it’s added to Shopping Cart
- Cart does it’s own calls to get list of products, add to cart etc.)
- All Cart API uses inventoryitems table of enterpriseadmin database and other regular EnterpriseX tables directly. User goes to checkout and click process
- Cart call EnterpriseX Admin API(this API is EnterpriseX) to create Order, Post Order, Get Doc Order etc
- Cart call EnterpriseX Admin API to make a request to create the Hosted Application.
- Freshly installed database is created and initialized it for new Hosting application.
User can to go Manage Account
- Hosting Cart calls own Cart API to get list of orders
- Hosting Cart calls EnterpriseX Admin API to get list of the Customer Applications and their status
User cab get and click on their Hosted Application link. Link looks like standard link - https://stfb.net/EnterpriseX/index.php?page=login&config=someconfig
- “someconfig” = the config param is unique id of Hosted Customer’s Hosted Application.
- When the link is clicked, the Customer config and Customer database is loaded.
- Application is now ready to go!



Hosting Manager Scenario
Hosting Manager daemon run continuously, and watches appinstallations table. If this table doesn't contains enough fresh and clean databases ready for installation, it creates a new fresh installation by creating a black database, and loading a cleanenterprise into it, then adds that entry to the appinstallations table.

Hosting manager is also responsible for deleting, saving and updating databases. It will do it so in the same way, as background process, because of all off these operations(creating, deleting, saving, updating) takes a lot of time and we don’t want the user just sitting there.