hilla
CLAUDE.md985 starsChanged 3 years agoApache-2.0View on GitHub
Hilla is a web framework that integrates a Spring Boot Java backend with a reactive TypeScript frontend, providing type-safe server communication through automatic code generation from Java endpoints to TypeScript clients. Key Features: - Type-safe endpoints using @BrowserCallable annotation - Automatic TypeScript generation from Java backend - Support for both React and Lit frontends - Plugin-based code generation architecture Design and implementation guidelines live in guidelines/. Read the chapters mapped in guidelines/overview.md selectively for the topics your work touches. How…
- Installs packages
We split this CLAUDE.md into the rules it gives an agent
9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 87
Add Vaadin pre-release repository (see README.md for configuration)
- Very specific: line 93
Remove the package line from package.json when done
- Very specific: line 172
Use tools.jackson.databind.ObjectMapper for Hilla serialization
- Very specific: line 195
Add what the writers need to the model in packages/java/typescript-generator/src/main/java/com/vaadin/hilla/generator/model
- Very specific: line 198
Write it in the matching writer under .../generator/typescript
- Very specific: line 199
Add a test case, and run the tests once with -Dhilla.test.updateSnapshots
- Distinctive: line 203
Update parser plugins if what the parser has to see changes
- Very specific: line 205
Add integration tests in packages/java/tests/spring/
- Very specific: line 208
Check generated TypeScript in frontend/generated/, which generated-file-list.txt lists
≈ “Common” is an estimate: at least 1 in 5 of the 25,680 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Overview
Hilla is a web framework that integrates a Spring Boot Java backend with a reactive TypeScript frontend, providing type-safe server communication through automatic code generation from Java endpoints to TypeScript clients.
Key Features:
- Type-safe endpoints using
@BrowserCallableannotation - Automatic TypeScript generation from Java backend
- Support for both React and Lit frontends
- Plugin-based code generation architecture
Guidelines
Design and implementation guidelines live in guidelines/. Read the chapters
mapped in guidelines/overview.md selectively for the topics your work
touches.
Build Commands
How the build keeps the npm versions in step with Flow and the platform, and
which script does what: scripts/README.md.
Initial Setup
npm install
npm run build
mvn clean spotless:apply install -DskipTestsTypeScript Development
# Build all TypeScript packages
npm run build
# Build with alignment (syncs versions)
npm run build:align
# Clean build artifacts
npm run clean:build
# Lint
npm run lint
npm run lint:fix
# Type checking
npm run typecheck
# Run all tests
npm test
# Run tests with coverage
npm test:coverage
# Run React-specific tests
npm test:reactJava Development
# Build and install (skip tests)
mvn clean install -DskipTests
# Format code according to Vaadin conventions
mvn spotless:apply
# Run Java tests
mvn test
# Run integration tests (production build)
mvn verify -Pproduction
# Run single test class
mvn test -Dtest=ClassName
# Run specific test method
mvn test -Dtest=ClassName#methodNameTesting Local Changes
Java modules (packages/java/*):
- Build with
mvn clean install - In your test app's
pom.xml, set version to25.3-SNAPSHOT - Add Vaadin pre-release repository (see README.md for configuration)
TypeScript modules (packages/ts/*):
- Navigate to modified package
- Run
npm run build && npm pack - In your test app:
npm install <path-to-tgz> - Remove the package line from
package.jsonwhen done
Architecture
Deeper notes on each subsystem live in ARCHITECTURE.md files next to the
code, listed at the top of guidelines/architecture.md.
Monorepo Structure
This is an Nx-based monorepo with:
- Java packages:
packages/java/*(Maven modules) - TypeScript packages:
packages/ts/*(npm workspaces) - Test apps:
packages/java/tests/*
Java Backend Architecture
Endpoint Layer (packages/java/endpoint)
- Core annotations:
@BrowserCallable,@AnonymousAllowed,@PermitAll,@RolesAllowed - EndpointController: Main HTTP endpoint handling (
/connect/{endpoint}/{method}) - EndpointInvoker: Invokes Java methods with type conversion
- EndpointRegistry: Discovers and registers
@BrowserCallableendpoints - Authentication and authorization handling
Engine (packages/java/engine-core, packages/java/engine-runtime)
- EngineConfiguration: Main configuration for code generation
- ParserProcessor / TypeScriptProcessor: Walk the browser callable classes and write the TypeScript of them
- Integrates with Maven/Gradle plugins
Parser and generator (packages/java/typescript-generator)
- parser core: Walks the browser callable classes with reflection
- plugins: Say what the walk finds:
backbone: The endpoints, their methods and the types they sendmodel: What the validation and persistence annotations say about a valuenonnull: Nullability analysissubtypes: Polymorphic type handlingtransfertypes: Data transfer object processing
- generator: The model the writers need, and the TypeScript files written from it
Maven/Gradle Plugins
- maven-plugin (
packages/java/maven-plugin): Configures and runs code generation during Maven build - gradle-plugin (
packages/java/gradle-plugin): Same for Gradle builds
TypeScript Frontend Architecture
Generating the endpoint TypeScript
The TypeScript of the endpoints is written in Java, by
packages/java/typescript-generator: see its README. The file router writes
its routes with generator-utils.
Frontend Utilities
- frontend (
packages/ts/frontend): Core utilities (Authentication, Connect client, Cookie management) - react-* (
packages/ts/react-*): React-specific hooks and componentsreact-auth: Authentication hooksreact-form: Form handling with type safetyreact-crud: CRUD operationsreact-i18n: Internationalizationreact-signals: Reactive state management
- lit-form (
packages/ts/lit-form): Form handling for Lit - file-router (
packages/ts/file-router): File-based routing
Code Generation Flow
- The walk: The parser plugins walk the browser callable classes and say what they find about the endpoints, their methods and the types of the values
- The model: A plugin collects what the writers need while that happens
- The writers: The TypeScript files are filled in from the model
- Output: Type-safe TypeScript clients matching Java endpoints exactly
Generated code location in apps: frontend/generated/
Important Technical Details
Jackson
Hilla uses Jackson 3 (tools.jackson.*): the endpoints serialize with it,
and the parser asks it what a class serializes as. The annotations
(com.fasterxml.jackson.annotation.*) are the ones both versions share.
Key points:
- Use
tools.jackson.databind.ObjectMapperfor Hilla serialization - An application may still have an object mapper of Jackson 2 of its own
Testing Structure
- packages/java/tests/spring/: Spring Boot integration tests
- packages/java/tests/gradle/: Gradle plugin tests
- Each TypeScript package has its own test suite using Vitest
Code Style
TypeScript
- ESLint config:
.eslintrc.json(extends Vaadin config) - Prettier: Single quotes, 120 char width, trailing commas
- Use TypeScript 5.9+
Java
- Formatter: Vaadin Java Conventions (
.config/VaadinJavaConventions.xml) - Java 21+ (source level)
- SLF4J for logging (java.util.logging is banned)
Common Workflows
Writing Something New in the Generated TypeScript
- Add what the writers need to the model in
packages/java/typescript-generator/src/main/java/com/vaadin/hilla/generator/model - Collect it in
EndpointModelPluginwhile the parser walks the classes - Write it in the matching writer under
.../generator/typescript - Add a test case, and run the tests once with
-Dhilla.test.updateSnapshots
Adding a New Java Endpoint Feature
- Modify/extend classes in
packages/java/endpoint - Update parser plugins if what the parser has to see changes
- Extend the Java TypeScript writers if the generated TypeScript changes
- Add integration tests in
packages/java/tests/spring/
Debugging Code Generation
- Check generated TypeScript in
frontend/generated/, whichgenerated-file-list.txtlists - Enable debug logging in EngineConfiguration
Dependencies
Required Versions
- Node.js: >= 22 LTS
- npm: >= 10 (lockfile v3)
- JDK: >= 17 (source level 21)
- Maven: >= 3
Key Java Dependencies
- Spring Boot 4
- Jackson 3
- Vaadin Flow 25.4-SNAPSHOT
Key TypeScript Dependencies
- TypeScript 5.9.3
- Vite 7.1.9
- Vitest 3.1.1
- React 19.2.0
- Lit 3.3.1
CI/CD
- GitHub Actions workflow:
.github/workflows/validation.yml - Runs on push to main and PRs
- Parallel test execution for Java tests
- Coverage reporting with JaCoCo (Java) and c8 (TypeScript)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

