Skip to content

Quick Start

Get up and running with Spark-ID in under 5 minutes!

1. Install

bash
npm install @aexoo-ai/spark-id

2. Generate Your First ID

typescript
import { generateId, configure } from '@aexoo-ai/spark-id'

configure({ case: 'upper' })

const id = generateId()
console.log(id) // "YBNDRFG8EJKMCPQXOT1UWISZA345H769"

3. Add a Prefix

typescript
const userId = generateId('USER')
console.log(userId) // "USER_YBNDRFG8EJKMCPQXOT1UWISZA345H769"

4. Validate IDs

typescript
import { isValidId } from '@aexoo-ai/spark-id'

console.log(isValidId(userId)) // true
console.log(isValidId('invalid-id')) // false

5. Use in Your Project

typescript
// Database example
const user = {
  id: generateId('USER'),
  name: 'John Doe',
  email: 'john@example.com'
}

// API response example
const response = {
  id: generateId('TXN'),
  amount: 100.50,
  status: 'completed'
}

That's it! 🎉

You're now ready to use Spark-ID in your project. The IDs you generate are:

  • Cryptographically secure
  • URL-safe
  • Human-readable
  • Collision-resistant

Next Steps

Released under the MIT License.