
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@the-node-forge/url-shortener
Advanced tools
A URL shortener that generates and stores unique aliases for long URLs, with optional expiration and custom alias support.
A simple, fast, and Redis-backed URL shortener written in TypeScript. Supports custom aliases, TTL expiration, and works seamlessly in Node.js environments.
sho.rt/launch
npm install @the-node-forge/url-shortener
yarn add @the-node-forge/url-shortener
npm install redis
Redis is required and should be connected externally via
createClient()
import { createClient } from 'redis';
import { RedisStore } from '@the-node-forge/url-shortener/stores/redisStore';
import { URLShortener } from '@the-node-forge/url-shortener';
const client = createClient();
await client.connect();
const store = new RedisStore(client);
const shortener = new URLShortener('https://sho.rt', store);
const shortUrl = await shortener.shorten('https://example.com/very/long/url', {
alias: 'launch',
expiresIn: '7d',
});
console.log(shortUrl); // https://sho.rt/launch
const result = await shortener.resolve('launch');
console.log(result); // https://example.com/very/long/url
new URLShortener(baseDomain, store)
Parameter | Type | Required | Description |
---|---|---|---|
baseDomain | string | ❌ | Domain to prefix for short URLs |
store | StoreAdapter | ✅ | Instance of RedisStore |
shorten(longUrl, options?)
Option | Type | Required | Description |
---|---|---|---|
longUrl | string | ✅ | The URL to shorten |
alias | string | ❌ | Custom code (e.g., "my-link") |
expiresIn | string | ❌ | TTL like "1h", "30m", "7d" |
override | boolean | ❌ | Replace alias if it already exists |
resolve(alias)
Returns the original URL string, or null
if expired or missing.
This package works in modern server-side runtimes:
Store | Runtime | Notes |
---|---|---|
RedisStore | ✅ Node-only | Requires Redis and redis package |
This is a backend utility. Frontend usage is not supported directly — build an API endpoint instead.
Contributions welcome! Open an issue or PR if you have improvements, ideas, or bug fixes.
If you like this project, consider leaving a ⭐ on GitHub!
FAQs
A URL shortener that generates and stores unique aliases for long URLs, with optional expiration and custom alias support.
The npm package @the-node-forge/url-shortener receives a total of 8 weekly downloads. As such, @the-node-forge/url-shortener popularity was classified as not popular.
We found that @the-node-forge/url-shortener demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.