DEV Community

Cover image for Reviving a 12K+ Star Abandoned Library: toastr-next v3 🍞
Divyesh
Divyesh Subscriber

Posted on

Reviving a 12K+ Star Abandoned Library: toastr-next v3 🍞

GitHub β€œFinish-Up-A-Thon” Challenge Submission

This is a submission for the GitHub Finish-Up-A-Thon Challenge


What I Built

toastr-next v3 a complete revival of CodeSeven/toastr, one of the most-starred abandoned JavaScript libraries on GitHub with 12,000+ stars and no meaningful commits since 2016.

toastr was the go-to notification library for millions of developers. But time wasn't kind to it. it required jQuery, had no TypeScript, no dark mode, no accessibility, and its Gulp + LESS build chain was completely dead. It was a library everyone knew but nobody could use in a modern project without guilt.

I picked it up, stripped it to the bones, and rebuilt it from scratch for 2026.

From this πŸ‘‡πŸ»:

// 2015 β€” drag in jQuery just to show a toast
<script src="jquery.min.js"></script>  // 30 KB
<script src="toastr.min.js"></script>  // 5 KB
// Total: ~87 KB of dead weight

toastr.success('Hello!');
Enter fullscreen mode Exit fullscreen mode

To this πŸ‘‡πŸ»:

// 2026 β€” zero dependencies, full TypeScript, ~4 KB gzipped
import { toastr } from 'toastr-next';

const toast = toastr.success('Hello!');
await toast.dismissed; // Promise API!
Enter fullscreen mode Exit fullscreen mode

~4 KB gzipped. No jQuery. No bloat. Just toasts. 🍞


Demo

toastr-next live demo β€” dark mode

Dark mode β€” toasts firing with progress bar

toastr-next live demo β€” light mode

Light mode β€” same demo, toggled with the β˜€οΈ button

🌐 Live Demo: toastr-next.vercel.app/

πŸ“¦ npm: npmjs.com/package/toastr-next

πŸ™ GitHub: github.com/Divyesh-5981/toastr


The Comeback Story

Where it was

Original CodeSeven/toastr repo β€” last commit 8 years ago
The original repo β€” abandoned since 2016, 12k stars, zero recent activity

Problem Detail
jQuery required ~87 KB overhead just to show a notification
No TypeScript No types, no IntelliSense, no safety
No dark mode Hard-coded colors, no CSS variables
No accessibility Screen readers couldn't detect toasts at all
JS-driven animations Layout thrash, janky on low-end devices
No Promise API No way to await a toast dismissal
No keyboard support Couldn't dismiss with Escape key
Dead build toolchain Gulp + LESS, completely unmaintained since 2016
No ESM support Global UMD only, no tree-shaking

What I built

πŸ— TypeScript Rewrite (Zero Dependencies)

  • No jQuery: 100% strict TypeScript with full JSDoc.
  • Universal Formats: Ships in ESM, CJS, UMD, and IIFE (works from Vite to raw <script> tags).

🎨 CSS-First Theming

  • Modern CSS: Uses CSS variables instead of inline JS styles.
  • Themes & Motion: Auto dark mode (prefers-color-scheme), manual toggle (localStorage), and prefers-reduced-motion support.
  • Layouts: 4 pure CSS animation presets (Fade, Slide, Bounce, Flip) and native RTL support.

β™Ώ Full Accessibility (WCAG 2.1 AA)

  • Screen Readers: Dynamic ARIA live regions (alert/status) and atomic labels.
  • Keyboard Navigation: Escape key to close, Tab focus management, and pause-on-focus protection.

πŸ”Œ Modern API

  • Async & Events: Promises (await toast.dismissed) and lifecycle event subscriptions (toastr.subscribe).
  • DX & Security: Automatic CSS injection (no separate stylesheet import), native React wrapper (useToastr), and built-in XSS protection.

πŸ“¦ Production Ready

  • Lightweight: ~4 KB gzipped (~2 KB JS + ~2 KB CSS) vs the original ~87 KB jQuery version.
  • Live: Available on npm as toastr-next with a live Vercel demo.

Size comparison

toastr v2 (old) toastr-next v3
Total size ~87 KB (with jQuery) ~4 KB gzipped
Dependencies jQuery required Zero
TypeScript βœ• βœ“
Dark mode βœ• βœ“ Auto + manual toggle
Accessibility βœ• βœ“ WCAG 2.1 AA
Promise API βœ• βœ“
React support Third-party only βœ“ Built-in
Animations JS (jQuery) βœ“ CSS @keyframes
Bundle formats Global UMD only βœ“ ESM, CJS, UMD, IIFE
CSS import Required βœ“ Auto-injected

My Experience with GitHub Copilot

GitHub Copilot (via Kiro) was my co-pilot throughout the entire revival. Here's specifically where it made the difference:

Codebase archaeology β€” I pointed Copilot at the original toastr source and asked it to map what was worth keeping vs. what needed a full rewrite. It correctly identified that the API surface (success, error, info, warning) was the right thing to preserve for backward compatibility, while everything underneath needed to go.

TypeScript type design β€” Copilot helped design the ToastrOptions, ToastResponse, and ToastEvent interfaces. The dismissed: Promise<void> pattern β€” where every toast call returns an awaitable was a Copilot suggestion that turned out to be the most-loved feature of the rewrite.

CSS architecture β€” The CSS custom properties system for theming was co-designed with Copilot. It suggested the [data-theme] + @media (prefers-color-scheme) layering approach that makes both auto and manual theme switching work correctly without JavaScript.

Accessibility β€” Copilot flagged that role="alert" should only be used for error/warning toasts (assertive), while info/success should use role="status" (polite) a subtle but important WCAG distinction I would have missed.

CSS auto-injection β€” When consumers reported having to import the CSS separately, Copilot designed the Vite generateBundle plugin that embeds the stylesheet directly into the JS bundle as a self-executing injector with a guard to prevent double-injection. This was a non-trivial Rollup plugin pattern that Copilot drafted in one shot.

Demo page β€” The entire index.html demo β€” stat strip, playground, comparison table, code tabs, custom ARIA dropdown, light/dark toggle was built iteratively with Copilot, including the theme persistence logic and the seamless tab-to-code-block visual connection in light mode.

Working with Copilot felt less like using a tool and more like having a senior developer who knew every API, caught every edge case, and never got tired. The revival that would have taken weeks took days.


Acknowledgements

Huge respect to the original authors β€” John Papa, Tim Ferrell, and
Hans FjΓ€llemark - who built something so good that developers were still reaching for it a decade later.

This revival exists because their original work was worth finishing ❀️

Top comments (8)

Collapse
 
meet_kalani_0023c22ff7e77 profile image
Meet Kalani

Well Explained!

Collapse
 
divyesh5981 profile image
Divyesh

Thanks, man!

Collapse
 
rahul_moghariya_0d8acc6fa profile image
Rahul Moghariya

Great work man πŸ”₯

Collapse
 
divyesh5981 profile image
Divyesh

Thanks so much! 🀝 Couldn't have done it without GitHub Copilot πŸ€–

Collapse
 
ayushbharadva profile image
Ayush BHaradva

From 87KB of jQuery guilt to 4KB zero-dep TypeScript β€” this is exactly the kind of cleanup the ecosystem needed. Well done! πŸ”₯

Collapse
 
divyesh5981 profile image
Divyesh

Thank you! It was wild seeing just how much weight we could drop by switching to modern CSS custom properties and native Promises. Zero-dep was the hill I wanted to die on for this rewrite! 🎯

Collapse
 
prince_panchani_4dba75790 profile image
Prince Panchani

Excellent write-up and execution.

Collapse
 
divyesh5981 profile image
Divyesh

Thanks a lot! Really appreciate you checking out the write-up. πŸ™Œ