strcase

A lightweight Go library for converting strings to snake_case, kebab-case, or CamelCase.

Library
Go
vv0.3.0
1,144 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
35 /100 Needs Attention
Development Activity 0
Maintenance 0
Community 52
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
66 /100 Good
Architecture 72
Code Quality 68
Innovation 78
Learning Curve 45

strcase is a focused Go library for converting strings between casing conventions. It exposes functions for snake_case, SCREAMING_SNAKE_CASE, kebab-case, SCREAMING-KEBAB-CASE, CamelCase, and lowerCamelCase, all built on top of a general ToScreamingDelimited primitive that also supports fully custom delimiters and a per-call ignore list for characters that shouldn’t trigger a new delimiter.

Beyond straightforward conversion, strcase lets callers register custom acronym mappings through ConfigureAcronym, backed by a concurrency-safe sync.Map, so abbreviations like API or TTM convert to a single predictable token instead of being split apart letter-by-letter. With no external dependencies and a compact, single-purpose codebase, it’s a common choice for database-to-struct field mapping, JSON key normalization, and code generators that need consistent identifier casing.

What You Get

  • A small set of pure functions (ToSnake, ToScreamingSnake, ToKebab, ToScreamingKebab, ToCamel, ToLowerCamel) covering the common case-conversion needs.
  • ToDelimited and ToScreamingDelimited primitives for building custom delimited case formats beyond the built-in presets.
  • A global, thread-safe acronym registry (ConfigureAcronym) to control how consecutive capital letters are treated during conversion.
  • Zero external dependencies and a single-file-per-concern layout (camel.go, snake.go, acronyms.go) that’s easy to audit or vendor.

Common Use Cases

  • Converting database column names to CamelCase struct fields for ORMs
  • Normalizing JSON keys between snake_case APIs and Go conventions
  • Generating consistent identifiers in code-generation tools
  • Deriving environment variable or CLI flag names from a canonical field name

Under The Hood

Architecture strcase is a single flat package with no internal layering: snake.go defines ToScreamingDelimited as the core conversion primitive, with ToSnake, ToScreamingSnake, ToKebab, and ToScreamingKebab implemented as thin wrappers around it, while camel.go implements a separate toCamelInitCase algorithm for the two camel-case variants; both files share a package-level acronym lookup defined in acronyms.go. As a leaf utility library with no interfaces, structs, or dependency injection, there is little to “break” architecturally - the design trades layering for directness, which suits its narrow scope well.

Tech Stack The module targets Go 1.16 and depends on nothing beyond the standard library (strings for byte-level string building, sync for the concurrent acronym map). There is no build tooling beyond go build/go test; CI is configured via a legacy .travis.yml matrix spanning Go 1.10 through 1.15 plus master, with no evidence of a modern GitHub Actions workflow.

Code Quality Test coverage is reasonably thorough for the package’s size: camel_test.go and snake_test.go together contain a large set of table-driven cases covering screaming variants, custom delimiters, and ignore-character behavior, and a dedicated concurrency_test.go exercises ConfigureAcronym under concurrent goroutines to validate the sync.Map choice. There is no visible linter configuration and the CI matrix is dated, but naming is idiomatic Go and the functions are pure with no error-swallowing since none of them return errors.

API Design The public API is intentionally minimal - every conversion function takes a plain string and returns a plain string, so getting started requires nothing beyond strcase.ToCamel(s). Acronym customization is opt-in through a single ConfigureAcronym call rather than mandatory setup, and the naming scheme (To<Case>, ToScreaming<Case>) is consistent enough to guess unfamiliar functions correctly. The README’s conversion table doubles as inline documentation, though the package lacks runnable Go example functions (example_test.go) that would otherwise surface in GoDoc.

Used by 5 apps in this directory

Go
74%
Other

Flipt

Developer Tools · Devops

4,911

Git-native feature flag platform that stores, versions, and deploys feature toggles directly in your own Git repositories with no external database required.

View details
90
Repo Health
83
Technical
69
Dependency
Built with
Go 74%
TypeScript 25%
Updated 4 days ago
Go
95%
MIT

Formance Ledger

Databases · Developer Tools · Invoicing Finance

1,407

The programmable open source core ledger for fintech — build money-moving applications with atomic multi-posting transactions, account-based modeling, and Numscript, a built-in DSL for financial logic.

View details
87
Repo Health
8
Technical
68
Dependency
Built with
Go 95%
Updated 6 days ago
Go
39%
Apache 2.0

Rill

Analytics · Data Engineering

2,914

The fastest BI tool for humans and agents — define metrics, models, and dashboards as code and query them instantly on ClickHouse or DuckDB.

View details
87
Repo Health
88
Technical
64
Dependency
Built with
Go 39%
TypeScript 38%
Svelte 21%
Updated 1 weeks ago
Go
99%
MIT

temporal

Automation · Devops

23,327

Open-source durable execution platform that keeps mission-critical workflows running through any failure, automatically.

View details
92
Repo Health
85
Technical
67
Dependency
Built with
Go 99%
Updated 4 days ago
Go
66%
AGPL 3.0

Vikunja

Project Management

5,533

Self-hosted task management with natural-language quick-add, multiple views, and a fully documented REST API — your tasks, your infrastructure, zero lock-in.

View details
86
Repo Health
81
Technical
68
Dependency
Built with
Go 66%
TypeScript 22%
Vue 10%
Updated 4 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers