Ensot

Node.js SDK

Official JavaScript SDK for building apps and integrating with Ensot services. Easy installation, comprehensive libraries, and powerful utilities.

Easy Setup

Get up and running in minutes with a simple installation and configuration process.

Rich APIs

Access all Ensot services including authentication, transactions, and user management.

TypeScript Support

Full typing and autocompletion for seamless integration with modern JS ecosystems.

Getting Started

Install via npm


npm install @ensot/node-sdk

                

Basic Initialization


const { Ensot } = require('@ensot/node-sdk');

const client = new Ensot({
  apiKey: 'YOUR_API_KEY',
  environment: 'production' // or 'sandbox'
});

                
🔐 Ensure you set the appropriate environment for your development stage.

Example Usage


// Create a user
client.users.create({
  email: 'test@example.com',
  password: 'securepassword123'
})
.then(response => console.log(response))
.catch(error => console.error(error));

// Retrieve user data
client.users.get('user-123')
.then(user => console.log(user))
.catch(error => console.error('Failed to fetch user:', error));

                
🛡️ Never expose secrets or access tokens in client-side code. Always use a backend layer for sensitive operations.

Integrate With Confidence

The SDK provides strongly typed interfaces for all Ensot services, including: Authentication, User Management, Transaction History, and more.

Authentication

Secure JWT token generation and management.

Transactions

Track and query financial activity and payment.

User Management

Seamless CRUD operations for user accounts and data.

Advanced Usage


const express = require('express');
const { Ensot } = require('@ensot/node-sdk');

const app = express();
const client = new Ensot({ apiKey: 'YOUR_KEY'});

app.get('/api/user/:id', async (req, res) => {
  try {
    const user = await client.users.get(req.params.id);
    res.json(user);
  } catch (error) {
    res.status(500).json({ error: 'Failed to fetch user' });
  }
});