GitHub - tinystruct/tinystruct.github.io: The documentation for tinystruct framework.
Repository navigation
tinystruct.github.ioPublic
About
The documentation for tinystruct framework.
tinystruct.org/Resources
Readme Activity Custom propertiesStars
0 starsWatchers
1 watchingForks
0 forks Report repositoryBranches
Tags
Go to Branches page Go to Tags page
Latest commit
History
155 Commits
View commit history for this file.
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
| .idea | .idea | ||
| _layouts | _layouts | ||
| assets/ css | assets/ css | ||
| en | en | ||
| zh | zh | ||
| .gitattributes | .gitattributes | ||
| CNAME | CNAME | ||
| README.md | README.md | ||
| _config.yml | _config.yml | ||
| architecture.gif | architecture.gif | ||
| create | create | ||
| create.ps1 | create.ps1 | ||
| favicon.ico | favicon.ico | ||
| index.html | index.html | ||
| llms.txt | llms.txt | ||
Repository files navigation
tinystruct framework Documentation
Welcome to the tinystruct framework documentation. This documentation provides comprehensive guidance for using and developing with the tinystruct framework.
欢迎查阅 tinystruct 框架文档。本文档为使用和开发 tinystruct 框架提供全面的指导。
What's New in v1.8.0
- Behavior Changes : templates HTML-escape variables by default (use
HtmlVariablefor trusted markup), only server-issued session ids are accepted (regenerateSession()on login), request bodies overdefault.http.max_content_lengthget 413, malformed arguments get 400,Settings.set()/remove()no longer write to disk, andbin/dispatcherexits 1 when an action fails - SQL Injection Defense :
SQLIdentifierallow-lists table, column andORDER BYidentifiers at every boundary, withSQLInjectionDetectorkept as defense in depth and parameterized SQL Server inserts - Reliable
sql-executeScripts : stops at the first failing statement, prints rows for queries, and splits scripts withSQLScriptSplitter(comments, quoted identifiers, dollar quotes,DELIMITER) - Hardening & Bounded Resources : XXE-safe
Documentparsing, Host header validation, LRU-boundedContainer, bounded HTTP executor, SSE cleanup on disconnect and shutdown - Detailed Release Notes : See What's New in 1.8.0 (中文版 )
Previous: v1.7.40 Highlights
- AI Coding-Agent Instructions &
bin/dispatcher agents: Automatically generatesAGENTS.md,CLAUDE.md, and the bundledtinystruct-patternsskill (.agents/skills/and.claude/skills/) when missing in build-file projects; also available viabin/dispatcher agents [--force] - Default Auto-Incrementing
Application.version():AbstractApplication.version()now defaults to build-time Git-history versioning viaApplicationVersionGenerator(META-INF/tinystruct-versions.properties) - MCP Execution & Schema Hardening : Split
MCPTool.ToolMethodintobind()andinvoke()to prevent retrying overloads after runtime errors, enabled-parametersfor name-based@Argumentbinding, and hardenedrequired/enumschema validation for JSON-parsed schemas - API Modernization & Bug Fixes : Replaced
JWTCodecwithJWTSerializer/JWTDeserializer(AbstractSerializer/AbstractDeserializer), updatedDistributedRedisLocktoRedisURI.Builder.withAuthentication(...), and preserved original exception causes inSQLiteGeneratorandWatcher - Detailed Release Notes : See What's New in 1.7.40 (中文版 )
Previous: v1.7.39 Highlights
- TokenGuard Pre-Authentication Defense : Added configurable
TokenGuarddefending against malformed, oversized, or malicious token inputs (length enforcement, whitespace/control char rejection, Base64 padding semantics, and compact JWT RFC 7515/7519 structure verification) - Catastrophic Backtracking Mitigation : Configurable token block patterns with a bounded evaluation step budget (
50,000steps) to prevent Regular Expression Denial of Service (ReDoS) - HTTP & MCP Security Status Mapping :
HttpServerandAuthorizationHandlerintegrateTokenGuard, returning400 Bad Requestfor malformed/oversized tokens,401 Unauthorizedfor failed auth, and403 Forbiddenfor policy-blocked tokens - Template Engine & ClassLoader Portability : Standardized on cross-platform
'/'template path separators inAbstractApplication, removed hardcodedLocale.CHINAcomparison, added hierarchical ClassLoader resolution fallbacks, and prevented stream leaks with try-with-resources - DOM & Core Stability Fixes : Fixed infinite loop in
Element.removeElement(String), preserved originalIOExceptioncauses inDocument.load(...), and safely parsed URI user info inConnectionManager - Detailed Release Notes : See What's New in 1.7.39 (中文版 )
Previous: v1.7.38 Highlights
- Security & Dependency Upgrades : Pinned
org.ow2.asm(9.11.1) to resolve CVEs pulled transitively vianashorn-core, and upgradedreactor-core(3.8.8) andsqlite-jdbc(3.54.1.0) - JSON Round-Trip & Escaping Fixes : Escaped object keys and quoted lookalike strings in
Builder; preservedBoolean/nullarray literals and unescaped array strings inBuilders - Faster Lock-File I/O & Configurable Timeouts : Single-read
.lockscanning inWatcherplusdistributed.lock.timeoutanddistributed.lock.file.timeoutsettings (5000ms default) - Concurrency, Logging & App Lifecycle : Eliminated
DistributedMessageQueue.take()lock starvation, switchedLogFormatterto thread-safeDateTimeFormatter, enabledFileHandlerlogging by default, cleaned upApplicationManager.uninstall(), and undeprecatedApplication.setAction(String, String) - Ecosystem & Server Modules Updated :
tinystruct-netty-http-server(1.1.12),tinystruct-tomcat-server(1.1.12),tinystruct-undertow-server(1.1.3),tinystruct-workflow(1.0.3), andtinystruct-typesafe(1.0.1) - Detailed Release Notes : See What's New in 1.7.38 (中文版 )
Previous: v1.7.37 Highlights
- Static File Serving Protection : Strict static directory whitelisting (
server.static.dirs/server.static.dir); project root files, configs, and sources cannot be downloaded - Path Traversal & Alias Mitigation : Rejection of traversal sequences, null bytes, Windows NTFS alternate data streams (
::$DATA), and trailing dot/space aliases - HTTP Caching & Conditional Requests : Full support for
If-Modified-Since(304 Not Modified),Cache-Control, andExpiresheaders - Server Modules Updated :
tinystruct-netty-http-server(1.1.11),tinystruct-tomcat-server(1.1.11), andtinystruct-undertow-server(1.1.2) - Detailed Release Notes : See What's New in 1.7.37 (中文版 )
Previous: v1.7.36 Highlights
- Configurable Logging Handlers :
handlersproperty withFileHandlersupport (rotation, size limit) - Hardened MCP Server : Initialization enforced, active sessions kept alive, auth token no longer logged
- Kafka Client Removed :
KafkaClientand Kafka dependencies dropped from the framework - Detailed Release Notes : See What's New in 1.7.36 (中文版 )
Previous: v1.7.35 Highlights
- Dependency Upgrades : Lettuce 7.8.0, H2 2.5.252, Mockito 5.24.0, and Netty BOM 4.2.18.Final
- CVE Patches : Patched versions of vulnerable transitive dependencies (Netty, zstd-jni, lz4-java, snappy-java, Reactor)
- Reliable Interrupt Handling :
DistributedMessageQueueandAlarmClocknow restore the thread interrupt flag - Detailed Release Notes : See What's New in 1.7.35 (中文版 )
Previous: v1.7.34 Highlights
- Annotation-Driven ORM :
@Table,@Idand@Columnfor code-first POJO mapping, with opt-in table auto-creation - Enum-Collection Arguments :
@Actionmethods acceptList<EnumType>from comma-separated input
Previous: v1.7.30 Highlights
- PostgreSQL Database Support :
Type.PostgreSQLandPostgreSQLServer, including a dedicated POJO generator
Previous: v1.7.29 Highlights
- 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)
- Full Release Notes : What's New in 1.7.29 (中文版 )
Choose Your Language / 选择语言
English Documentation
- Getting Started
- Core Concepts
- Web Applications
- CLI Applications
- Configuration
- Database Integration
- Advanced Features
- Best Practices
- What's New in 1.8.0
- What's New in 1.7.40
- What's New in 1.7.39
- What's New in 1.7.38
- What's New in 1.7.37
- What's New in 1.7.36
- What's New in 1.7.35
- What's New in 1.7.30
- What's New in 1.7.29
- API Reference
中文文档
- 入门指南
- 核心概念
- Web应用开发
- 命令行应用
- 配置说明
- 数据库集成
- 高级特性
- 最佳实践
- 1.8.0 新特性
- 1.7.40 新特性
- 1.7.39 新特性
- 1.7.38 新特性
- 1.7.37 新特性
- 1.7.36 新特性
- 1.7.35 新特性
- 1.7.30 新特性
- 1.7.29 新特性
- API参考
Quick Start
Using the tinystruct Archetype
The fastest way to get started is using the tinystruct archetype:
# Follow the archetype to create a project quickly https://github.com/tinystruct/tinystruct-archetype
Manual Installation
Add the dependency to your pom.xml:
<dependency>
<groupId>org.tinystruct</groupId>
<artifactId>tinystruct</artifactId>
<version>1.8.0</version>
<classifier>jar-with-dependencies</classifier>
</dependency>
Basic Example
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";
}
}
Why Choose tinystruct?
Modern Design Philosophy
- 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
Performance Benchmarks
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)
Architecture
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)
Support / 赞助
If tinystruct is useful to you, please consider supporting the project: opencollective.com/tinystruct 如果 tinystruct 对您有帮助,欢迎通过 Open Collective 赞助本项目。
Contributing / 贡献
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 / 提交拉取请求
License / 许可证
This documentation is licensed under the same terms as the tinystruct framework (Apache License 2.0). 本文档采用与 tinystruct 框架相同的许可条款。
About
The documentation for tinystruct framework.
tinystruct.org/