How yesnomore/screw works
Project Type and Purpose
• This is an open-source database documentation generation tool.
• Its purpose is to ease the process of generating up-to-date database documentation by scanning database schemas and creating documentation in various formats (HTML, Word, Markdown) using customizable templates (Freemarker, Velocity).
• The README emphasizes features like multi-database support, extensibility, and the ability to integrate via both direct API usage and via a Maven plugin.
Analyzing the File Structure and Main Components
• The project is split into several core sub-systems:
• screw-core: The heart of the tool that contains the main Java code. Within this module, you see several packages divided by responsibility:
• core/configuration: Handles Configuration classes (like Configuration.java, EngineConfig) that manage the overall settings.
• core/engine: Contains abstract classes and implementations for template engine processing (AbstractTemplateEngine, FreemarkerTemplateEngine, VelocityTemplateEngine) and file format/type management.
• core/metadata: Deals with database metadata (mapping tables, columns, keys) and model classes.
• core/query: Contains implementations of database query interfaces for multiple supported databases (MySQL, MariaDB, Oracle, PostgreSQL, etc.) along with their model representations.
• core/process: Contains the processing logic for generating the documentation (DataModelProcess, AbstractProcess, etc.).
• core/exception and core/util: Provide error handling and utility functions to assist with data manipulation and validations.
• screw-maven-plugin: A wrapper module that integrates the core functionality into Maven builds via a custom plugin (with a mojo class like RunDocMojo.java).
• secrw-dashboard: A web-based dashboard (likely a Spring Boot application, given the presence of a ServletInitializer and configuration files) that may offer an interactive UI for running or managing documentation generation, along with additional features like version management and licensing.
• Main Components to Include:
1. API/Client Layer: Code/Clients that invoke the screw documentation generation
• This could be custom Java applications using the screw-core API or a Maven build invoking the screw-maven-plugin.
2. Documentation Generation Engine (screw-core):
• Configuration Module: Contains settings (Configuration, EngineConfig, ProcessConfig) that define documentation parameters.
• Query Module: Contains various implementations for querying database metadata. This module handles connections (potentially via HikariCP) and abstracts different databases.
• Template Engine Module: Implements template processing with support for both Freemarker and Velocity to generate output in multiple formats.
• Metadata and Mapping Module: Responsible for converting database structures (tables, columns, keys) into internal models.
• Processing Module: Orchestrates the overall flow. It receives configuration, fetches metadata and data using the Query Module, and finally produces the documentation using the Template Engine.
• Exception and Utility Modules: Provide helpers and error handling throughout the process.
3. Integration Layer (screw-maven-plugin):
• A thin wrapper around the core engine that is invoked during a Maven build lifecycle.
• It passes configuration details from the pom.xml to the core engine and triggers documentation generation.
4. Web Dashboard (secrw-dashboard):
• Acts as a frontend/UI layer.
• Likely built with Spring Boot wrapping the core functionalities.
• Contains controllers, services, repository access, and static web content to interact with users.
• Data Flow / Interactions:
• Clients (or the Maven plugin dashboard) supply configuration parameters and initialize the documentation generation process.
• The core engine queries the database metadata using a database-specific Query implementation.
• The retrieved metadata is mapped to internal models and then passed to the processing module.
• The Processing module calls one of the Template Engine modules which uses the chosen templates (either Freemarker or Velocity) to generate the formatted documentation.
• Finally, the output (HTML, Word, Markdown) is saved to a specified location and optionally displayed or served via the dashboard.
• Technologies and Frameworks:
• Java (minimum JDK 1.8) and Maven for building.
• HikariCP for database connection pooling.
• Template libraries: Freemarker and Velocity.
• Spring Boot components in the dashboard module.
• Various database drivers as dependencies (MySQL, Oracle, etc.).
Special Points to Emphasize
• To capture the modular design. For example, list out each supported database query implementation as part of the “Database Query” component.