Quick Start

Welcome to the Memberstack Admin Node.js Package! This guide will help you get started with the server-side capabilities of Memberstack, including member management, webhook verification, and token validation.

Before You Start

  • You need a Node.js environment to use this package
  • Access to your Memberstack secret key
  • For paid functionality, a Memberstack account with an active billing method is required

Installation & Setup

Follow these steps to install and set up the Admin package in your Node.js project.

Install the Memberstack Admin Package in your Node.js project:

- or -

After installation, you'll need to import the package in your code:

💡 Tip:

The Admin Package is designed for server-side use only. Never include your secret key in client-side code. If you need client-side authentication, use the DOM Package instead.

Basic Configuration

Essential configuration steps to get your Memberstack Admin integration working securely.

Initialize the Admin Package with your secret key:

⚠️ Important:

Your secret key provides administrative access to your Memberstack account. Always keep it secure and never expose it in client-side code, public repositories, or browser environments.

Secret Key Types

  • Test Mode Keys: Start with sk_sb_ and are used for development and testing
  • Live Mode Keys: Start with sk_ and are used for production environments

⚠️ Security Best Practices

  • Store your secret keys in environment variables, not in code
  • Use different keys for development and production environments
  • Never commit your secret keys to version control
  • Rotate your keys periodically for enhanced security

Framework Integration

Integrate Memberstack Admin with popular server-side frameworks.

Express.js Integration

Here's how to integrate Memberstack Admin with Express.js for authentication middleware:

Next.js API Routes

Here's how to use Memberstack Admin in Next.js API routes:

Serverless Functions

For serverless environments like AWS Lambda or Vercel Functions, keep these considerations in mind:

Serverless Best Practices

  • Initialize the Memberstack client outside the handler function to take advantage of container reuse
  • Implement proper error handling to ensure helpful response messages when authentication fails
  • Be mindful of cold start times if your function needs to process many requests
  • Consider caching verified tokens during the function's lifecycle for better performance

Next Steps

Now that you've set up the Admin Package, you might want to explore:

Need Help?

Having trouble getting your login working? We're here to help!

Thank you for choosing Memberstack 🙏