DEV.co
Open-Source Databases · xxjwxc

gormt

Gormt is a command-line and GUI tool that automatically generates Go structs from MySQL database tables. It integrates with GORM to produce type-safe, annotated Go models with support for foreign keys, indexes, and custom field mappings.

Source: GitHub — github.com/xxjwxc/gormt
2.4k
GitHub stars
361
Forks
Go
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryxxjwxc/gormt
Ownerxxjwxc
Primary languageGo
LicenseMIT — OSI-approved
Stars2.4k
Forks361
Open issues58
Latest releasev2.1.gorm (2021-06-27)
Last updated2026-04-24
Sourcehttps://github.com/xxjwxc/gormt

What gormt is

Gormt connects to MySQL (SQLite, MSSQL) databases, introspects table schemas, and generates Go struct definitions with GORM tags, JSON annotations, and optional helper functions. It supports configuration via YAML or CLI flags and produces models with primary keys, unique constraints, indexes, and association metadata.

Quickstart

Get the gormt source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/xxjwxc/gormt.gitcd gormt# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Rapid API backend scaffolding

Generate model layers for REST or GraphQL APIs from existing database schemas, reducing manual boilerplate and ensuring schema–code alignment.

Monolithic to microservices refactoring

Extract and standardize data models from legacy systems by reverse-engineering database schemas into type-safe Go structs.

Team onboarding and schema documentation

Automatically produce readable, annotated Go models that serve as living documentation of database structure for new developers.

Implementation considerations

  • Database connection credentials must be stored securely (environment variables, vaults); do not commit plaintext config.yml.
  • Generated functions are GORM wrapper helpers; review foreign key and association logic before deploying to production.
  • Column comments using special syntax ([@gorm], [@fk]) must be pre-added to schema to enable advanced features in output.
  • Output can be single file or split by table name; choose strategy based on project package structure and team conventions.
  • Type mapping for database types (datetime, date, etc.) is customizable; verify default mappings match application needs.

When to avoid it — and what to weigh

  • PostgreSQL or NoSQL primary use — Gormt is MySQL-focused. PostgreSQL and NoSQL (MongoDB, DynamoDB) support are not described in the data provided.
  • Highly dynamic or schema-less databases — Tools designed for schemaless data or frequent schema changes may be more appropriate than a code-generation approach.
  • Complex custom type mappings at scale — While custom type definitions are supported, extensive type-system customization may require post-generation refactoring.
  • Zero tolerance for generated code review — Generated structs require human review before production use to verify constraints, tags, and business logic alignment.

License & commercial use

Gormt is licensed under the MIT License, which is a permissive OSI-approved license allowing commercial use, modification, and distribution with minimal restrictions.

MIT License permits commercial use without restrictions. No proprietary claims or royalty obligations. However, the tool is provided as-is with no warranties; users assume liability for generated code quality and compliance with their database schemas.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Gormt connects to live databases using supplied credentials; implement credential rotation and restrict tool access. Generated code contains no hardcoded secrets but must be reviewed for injection vulnerabilities, especially in auto-generated query functions. Validate foreign key constraints to prevent unauthorized data access.

Alternatives to consider

GORM gen (official GORM code generation)

First-party GORM tooling; likely more closely aligned with GORM API evolution and supported versions.

sqlc

Language-agnostic SQL-first code generator producing type-safe query results; better for complex SQL and cross-database compatibility.

sqlalchemy (Python) or Sequelize (Node.js)

If cross-language code generation or non-Go ecosystems are required; not applicable to pure Go projects.

Software development agency

Build on gormt with DEV.co software developers

Gormt eliminates manual struct boilerplate. Connect your database, generate code, and focus on business logic. Works with GORM v1/v2 and supports MySQL, SQLite, and MSSQL.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

gormt FAQ

Does Gormt work with PostgreSQL or MongoDB?
Not clearly stated in the data. Documentation mentions MySQL, SQLite (type 1), and MSSQL (type 2). PostgreSQL support is not described; assume MySQL-primary focus.
Can I regenerate models without overwriting manual edits?
Not documented. Typical code-generation tools require separate directories or manual merge. Review the tool's output strategy before integrating into CI/CD.
What GORM versions are supported?
Data references 'gorm(v1/v2)' and the latest release is from June 2021. Verify GORM compatibility with your target Go version before use.
How do I automate model regeneration in CI/CD?
Use CLI mode (`-g=false`) with environment variables for database config and redirect stdout/stderr to logs. Script integration examples not provided; requires custom pipeline implementation.

Software developers & web developers for hire

Need help beyond evaluating gormt? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and open-source databases integrations — and maintain them long-term.

Ready to speed up your Go backend development?

Gormt eliminates manual struct boilerplate. Connect your database, generate code, and focus on business logic. Works with GORM v1/v2 and supports MySQL, SQLite, and MSSQL.