slugify

Converts any string into a clean, URL-safe slug with built-in Unicode transliteration for dozens of languages.

Library
npm
v1.6.9
1,744 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
42 /100 Fair
Development Activity 12
Maintenance 0
Community 56
Maturity 60
Momentum 40

Technical Analysis

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

Slugify is a zero-dependency JavaScript library that turns any string into a clean, URL-friendly slug. It ships with an extensive character map covering Latin, Greek, Cyrillic, Arabic, Armenian, Georgian, Persian, Thai script, and currency symbols, so accented and non-Latin text is transliterated to its closest ASCII equivalent instead of being stripped outright.

Beyond the default character map, slugify supports per-locale overrides for languages such as German, Bulgarian, Danish, Ukrainian, and Vietnamese where the general transliteration doesn’t match local convention, a runtime extend() API for adding or overriding characters, and configurable options for the replacement character, character removal, casing, and trimming. It ships as a single dependency-free module with TypeScript typings and works equally in Node.js, the browser, and AMD/CommonJS module loaders.

What You Get

  • A single slugify(string, options) function with no runtime dependencies
  • An extensive built-in charMap covering Latin, Greek, Cyrillic, Arabic, Armenian, Georgian, Persian, Thai script, and currency symbols
  • Locale-specific overrides for languages such as German, Bulgarian, Danish, Ukrainian, and Vietnamese where transliteration rules differ from the default map
  • A runtime extend() method to add or override character mappings without patching the library
  • Configurable options for replacement character, character-removal regex, case conversion, strict mode, and trimming
  • Bundled TypeScript type definitions (slugify.d.ts)

Common Use Cases

  • Generating SEO-friendly URL slugs from blog post or product titles
  • Creating safe filenames from user-uploaded file titles
  • Normalizing non-Latin usernames or tags into ASCII-safe identifiers
  • Building consistent anchor IDs from heading text for in-page navigation

Under The Hood

Architecture

Slugify ships as a single-file UMD module (slugify.js) exporting one function via a factory pattern that supports CommonJS, AMD, and browser globals. The runtime logic reduces the input string character-by-character against two embedded lookup tables — charMap for the default transliteration set and locales for a small set of per-language overrides — then applies the removal regex, replacement-character substitution, and an optional trim/lowercase pass. There’s no internal layering or external dependencies, and the only build step (bin/build.js) regenerates the embedded charMap/locales JSON blobs in slugify.js from the source-of-truth files in config/, so changing the core transliteration logic only ever touches this one module.

Tech Stack

The library is vanilla ES2015+ JavaScript with zero runtime dependencies. Its devDependencies are limited to mocha (test runner), nyc (coverage), coveralls (CI coverage reporting), and github-changes (changelog generation from merged PRs). It bundles hand-written TypeScript typings (slugify.d.ts), targets Node >=8 per engines, and requires no bundler, framework, or database — it is consumed directly via require, an AMD loader, or a browser global.

Code Quality

Tests in test/slugify.js and test/locales.js use Mocha with Node’s built-in assert module, covering whitespace handling, allowed/removed characters, every major charMap group (Latin, Greek, Cyrillic, Turkish, Kazakh, Czech, Polish, Latvian, Serbian, currency symbols, and general symbols), the extend() API, the strict/trim/lower/replacement/remove options, and edge cases such as empty-string charmap entries and Unicode normalization. Coverage is measured with nyc and reported to Coveralls, and CI runs the suite via a GitHub Actions workflow. Error handling is limited to a single thrown Error for a missing string argument; there is no ESLint or Prettier configuration in the repo.

API Design The public API is a single function, slugify(string, options), with sensible defaults (dash replacement, trim enabled) and a shorthand where passing a string as the second argument is treated directly as the replacement character — keeping the common case to one call with no configuration object required. More advanced needs (custom charmaps, per-locale overrides, strict ASCII-only output) are opt-in via a plain options object, and the extend() static method offers a lightweight way to augment the charMap process-wide without forking the package. The README documents every option with runnable examples.

Used by 28 apps in this directory

Python
62%
Apache 2.0

Polar

Developer Tools · Ecommerce · Invoicing Finance

10,410

Open source payments infrastructure that turns software into a business — subscriptions, usage-based billing, digital products, and merchant-of-record compliance in one platform.

View details
90
Repo Health
82
Technical
66
Dependency
Built with
Python 62%
TypeScript 31%
Updated 6 days ago
TypeScript
81%
AGPL 3.0

Postiz

Automation · Social Media

37,683

The agentic social media scheduler — AI-powered content creation, 33-platform posting, and team workflows, all self-hosted.

View details
92
Repo Health
70
Technical
63
Dependency
Built with
TypeScript 81%
JavaScript 11%
Updated 6 days ago
TypeScript
98%
MIT

sigle

Blogging

489

A decentralized, open-source writing platform that permanently stores your stories on the Stacks blockchain and Arweave — where Web3 content creators own their words forever.

View details
81
Repo Health
78
Technical
69
Dependency
Built with
TypeScript 98%
Updated 2 weeks ago
TypeScript
72%
Apache 2.0

Supabase

Authentication · Databases · Developer Tools

113,827

The open-source Postgres development platform that replaces Firebase with authentication, real-time APIs, edge functions, storage, and vector embeddings — all built on PostgreSQL.

View details
90
Repo Health
91
Technical
62
Dependency
Built with
TypeScript 72%
MDX 26%
Updated 5 days ago
Rust
66%
Apache 2.0

Temps

Analytics · Devops · Monitoring

865

A self-hosted Rust PaaS that replaces Vercel, Sentry, PostHog, Pingdom, Resend, and E2B with one binary — plus 440+ CLI operations agents like Claude Code can drive directly.

View details
81
Repo Health
86
Technical
66
Dependency
Built with
Rust 66%
TypeScript 33%
Updated 6 days ago
JavaScript
82%
MIT

Unlighthouse

Developer Tools

4,904

An open-source CLI that scans your entire website with Google Lighthouse, using smart sampling and a modern dashboard UI to audit every page instead of one URL at a time.

View details
84
Repo Health
70
Technical
79
Dependency
Built with
JavaScript 82%
TypeScript 13%
Updated 6 days ago
TypeScript
87%
Other

Webiny JS

Blogging · CMS · Ecommerce

8,047

Open-source, self-hosted CMS on AWS serverless — a TypeScript framework you extend with code, not a product you configure through a UI.

View details
90
Repo Health
86
Technical
61
Dependency
Built with
TypeScript 87%
JavaScript 12%
Updated 6 days ago
Python
92%
GPL 3.0

Weblate

Developer Tools

6,124

Continuous localization platform that commits translations directly into your version control system with full translator attribution.

View details
95
Repo Health
86
Technical
67
Dependency
Built with
Python 92%
Updated 5 days ago
TypeScript
99%
AGPL 3.0

Webstudio

Design Tools · No Code Platforms

9,103

Open source visual development platform with complete CSS control, headless CMS integration, and full infrastructure ownership

View details
91
Repo Health
79
Technical
60
Dependency
Built with
TypeScript 99%
Updated 6 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