Skip to content

sequelcore/sequel-backend-demo

Sequel Backend Demo

Sequel Backend Demo is the public Java backend reference implementation for Sequel projects. It shows a small, production-shaped Spring Boot service using DDD, Clean Architecture, PostgreSQL, Docker, Testcontainers, and Mortar.

The demo domain is the Sequel ecosystem registry. A Block is a public Sequel component such as Mortar or Vigil. Mortar is the only Sequel library used by the application; Vigil appears only as seed data.

Scope

  • Java 21.
  • Spring Boot 3.5.x.
  • PostgreSQL 16 through Docker Compose and Testcontainers.
  • Gradle Kotlin DSL.
  • Mortar Java artifacts from Maven Central.
  • Mortar CLI and LSP from crates.io.
  • Clean Architecture package boundaries.
  • HTTP endpoints for generated reads, DSL reads, scalar reads, and mutations.
  • SQL assertions for generated reads, DSL reads, scalar reads, row-count mutations, and PostgreSQL RETURNING.

Vigil and other Sequel libraries are intentionally out of scope until this demo has a clear authentication slice.

Install Tooling

cargo install sequel-mortar-cli --version 0.1.0
cargo install sequel-mortar-lsp --version 0.1.0
code --install-extension sequelcore.mortar-vscode --pre-release

The VS Code extension is a lightweight client. It does not bundle the Rust executables; keep mortar and mortar-lsp on PATH, or configure their paths in VS Code.

Run With Docker

Docker Desktop must be running.

docker compose up --build

The backend is available at http://localhost:8080. PostgreSQL is exposed on localhost:54328 by default.

Block responses include id, name, and active so read endpoints expose the same lifecycle state used by active filters, scalar reads, and mutations.

Useful calls:

curl http://localhost:8080/api/v1/blocks
curl http://localhost:8080/api/v1/blocks/1
curl http://localhost:8080/api/v1/blocks/1/active
curl http://localhost:8080/api/v1/blocks/active/count
curl http://localhost:8080/api/v1/blocks/1/active/exists
curl http://localhost:8080/api/v1/blocks/2/active/exists
curl -X POST http://localhost:8080/api/v1/blocks -H "Content-Type: application/json" -d "{\"id\":3,\"name\":\"Anvil\",\"active\":true}"
curl -X PATCH http://localhost:8080/api/v1/blocks/3/deactivate
curl -X DELETE http://localhost:8080/api/v1/blocks/3

Stop the demo with:

docker compose down

Verify

gradlew.bat check --no-daemon
mortar snapshot check --file mortar.sql.snap.json
mortar report --metadata-file app\build\classes\java\main\META-INF\mortar\entities.json
docker compose config
docker build --tag sequel-backend-demo:local .

The build compiles the application, runs the Mortar annotation processor, generates Q* metamodels, verifies SQL rendering, and runs PostgreSQL integration tests through Testcontainers.

The repository also includes mortar.sql.snap.json for generated findById and findAll read facades so Mortar editor tooling has snapshot evidence available after the first build.

What To Inspect

Start with:

  • app/src/main/java/com/sequel/demo/registry/domain/entities/Block.java
  • app/src/main/java/com/sequel/demo/registry/domain/repositories/BlockRepository.java
  • app/src/main/java/com/sequel/demo/registry/application/services/BlockService.java
  • app/src/main/java/com/sequel/demo/registry/presentation/BlockController.java
  • app/src/main/java/com/sequel/demo/registry/infrastructure/persistence/entities/BlockRow.java
  • app/src/main/java/com/sequel/demo/registry/infrastructure/persistence/repositories/MortarBlockRepository.java
  • app/src/test/java/com/sequel/demo/registry/infrastructure/persistence/repositories/MortarBlockRepositorySqlTest.java
  • app/src/test/java/com/sequel/demo/registry/presentation/BlockControllerIntegrationTest.java

In VS Code, open MortarBlockRepository.java and inspect generated-read calls such as:

BLOCK_ROW.read(renderer).findById(id.value())

Mortar editor tooling should provide SQL visibility for supported generated read calls when generated metadata and snapshots are present.

Architecture

com.sequel.demo/
├── SequelBackendDemoApplication.java
├── registry/
│   ├── domain/
│   │   ├── entities/
│   │   ├── valueobjects/
│   │   └── repositories/
│   ├── application/
│   │   ├── dto/
│   │   └── services/
│   ├── infrastructure/
│   │   └── persistence/
│   │       ├── configuration/
│   │       ├── entities/
│   │       └── repositories/
│   └── presentation/
└── shared/
    └── presentation/

Domain code imports no Spring, JDBC, Mortar, PostgreSQL, or web classes. Application code imports no Mortar, JDBC, or PostgreSQL classes. Mortar usage is kept under registry.infrastructure.persistence.

See docs/architecture.md for the implementation architecture and docs/sequel-backend-standards.md for the public backend standard.

About

Public Spring Boot backend demo for Sequel libraries, starting with Mortar.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors