How noah20102021/txtshare works
Purpose and entry points
txtShare is a lightweight text-sharing service usable from a browser and shell clients. It accepts text under a key, optionally password-protected, and retrieves it later. The Spring Boot process starts at src/main/java/com/kwirll/txtshare/TxtShareApplication.java; its HTTP API is likely concentrated in src/main/java/com/kwirll/txtshare/apiInterface.java. The browser entry point is the packaged static page at src/main/resources/static/index.html.
Runtime and infrastructure
The application is a Java 21/Maven Spring Boot service (pom.xml) running on embedded Tomcat. Per the README, local startup uses an embedded H2 database, so no externally provisioned datastore is required. Runtime properties are held in src/main/resources/application.properties. Deployment-specific public host configuration is a code-level setting in src/main/java/com/kwirll/txtshare/config.java, which shell setup and generated client commands likely depend on.
HTTP and shell-client boundary
The server exposes endpoints consumed by both the static web UI and command-line workflow. The README identifies /setup as the bootstrap endpoint that users pipe into their shell, then use generated txtPush, txtGet, and txtHelp commands. src/main/java/com/kwirll/txtshare/apiInterface.java is the key boundary translating HTTP requests into text-storage operations; src/main/java/com/kwirll/txtshare/config.java provides the canonical host used in returned setup content or URLs.
Text persistence model
src/main/java/com/kwirll/txtshare/txtClass.java is the central text-record/domain component and likely maps stored values, keys, and password-related fields to the embedded persistence layer. Write flow is: web or shell request → API interface → text model/storage. Read flow is: key (and optional password) → API interface → lookup/validation → returned text. H2 persistence is the durability boundary between requests and restarts, subject to its configured mode.
Application logic layer
src/main/java/com/kwirll/txtshare/functions.java appears to isolate shared operational logic from transport handling, likely covering key lookup, text creation, password checks, or response formatting. This separates request routing in apiInterface.java from domain behavior and persistence represented by txtClass.java. src/main/java/com/kwirll/txtshare/config.java is a second cross-cutting boundary for host/environment assumptions.
Web presentation client
Spring Boot serves the browser UI directly from src/main/resources/static/. src/main/resources/static/index.html supplies the page, src/main/resources/static/script.js performs browser-side interaction with the API, and src/main/resources/static/style.css provides presentation. This client is static rather than a separate frontend runtime: it communicates to the same deployed Spring Boot origin and shares the API contract with shell clients.
Primary operational flow
1. Embedded Tomcat starts the Spring Boot application and serves API routes plus static assets.
2. A browser loads the static UI, or a shell fetches /setup to install/define commands.
3. Clients submit keyed text, optionally including a password, to the API.
4. The API delegates common behavior to functions.java and persists or retrieves txtClass records through the embedded H2-backed application layer.
5. Retrieval requests enforce the key/password contract and return text for shell output or browser rendering.
Main entry points: apiInterface.java API interface · index.html Share page · TxtShareApplication.java TxtShare application · functions.java Shared operations
Components 13
Spring Boot service
Single deployed Java runtime.
- TxtShare application
src/main/java/com/kwirll/txtshare/TxtShareApplication.java - Embedded Tomcat · Serves API routes and packaged static files.
- API interface · Translates setup, write, and retrieval requests into application operations.
src/main/java/com/kwirll/txtshare/apiInterface.java - Shared operations · Handles text creation, lookup, password checks, and response behavior.
src/main/java/com/kwirll/txtshare/functions.java - Text record · Represents keyed text and optional password-related data.
src/main/java/com/kwirll/txtshare/txtClass.java - Embedded H2 · Durability boundary for stored text records.
- Host configuration · Provides the canonical public host used by setup output.
src/main/java/com/kwirll/txtshare/config.java - Application properties
src/main/resources/application.properties
Browser client
Static assets served by the application.
- Share page
src/main/resources/static/index.html - Browser interaction · Calls the same-origin HTTP API.
src/main/resources/static/script.js - Page styling
src/main/resources/static/style.css
Client entry points
- Browser
- Shell client · Installs generated txtPush, txtGet, and txtHelp commands.
Connections 13
- TxtShare application → Embedded Tomcat: starts
- Application properties → TxtShare application: configures
- Embedded Tomcat → API interface: routes requests to
- Embedded Tomcat → Share page: serves
- Share page → Browser interaction: loads
- Share page → Page styling: loads
- Browser → Share page: loads
- Browser interaction → API interface: calls
- Shell client → API interface: fetches /setup and uses commands
- API interface → Host configuration: uses host
- API interface → Shared operations: delegates to
- Shared operations → Text record: creates and looks up
- Text record → Embedded H2: persists in