Anatomy of a Structr Application


Structr is a standalone Java application with an embedded Jetty HTTP Server.

This article is based on the Structr distribution package from For details on the installation of Structr, see the previous chapter Installation and Setup. A Java Development Kit (JDK) Version 8 or later is required to run it. Structr makes heavy use of the internal Java compiler at runtime, so the JRE is not enough to run Structr, you will need the JDK in any case. See also this FAQ.

A Structr application

Apart from the configuration and (optional) external Scripting, all parts of a custom Structr application are configuration data stored in a graph database. A typical Structr application consists of at least the following parts.

1. Web Frontend

The frontend of a Structr application is an HTML5 web application. The application consists of one or more Pages which typically reflect the different use-cases. A page can be Imported from an URL, constructed from Widgets, or created from scratch using the Visual Page Editor. Additionally, Structr provides schema-based editing features through a built-in JavaScript library.

2. Data Model

The data model of a Structr application can be designed visually with the Schema Editor. It is fully dynamic and can be modified and extended at runtime. The resulting Custom Types are compiled into Java classes, and Structr automatically creates a REST Resource for each type.

3. Business Logic

The business logic of a Structr application is stored in methods in the data model. Structr supports various Property Types and provides Callback Methods that are executed when an object of a certain type is created, modified or deleted. Additionally, Serverside Scripting can be used in almost any part of an application. See the chapter on Active Elements for more information on that.

4. Integration

Integration with existing systems often requires the implementation of technical interfaces, ranging from simple plain-text resources to sophisticated reports. Structr provides Virtual Types for input / output mapping of its data model to other models. See also Creating non-HTML output and Server APIs.

Files and Directories

Let’s have a look at the files of a Structr installation. The following screenshot shows the directory contents of the Structr runtime directory after Structr has been started.

Directory Layout

bin/ Contains helper scripts to interact with Structr over a command line interface. See Command-Line Tools for more information about that.
data/ Contains additional Neo4j data, its contents are managed by Neo4j.
db/ Contains the Neo4j database files and indices. Its contents are managed by Neo4j.
exchange/ The root of all sandboxed I/O functions that can be used to exchange data between Structr and the harddisk.
files/ Contains the binary data of all the files that are stored in Structr. The files are stored in an index tree according to their internal UUID.
libs/ Contains Java libraries needed to run Structr. It is also the target directory for custom Structr libraries which can be used to extend the core Structr functionality. See Extending Structr for more information on that.
logs/ Contains the server.log file, which is an important source of debugging information. If you enable Request Logging, the resulting log files are also stored in the logs/ directory.
sessions/ Contains saved sessions from the Jetty HTTP server.
structr/ Contains the web application resources for the Structr User Interface.
log4j.log An (unused) log file created by the Log4j subsystem.
messages.log An (unused) log file created by Neo4j. Note that there is another file with the same name in the db/ directory which contains the actual logging information from Neo4j. The initial seed file used to initialize the database of an empty Structr instance. See Initial Seed for more information.
structr-ui-2.0-SNAPSHOT-201601221651.a5eb7.jar The main Structr resource file which is extracted into the structr/ directory upon first start.
structr.conf The Structr configuration file. See structr.conf for a detailed description of the file's contents.
structr.conf_templ A template for the Structr configuration file. If no structr.conf exists when Structr starts, it will be created from this file.


Related Articles
About this article
Last change 2016-03-04
Topics OverviewStructr 2.0