Welcome to the tinystruct framework documentation. This documentation provides comprehensive guidance for using and developing with the tinystruct framework.
欢迎查阅 tinystruct 框架文档。本文档为使用和开发 tinystruct 框架提供全面的指导。
- Asymmetric RSA & Configurable JWT Security: RSA public/private key pairs and flexible configuration via
application.properties - Advanced HTTP Server Security: Host header filtering (
server.name), path traversal prevention, and secure cookies - Decoupled Architecture: Domain-independent
HttpServerandSSEPushManagerfor seamless multi-domain deployments - Enhanced MCP & AI Support: Overloaded tool methods, schema merging, idle session watchdogs, and auto-cleanup
- ANSI Console Logging: Modern color-coded console logs with Java 9+
StackWalkercaller tracing - Configurable HTTP Timeouts: Custom connect and read timeouts on
URLRequestandHTTPHandler - High Performance: Handling over 86,000 requests per second with ultra-low latency (~17ms)
- Detailed Release Notes: See What's New in 1.7.29 (中文版)
- Getting Started
- Core Concepts
- Web Applications
- CLI Applications
- Configuration
- Database Integration
- Advanced Features
- Best Practices
- What's New in 1.7.29
- API Reference
The fastest way to get started is using the tinystruct archetype:
# Follow the archetype to create a project quickly
https://github.com/tinystruct/tinystruct-archetypeAdd the dependency to your pom.xml:
<dependency>
<groupId>org.tinystruct</groupId>
<artifactId>tinystruct</artifactId>
<version>1.7.29</version>
<classifier>jar-with-dependencies</classifier>
</dependency>package tinystruct.examples;
import org.tinystruct.AbstractApplication;
import org.tinystruct.ApplicationException;
import org.tinystruct.system.annotation.Action;
import org.tinystruct.system.annotation.Action.Mode;
public class Example extends AbstractApplication {
@Override
public void init() {
// Initialization code
}
@Override
public String version() {
return "1.0";
}
@Action("praise")
public String praise() {
return "Praise the Lord!";
}
@Action("say")
public String say(String words) {
return words;
}
// HTTP method-specific actions
@Action(value = "hello", mode = Mode.HTTP_GET)
public String helloGet() {
return "GET";
}
@Action(value = "hello", mode = Mode.HTTP_POST)
public String helloPost() {
return "POST";
}
}- No
main()method required - Applications start directly with CLI commands - Unified CLI and Web - Write once, run anywhere (CLI or Web)
- Built-in lightweight HTTP servers - Netty, Tomcat, or Undertow
- Minimal configuration - No excessive XML or YAML
- Performance-first architecture - Zero overhead, no reflection-based scanning
- AI-ready - Designed for AI integration with MCP support
Running 30s test @ http://127.0.0.1:8080/?q=say/Praise the Lord!
12 threads and 400 connections
Requests/sec: 86753.98
Transfer/sec: 17.46MB
Latency: 17.44ms (avg)
tinystruct follows a modular, action-oriented architecture that enables:
- Code reuse between CLI and web applications
- Unified interface through
@Actionannotation - Plugin-based extensibility
- Low-latency direct method invocation
- Flexible deployment options (monolithic, microservices, or hybrid)
If you'd like to contribute to this documentation, please: 如果您想为此文档做出贡献,请:
- Fork the repository / 复刻仓库
- Create a new branch for your changes / 创建新的分支
- Submit a pull request with your improvements / 提交拉取请求
This documentation is licensed under the same terms as the tinystruct framework (Apache License 2.0). 本文档采用与 tinystruct 框架相同的许可条款。
