This DynamiaTools extension allow you to create modules with multi tenant support por SaaS applications. Its manage accounts, payments, account status, data isolation by account and more
- Core: Entities, Services and API implementation
- API: Use this clases from your external modules
- UI: Actions and views for user interface integration.
- Remote: Allow you to check account status from external systems
Add the following dependencies to project classpath
Maven
<dependency>
<groupId>tools.dynamia.modules</groupId>
<artifactId>tools.dynamia.modules.saas</artifactId>
<version>3.1.3</version>
</dependency>
<dependency>
<groupId>tools.dynamia.modules</groupId>
<artifactId>tools.dynamia.modules.saas.ui</artifactId>
<version>3.1.3</version>
</dependency>
Gradle
compile 'tools.dynamia.modules:tools.dynamia.modules.saas:3.1.3'
compile 'tools.dynamia.modules:tools.dynamia.modules.saas.ui:3.1.3'
The above dependencies install to your project a new DynamiaTool module called SaaS. From this module you can create customer accounts, account types (plans), accounts profile and payments.
By default, all account required a subdomain like:
In your hosting provider you need to create a wildcard domain, like *.myapp.com
pointing to server IP using an A RECORD. To work local edit your hosts
file and create multiple subdomains for
testing.
For example
In linux edit /etc/hosts
file and add:
customer1.localhost.com 127.0.01
customer2.localhost.com 127.0.01
customer3.localhost.com 127.0.01
For your modules you only require the API dependency
<dependency>
<groupId>tools.dynamia.modules</groupId>
<artifactId>tools.dynamia.modules.saas.api</artifactId>
<version>3.1.3</version>
</dependency>
Then, edit JPA entities and implement the tool.dynamia.modules.saas.api.AccountAware
interface. Add the field Long accountId
field. The value of this field will be automatic set up by the SaaS modules
using a CrudListener
.
You can also make you entity to extend from the helper classes tools.dynamia.modules.saas.jpa.SimpleEntitySaas
or from
tools.dynamia.modules.saas.jpa.BaseEntitySaas
.
import tool.dynamia.modules.saas.api.AccountAware;
@Entity
public class Person implements AccountAware {
@NotNull
private Long accountId;
// other fields
//getter and setters
}
DynamiaTools SaaS is available under Apache 2 License