Skip to content

First Example

Creating an admin page with Erupt is extremely simple — a single Java class is all you need:

java
package xyz.erupt.example.model;

import jakarta.persistence.*;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.View;

import java.util.Date;

// @Erupt goes on the class, @EruptField goes on each field. The rest are standard JPA annotations.
@Erupt(name = "Simple Example")
@Table(name = "demo_simple")
@Entity
public class Simple {

    // Primary key
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @EruptField
    private Long id; // No need to redeclare id if you extend BaseModel

    // Text input
    @EruptField(
        views = @View(title = "Text"),
        edit  = @Edit(title = "Text")
    )
    private String input;

    // Numeric input
    @EruptField(
        views = @View(title = "Number"),
        edit  = @Edit(title = "Number")
    )
    private Integer number = 100; // default value 100

    // Boolean switch
    @EruptField(
        views = @View(title = "Boolean"),
        edit  = @Edit(title = "Boolean")
    )
    private Boolean bool;

    // Date picker
    @EruptField(
        views = @View(title = "Date"),
        edit  = @Edit(title = "Date")
    )
    private Date date;
}

TIP

Erupt 2.x runs on Spring Boot 3.5.16, so JPA annotations live in the jakarta.persistence package (no longer javax.persistence). If your entity extends xyz.erupt.jpa.model.BaseModel, the id primary key is already declared by the parent class and does not need to be repeated.

After starting the project, simply bind the class to a menu. Steps:

How to bind: log in, go to System Management → Menu Management, click Add, set the menu type to Table, the type value to Simple, save and refresh — the menu is now accessible.

The database schema and column comments are generated automatically:

More Examples

More example code: https://www.erupt.xyz/#!/contrast

Erupt supports more than 23 categories of components for flexible configuration.

In real-world development, only the @Erupt and @EruptField annotations are required to get started.

Contributors

The avatar of contributor named as YuePeng YuePeng
The avatar of contributor named as Claude Opus 5 (1M context) Claude Opus 5 (1M context)

Changelog

Released under the Apache-2.0 License.