Can Fklang’s DDD‑Driven DSL Bring Industrial‑Scale Software Development?
This article explores the design and implementation of Fklang, a DDD‑guided architecture DSL, detailing its layered syntax, integration with IDEs, infrastructure abstractions, AI‑assisted code generation, mock server creation, and how it aims to industrialize software development through standardized modeling and tooling.
Over the past few months the author has been designing a DSL called Fklang (https://github.com/feakin/fklang) guided by Domain‑Driven Design (DDD). An MVP compiler and code generator have been built, and the language can be used directly within JetBrains IDEs.
Why a New Architecture Description Language?
Architecture description languages are not new; Fklang is essentially a "new bottle for old wine" that demonstrates how a standardized methodology can enable scalable software development.
ArchGuard Context and the Three‑State Model
Fklang was created to support the design state of ArchGuard’s three‑state model:
Design state: target architecture built with a DSL + architecture workbench.
Development state: focus on visualization, custom analysis, and governance.
Runtime state: combine with APM tools to build a complete analysis chain.
In ArchGuard the tool‑enabled governance principle binds a layered DDD architecture to the code. The layer syntax reflects this idea:
layered DDD {
dependency {
interface -> application
application -> domain
interface -> domain
application -> infrastructure
interface -> infrastructure
}
layer interface {
package: "com.example.book";
}
...
}Standardized DDD Methodology
Fklang adopts a standardized approach similar to ContextMapper, turning graphical designs into code. Example DSL for a ticket‑booking context:
ContextMap TicketBooking {
Reservation -> Cinema;
Reservation -> Movie;
Reservation -> User;
}
Context Reservation {
Aggregate Reservation;
}
Context Cinema {
Aggregate Cinema;
}The DSL can be visualized with the Feakin online tool (https://online.feakin.com/), producing diagrams that facilitate communication between architects and developers.
Implementation Details and Infrastructure Abstraction
Inspired by serverless thinking, the author emphasizes abstracting implementation details. The goal is to separate design from concrete infrastructure, enabling a "FaaS on Microservices" model where each aggregate can run independently yet collaborate.
Example environment configuration:
env Local {
datasource {
driver: postgresql
host: "localhost"
port: 5432
database: "test"
}
server {
port: 9090;
}
}When combined with AI assistance (e.g., GitHub Copilot), developers only need to implement core business logic while the IDE generates controllers, repositories, and other boilerplate.
Software Development Industrialization
Software development industrialization is a batch‑processing model that leverages machine learning and human design wisdom to replace manual steps, achieving rapid, scalable development.
The three core pillars are:
Separation of design and implementation details – developers write only core logic.
Semi‑automated full‑lifecycle – quantifying each stage enables self‑adjusting architectures.
Pattern built into tools – standardization is encoded in the tooling.
Design vs. Implementation: Infrastructure Abstraction
By abstracting infrastructure, the same DSL can generate code for different runtimes. The flow syntax illustrates how API intent is expressed for AI consumption:
impl UserCreated {
endpoint {
POST "/user/{id}";
}
flow {
via UserRepository::getUserById receive user: User;
via UserRepository::save(user: User) receive user: User;
via Kafak send User to "user.create";
}
}From this definition the IDE can insert the corresponding controller code:
@PostMapping("/user/{id}")
public User createUser() {
// 1. get user from UserRepository.getUserById
// 2. save user via UserRepository.save
// 3. send user to Kafka topic "user.create"
}Mock Server Generation
Fklang can also generate a mock server from the DDD model. Example command and output:
fkl run --main /Volumes/source/feakin/fklang/docs/samples/impl.fkl --func mock-serverRunning on http://localhost:9090 yields routes such as:
/api/cinema/cinema
/api/cinema/cinema/1
/api/cinema/screeningroom
/api/cinema/screeningroom/1
/api/cinema/seat
/api/cinema/seat/1
/api/movie/movieAPI Contract Testing
API contracts can be expressed in the DSL and used for verification:
impl UserUpdated {
endpoint {
PUT "/user/{id}";
request: UpdateUser;
response: User;
}
}Currently GET requests have the best support, with detailed logs showing request handling and content‑type information.
Fklang Core Design Principles
Architecture twin: bidirectional binding between design and implementation.
Explicit design intent: DSL makes intent visible and translatable to code.
Type and event driven: bind data types to domain events.
Further reading and resources:
Documentation: https://book.feakin.com/
IDE plugin: https://plugins.jetbrains.com/plugin/20026-feakin
Fklang repository: https://github.com/feakin/fklang
IDE plugin source: https://github.com/feakin/intellij-feakin
phodal
A prolific open-source contributor who constantly starts new projects. Passionate about sharing software development insights to help developers improve their KPIs. Currently active in IDEs, graphics engines, and compiler technologies.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
