Skip to content

Short id generator. Url-friendly. Non-predictable. Cluster-compatible.

License

Notifications You must be signed in to change notification settings

MantarayAR/meteor-shortid

 
 

Repository files navigation

ShortId for Meteor

Amazingly short non-sequential url-friendly unique id generator.

ShortId creates amazingly short non-sequential url-friendly unique ids. Perfect for url shorteners, MongoDB and Reddis ids, and any other id users might see.

  • By default 7-14 url-friendly characters: A-Z, a-z, 0-9, _-
  • Non-sequential so they are not predictable.
  • Can generate any number of ids without duplicates, even millions per day.
  • Perfect for games, especially if you are concerned about cheating so you don't want an easily guessable id.
  • Apps can be restarted any number of times without any chance of repeating an id.
  • Popular replacement for Mongo ID/Mongoose ID.
  • Modified to work with Meteor.

Tests

You can run tests with:

meteor test-packages ./

Usage

On the Server or the Client:

console.log(ShortId.generate());
//PPBqWA9

The Client and Server will generate unique ids locally. Multiple servers may generate the same id, and multiple clients may generate the same id. This is because the seeds are not currently synchronized.

About the Original Author

Hi! Thanks for checking out this project! My name is Dylan Greene. When not overwhelmed with my two young kids I enjoy contributing to the open source community. I'm also a tech lead at Opower. @dylang @dylang

Here's some of my other Node projects:

Name Description npm Downloads
grunt‑notify Automatic desktop notifications for Grunt errors and warnings using Growl for OS X or Windows, Mountain Lion and Mavericks Notification Center, and Notify-Send. grunt-notify
npm‑check Check for outdated, incorrect, and unused dependencies. npm-check
grunt‑prompt Interactive prompt for your Grunt config using console checkboxes, text input with filtering, password fields. grunt-prompt
rss RSS feed generator. Add RSS feeds to any project. Supports enclosures and GeoRSS. rss
xml Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples. xml
changelog Command line tool (and Node module) that generates a changelog in color output, markdown, or json for modules in npmjs.org's registry as well as any public github.com repo. changelog
grunt‑attention Display attention-grabbing messages in the terminal grunt-attention
observatory Beautiful UI for showing tasks running on the command line. observatory
anthology Module information and stats for any @npmjs user anthology
grunt‑cat Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi. grunt-cat

This list was generated using anthology.

License

Copyright (c) 2015 Dylan Greene, contributors.

Released under the MIT license.

Screenshots are CC BY-SA (Attribution-ShareAlike).


Generated using grunt-readme with grunt-templates-dylang on Sunday, April 5, 2015. _To make changes to this document look in /templates/readme/

About

Short id generator. Url-friendly. Non-predictable. Cluster-compatible.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 96.8%
  • HTML 3.2%