Configuring SSX for Serverless

SSX Serverless provides an optimized implementation for serverless


In order to enable ssx in your serverless app, install ssx-serverless with your preferred package manager by running any of the following commands:
npm install @spruceid/ssx-serverless
# or
yarn add @spruceid/ssx-serverless
# or
pnpm install @spruceid/ssx-serverless
@spruceid/ssx-server is not a dependency of @spruceid/ssx-serverless


ssx-serverless exports the main class SSXServer which is supposed to be used as a Singleton. On your serverless setup, you'll need to create an instance of SSXServer as seen below.
import {
} from '@spruceid/ssx-serverless';
const _create = async <T>(value: any, opts?: Record<string, any>): Promise<T> => {
return db.put(value) as T;
// ...
const ssx = new SSXServer({
providers: {
rpc: {
service: SSXRPCProviders.SSXInfuraProvider,
apiKey: process.env.INFURA_ID,
network: SSXInfuraProviderNetworks.MAINNET,
}, {
create: _create,
retrieve: _retrieve,
update: _update,
delete: _delete,
SSXServer requires two objects to be instantiated.
  • The first object is the main object to configure the providers and enable daoLogin.
  • The second object is the object with the session management functions.
new SSXServer({
providers?: {
rpc?: SSXProvider,
metrics?: {
service: 'ssx',
apiKey: string
daoLogin?: boolean
}, {
create: <T>(value: any, opts?: Record<string, any>) => Promise<T>,
retrieve: <T>(key: any, opts?: Record<string, any>) => Promise<T>,
update: <T>(key: any, value: any, opts?: Record<string, any>) => Promise<T>,
delete: <T>(key: any, opts?: Record<string, any>) => Promise<T>
Looking for an example to start? Check out the AWS + Node.js + Typescript + DynamoDB example