Enterprise grade. Half the code.

Finally a Java MVC framework that's fun to use, but isn't a toy.



Find Out More

Latest News


  • 09 Mar 2017 ActFramework announce the first formal release
  • 28 Feb 2017 A TodoBackend project written in ActFramework: http://github.com/greenlaw110/todomvc-act
  • 02 Feb 2017 TechEmpower Benchmark has accepted the PR submitted by ActFramework
  • 02 Feb 2017 A third party Simple benchmark project shows ActFramework's throughput is 20 times of SpringBoot in simple case
 

Introducing Act.Framework


A Full Stack MVC Framework.

Applications start in seconds. No servlets or containers.

Developer Joy and Enterprise Features.

Clean and expressive.
Hot reload everywhere.
Faster than Spring boot.

Superbly RESTful. Powerful Rendering.

Natively RESTful or render.
Use Rythm, Velocity, FreeMarker, Thymeleaf, Mustache or Beetl.

Uncompromising Security.

Security aware means built-in enterprise-grade protection by default.

More Act.Framework Features

An Act.Framework application has the main method and start in seconds.

Act is not a servlet framework and Act application does not run in a Servlet container

Act.Framework supports hot-reload applications and it takes less than a second to reload your normal sized app (in our 10K LOC app, takes around 500ms to reload app). Hot reload happens when your Java source code, template code or configuration files has been changed

While providing great developer experience, performance is still a very important aspect of Act.Framework. According to this benchmark project, Act.Framework is 20 times faster than Spring boot in simple cases.

Fully JSR 330 support and even more:

  • Inject parameter for methods including action handler, mail sender, job method etc
  • Inject collections
  • Customizable injection tag, e.g. @LoginUser

Supports the trends of separate front end architecture via:

  • RESTful support
  • Built-in CORS support
  • Session/Header mapping

Act.Framework is a security aware framework, it builds uncompromised security support into your application

  • Session cookie is secure and http only, payload is signed and encrypted (optionally)
  • Enable CSRF prevention with just one configuration item
  • XSS prevention: Rythm engine escape variable output by default
  • Implementing your authentication/authorisation/accounting framework using AAA plugin

Annotation is one of the tool Act.Framework used to increase expressiveness. However we do not appreciate crazy annotation stacked code. Instead we make the code express intention in a natural way, and save the use of annotations whenever possible.

For example, for the following SpringMVC code:

@RequestMapping(value="/user/{userId}/invoices", method = RequestMethod.GET)
public List<Invoice> listUsersInvoices(
@PathVariable("userId") int user,
@RequestParam(value = "date", required = false) Date dateOrNull) {
...
}

The corresponding Act.Framework app code is:

@GetAction("/user/{user}/invoices")
public List<Invoice> listUsersInvoices(int user, Date date) {
...
}

Act.Framework supports the concept of profile which allows you to organize your configurations in different environment (defined by profile) easily. Take a look at the following configurations from one of our real project:

resources
├── conf
│   ├── common
│   │   ├── app.properties
│   │   ├── db.properties
│   │   ├── mail.properties
│   │   ├── payment.properties
│   │   └── social.properties
│   ├── local-no-ui
│   │   ├── app.properties
│   │   ├── db.properties
│   │   └── port.properties
│   ├── local-sit
│   │   └── app.properties
│   ├── local-ui
│   │   ├── app.properties
│   │   └── db.properties
│   ├── sit
│   │   ├── app.properties
│   │   └── db.properties
│   └── uat
...

Suppose on your UAT server, you start the application with JVM option -Dprofile=uat, Act.Framework will load the configuration in the following sequence:

  1. Read all .properties files in the /resources/conf/common dir
  2. Read all .properties files in the /resources/conf/uat dir

This way Act.Framework use the configuration items defined in uat profile to overwrite the same items defined in common profile. The common items that are not overwritten still effective.

Act.Framework provides a decent set of database access APIs via act.db.Dao and relevant interfaces.

  • act-ebean plugin implemented the Act.Framework database layer based on the fast and simple ebean ORM library, which works with most SQL database solutions on the market
  • act-morphia plugin implemented the Act.Framework database layer based on the official Morphia document mapper for MongoDB

It is not unusual for today's application to play with multiple and even heterogeneous database storage. Act.Framework has already built-in the support for that. For example:

# the database configuration
db.instances=mongo,sql
# db1 configurations
db.mongo.impl=act.db.morphia.MorphiaPlugin
db.mongo.uri=mongodb://localhost/myapp
db.sql.impl=act.db.ebean.EbeanPlugin
db.url=jdbc:h2:./myapp
db.ddl.createOnly=true
// -- the model that require transaction go SQL
@DB("sql")
@Entity(name = "va")
public class VirtualAccount{
@Id
private Long id;
@Index(unique = true)
public String ownerId;
// balance in cents
public int balance;
}
// -- the model does not require transaction go MongoDB
@DB("mongo")
@Entity("trans")
public static class Transaction extends MorphiaModel {
/**
* Stores from account owner ID
*/
public String creditAcc;
/**
* Stores to account owner ID
*/
public String debitAcc;
/**
* Stores the transaction amount
*/
public int amount;
...
}

The above code shows how to configure two databases with one for SQL database and the other one for MongoDB. Once you have two database configured, it is super easy to map your model class to database via the @DB annotation.

For more traditional application design that requires server-side page rendering, Act.Framework by default uses the Rythm Template Engine. And it supports using your favorite template engine including:

Act.Framework support using multiple template engines in the same projects.

Act.Framework provides rich feature set that covers most of your web application development needs:

Get Started. Fast.


Act.Framework sample projects are driven by Maven. You can choose from the following sample project skeletons to start your own Act.Framework application.

Once you've downloaded a sample skeleton, import it into your IDE, let Maven resolve dependencies, and just rename your package and entry class.

Then you're good to rock and roll!

  • helloworld
    The simpliest project skeleton for Act web app
  • TODO(Ebean)
    A simple TODO application using Ebean ORM
  • TODO(Morphia)
    A simple TODO application using Morphia mongodb ORM
  • Transaction(Ebean)
    A simple application with Ebean ORM demonstrates transactions
 

Tutorials and Videos

Creating a helloworld ActFramework app with Eclipse from scratch
Create a TODO application (Morphia/Mongo version)
Adding qrcode and barcode generation to Helloworld project
Working with configuration
Three routing mechanims in act and how to use them
Introducing to CLI service and creating application commander
Creating RESTful service with Actframework
The powerful adaptive record in Actframework

Why Act.Framework?


Back at the end of 2009, I had just finished a project in CakePHP as an individual consultant. I felt pretty frustrated with PHP and decided to get back to the Java world. I was not happy with Struts/w Spring and was hunting for other Java MVC frameworks. PlayFramework came into my sight and I fell in love with it.

I loved PlayFramework v1.x because it was simple, clear and expressive. It brought us a completely different experience in web development with Java. However I don't totally agree with where Play 2.X is heading, and it looks like I am not the only person with the concern as per this open letter to Play Framework Developers.

I had thought of rolling out something that could follow the road paved by Play 1.x; something that is simple, clear, expressive and developer friendly. About one and half years after that article was written, I decided I could start the project seriously. As a result, here is ACT.framework - a framework that I can call "the Final Fantasy of Java web development"

In short, we need a modern, sleek Java MVC framework which we don't get from Spring MVC, Sprint Boot, PlayFramework, SparkFramework or any others on the market.

Thanks

   Thinking Studio is the company that backed Act.Framework. Thanks for allowing me to work on this project and allow me to pilot Act.Framework on our projects since the end of 2015.

   JetBrains grants me the open source license to use the great product IntelliJ IDEA. Every line of code of Act.Framework is written with IntellJ IDEA, and really love it!