arrow-down
    1. Widgets
  1. IAM
    1. Virtual apps
    1. Projects
    2. Layers
        1. AttachmentUploader
        2. Checkbox
        3. Combobox
        4. ContentSelector
        5. ContentTypeFilter
        6. CustomSelector
        7. Date
        8. DateTime
        9. Double
        10. GeoPoint
        11. HtmlArea
        12. ImageSelector
        13. Long
        14. MediaSelector
        15. Radiobutton
        16. Tag
        17. TextArea
        18. TextLine
        19. Time
      1. Field set
      2. Item set
      3. Option set
      4. Mixins
      5. Localization
    3. Content Types
    4. X-data
    5. Macros
    6. Custom styles
    7. Sites
      1. Regions
      2. Part component
      3. Layout component
      4. Text component
      5. Fragments
      6. Filtering
      7. Component indexing
      8. Visual editor
    8. Page templates
    1. Sandboxes
    2. Code
    3. Building
    4. Configuration
    1. Globals
    2. HTTP
    3. Controllers
    4. Filters
    5. Events
    6. Websocket
    7. Error handler
    8. ID provider
    9. Tasks
    10. Localization
    11. Mappings
    12. Components
    13. Processors
    14. Contributions
    15. Templating
    16. Main controller
    17. Java bridge
      1. Webapp Engine
        1. Image service
        2. Component service
      2. Admin Engine
      3. Asset service
      4. HTTP service
      5. IDprovider service
    1. Task engine
    2. Management Endpoint
    3. Statistics Endpoint
    1. Nodes and repos
    2. Properties
    3. Indexing
    4. Branches
    5. Queries (NoQL)
    6. Queries (DSL)
    7. Filters
    8. Aggregations
    9. Highlighting
    10. Editors
    1. Strategies
    2. Distributions
    3. Docker image
    4. Vhosts
    5. Configuration
    6. Backup & restore
    7. Systemd
    8. Clustering
    1. Admin API
    2. Application API
    3. Auditlog API
    4. Authentication API
    5. Cluster API
    6. Common API
    7. Content API
    8. Context API
    9. Event API
    10. Export API
    11. Grid API
    12. I18N API
    13. IO API
    14. Mail API
    15. Node API
    16. Portal API
    17. Project API
    18. Repo API
    19. Scheduler API
    20. Schema API
    21. Tasks API
    22. Value API
    23. VHost API
    24. Websocket API
  2. Audit Logs
    1. Upgrade Notes
    2. Upgrading Apps

Application development

Contents

Details on the project and code structure in Enonic apps and libraries

Get started running. Use one of our starters to bootstrap your development project.

Languages

XP apps are powered by the XP runtime.

Enonic apps may consist of both server.-side and client-side code. They are primarily written in JavaScript/TypeScript.

Server-side JavaScript must uses XP’s Javascript Framework

Applications may optionally use Java. Developers with special requirements can take advantage of advanced platform capabilities such as exposing and consuming services from other applications within the same platform instance.

Learn more about using Java in XP apps

Project structure

The example structure below includes the standard files and folders for an Enonic application (or library).

sample-project/
  build.gradle
  gradle.properties
  gradlew
  gradlew.bat
  settings.gradle
  src/
    main/
      java/
      resources/
        application.svg
        application.xml
        admin/
          tools/
          widgets/
        assets/
        error/
        i18n/
        idprovider/
        main.js
        services/
        site/
          site.xml
          content-types/
          layouts/
          macros/
          mixins/
          pages/
          parts/
          processors/
          x-data/
        webapp/
        tasks/
    test/
      java/

Every file and folder has a specific function and purpose as described below:

Build files

Enonic supports JS/TS based build tools like TSUP and Webpack, but relies on Gradle as the main builder.

Visit the build system section for more details.

build.gradle

Main build file

gradle.properties

Build properties

gradlew | /gradlew.bat

Gradle wrapper file. Downloads and runs Gradle without having to install it manually.

settings.gradle

Mandatory file to boostrap the build process

General resources

The majority of Enonic specific code is placed within src/main/resources/:

admin/tools/

Admin tools are defined here. Tools are administrative apps listed in the admin console menu.

admin/widgets/

Admin widgets are essentially user interface components that can be embedded within other admin tools.

application.svg

Application icon in SVG format. Should be in a square format.

application.xml

Application information in XML format.

assets/

Standard folder for serving of static assets, such as css and javascript. Assets are served by the asset service.

error/error.js

The HTTP error handler

main.js

The application’s main controller. Executed when an application starts and stops.

services/

Contains Http service controllers

i18n/

Short for internationalization, this folder contains app localization files

idprovider/

The application may implement an ID Provider here.

tasks/

May contain task controllers for running asynchronous and background processing.

site/site.xml

Contains site configuration schema, and declaring that the app can be added to projects and sites

site/content-types/

Contains Content type definitions.

site/processors/

For post processing of HTML response from pages built with the Enonic JS framework.

site/layouts/

Layout components are placed here.

site/mixins/

Reusable schemas are placed here.

site/macros/

Rich text Macro components are placed here.

site/pages/

Page components are placed here.

site/parts/

Part components are placed here.

site/x-data/

X-data schemas are defined here

webapp/webapp.js

Webapp based on the Enonic JS framework are placed here.

Java

/src/main/java/

Optionally place Java code here.

/src/test/java/

Optionally place Java tests here.

Libraries

Enonic libraries are similar to applications, the main difference being that a library cannot be installed and started by itself.

Check out the library starter if you are planning to build your own library.

A library may consist of the same files and functionality you would find in an application - such as Assets, Content Types and JS controllers.

Enonic libraries are added to your application by declaring a dependency in the build file.

The core functionality of XP is exposed via standard libraries. Check out the Standard Libraries documentation. You will also find additional libraries on Enonic Market


Contents

Contents

AI-powered search

Juke AI