Solidis LogoSolidis

Getting Started with Solidis

Learn how to integrate Solidis into your project and start building high-performance Redis applications.

Prerequisites
  • Node.jsVersion 14.0 or higher (Node.js 22 LTS recommended)
  • TypeScriptVersion 4.5 or higher (optional but recommended)
  • RedisAny RESP-compatible server
Installation
Install Solidis using your preferred package manager
npm install @vcms-io/solidis
Client Types
Choose the right client for your needs

1. Basic Client (SolidisClient)

The basic client contains minimal functionality to reduce bundle size. You need to extend it with specific commands:

1// Import the basic client and commands
2import { SolidisClient } from '@vcms-io/solidis';
3import { get } from '@vcms-io/solidis/command/get';
4import { set } from '@vcms-io/solidis/command/set';
5import { multi } from '@vcms-io/solidis/command/multi';
6import type { SolidisClientExtensions } from '@vcms-io/solidis';
7
8// Define extensions with type safety
9const extensions = {
10  get,
11  set,
12  multi
13} satisfies SolidisClientExtensions;
14
15// Initialize client with extensions
16const client = new SolidisClient({
17  host: '127.0.0.1',
18  port: 6379
19}).extend(extensions);

2. Featured Client (SolidisFeaturedClient)

A convenience client with all RESP commands pre-loaded:

1// Import the featured client
2import { SolidisFeaturedClient } from '@vcms-io/solidis/featured';
3
4// All RESP commands are pre-loaded
5const client = new SolidisFeaturedClient({
6  host: '127.0.0.1',
7  port: 6379
8}).extend(extensions);
Connection Management
Learn how to manage Redis connections
1// Create client (with lazy connect)
2const client = new SolidisClient({
3  uri: 'redis://127.0.0.1:6379',
4  lazyConnect: true
5}).extend({ get, set });
6
7// Explicitly connect when needed
8await client.connect();
9
10// Handle connection events
11client.on('connect', () => console.log('Connected to server'));
12client.on('ready', () => console.log('Client is ready for commands'));
13client.on('error', (err) => console.error('Error occurred: ', err));
14client.on('end', () => console.log('Connection closed'));
15
16// Close connection when done
17client.quit();
Basic Operations
Common Redis operations with Solidis
1// Set a key
2await client.set('key', 'value');
3
4// Get a key
5const value = await client.get('key');
6
7console.log(value); // 'value'
8
9// Delete a key
10await client.del('key');
Transactions
Working with Redis transactions
1// Start a transaction
2const transaction = client.multi();
3
4// Queue commands (no await needed)
5transaction.set('key', 'value');
6transaction.incr('counter');
7transaction.get('key');
Next Steps
Continue your journey with Solidis

📚 API Reference

Explore the complete API documentation with detailed examples.

View API Reference →

🎯 Tutorials

Learn by building real-world applications with step-by-step guides.

Start Learning →