Welcome to the tinystruct framework documentation. This documentation provides comprehensive guidance for using and developing with the tinystruct framework.
欢迎查阅 tinystruct 框架文档。本文档为使用和开发 tinystruct 框架提供全面的指导。
- Enhanced AI Integration: Built-in support for AI integration and plugin-based architecture
- MCP Server Support: Integration with Model Context Protocol (MCP) for advanced AI capabilities
- Improved Performance: Handling over 86,000 requests per second with ultra-low latency (~17ms)
- HTTP Method-Specific Actions: Support for HTTP method-specific routing (GET, POST, PUT, DELETE, etc.)
- Modern Architecture: No
main()method required - start applications directly with CLI commands - Modular Design: Plugin-based architecture for extensibility
- Multiple Server Options: Support for Netty, Tomcat, and Undertow
- SSE Support: Built-in Server-Sent Events support for real-time applications
- Getting Started
- Core Concepts
- Web Applications
- CLI Applications
- Configuration
- Database Integration
- Advanced Features
- Best Practices
- 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.17</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 框架相同的许可条款。
