Appstart is an opinionated Java boilerplate template for rapid development of multi-module Google App Engine applications based on Google Guice, a lightweight dependency injection framework. Appstart uses the App Engine Maven plugin, it has a parent pom and 3 maven projects. 2 of the projects (appstart-front and appstart-backend) are App Engine modules.
App Engine multi-module applications are organized as an unpacked Java Enterprise Archive (EAR) directory structure. This project contains the following directories:
- appstart-ear contains the EAR deployment descriptors
application.xml
andappengine-application.xml
- appstart-frontend is configured to use a frontend instance
<instance-class>F1</instance-class>
and - appstart-backend is configured to use a backend instance
<instance-class>B2</instance-class>
. - The third project appstart-common is a common code project shared between the appstart-frontend and appstart-backend modules handy when you are developing multiple modules with shared code.
Appstart encourages the Single Page Application (SPA) pattern by providing backend services as APIs that can be invoked from any frontend, be it Web or Mobile. The philosophy of Appstart is to enable you to spend less or no time writing boilerplate code and more time focusing on your business logic.
A live demo is available here https://appstart-web.appspot.com/.
Explore the Cloud Endpoint API for Appstart here.
The following key technologies/libraries are used by Appstart. You can either use some or all of these technologies depending on your needs:
- cron.xml for a cron job that run every midnight on the backend module and archives any old todos. This must be included with the default module (appstart-frontend) rather than any other modules as mentioned here.
- Cloud Endpoints is configured on the default module (appstart-frontend).
- Google Guice: App Engine friendly, lightweight dependency injection framework.
- Objectify: Convenient data access API for the App Engine datastore.
- Cloud Endpoints: App Engine REST/RPC API to simplify clients (Android, iOS, etc..) access.
- Jersey & Jersey Guice integration: Jersey framework is an implementation of the JAX-RS (JSR 311 & JSR 339) to provide RESTful Web services in Java.
- Lombok: A framework for boilerplate code generation such as getter, setter, constructors, equalTo, hashCode, etc... Saving you time to focus on your business logic. Note: for the code to compile in your IDE and not to show compile errors, you need to install Lombok in your IDE as explained here.
- Google Guava, Google Gson and Apache Commons Lang: Useful Java libraries that plays well with App Engine.
- App Engine Unit Testing Libraries & jMockit: Creating unit tests using the App Engine local unit testing libraries. Mocking is achieved using the jMockit mocking library.
- AngularJS TodoMVC: Frontend page uses the TodoMVC AngularJS as an example. You can integrate your own frontend technology with Appstart.
You need to change the following values with your own:
- App Engine app-id (
<appengine.app.name>appstart-web</appengine.app.name>
) in appstart/pom.xml - The module versions (
<appengine.app.version>v1</appengine.app.version>
) for appstart-front and appstart-backend located in the pom.xml for each module. - For Google Cloud Endpoints Update the values in (
appstart/appstart-frontend/src/main/java/uk/co/inetria/appstart/Constants.java
) and (appstart-frontend/src/main/webapp/js/endpoint.js
) to reflect the respective client IDs you have registered in the APIs Console.
To run or deploy the application (all modules):
git clone https://github.com/omerio/appstart.git
cd appstart
mvn install
cd appstart-ear
#to test it locally:
mvn appengine:devserver
#or to deploy it:
mvn appengine:update
To deploy or run individual modules:
cd appstart-frontend
#to test it locally:
mvn appengine:devserver
#or to deploy it:
mvn appengine:update
- Homepage (frontend module): http://localhost:8888/
- API Explorer for Cloud Endpoints: http://localhost:8888/_ah/api/explorer
- Backend module (port number might be different, check you dev server output): http://localhost:54423
- Create documentations.
- Add sample unit tests that uses the App Engine local unit testing libraries.
Create Cloud Endpoints frontend code to authenticate a user and refresh the OAuth token once it expires.Provide an option on the frontend to use either the JAX-RS REST or Cloud Endpoints.- Create a Maven archetype to easily scaffold projects.
Contributions are welcome and encouraged, simply fork the project make your changes and submit a pull request.
Open Source (Apache License 2.0)