Next.jsReactStarter

template-nextjs-memberstack — Next.js Starter Template

By raqlo

A Next.js-based Memberstack integration starter template that demonstrates two authentication integration approaches: client-side AuthProvider and server-side Server Actions, and provides a middleware implementation for protected routes.

Explore the design

Compare the page layouts and mobile experience. Open any screenshot for a closer look.

2 previews
Desktop homepage1 / 2
Desktop captureTop of page

Actual screenshot captured by the server browser.

All pages & views 2

Screenshots show visual appearance; interactive behavior may differ.

Recorded 2026-10-14View source

What stands out

A quick read of the recorded project description.

01

Demonstrates integration using Memberstack's client-side AuthProvider and React hooks

02

Demonstrates using Next.js server actions to handle authentication flows such as sign-up

03

Includes example implementations of login, sign-up, profile, and the profile update form

04

Uses server-side middleware to protect routes, and explains that it can be switched to a client-side Protected Route Provider

05

The README states that the code is modified from the deprecated original Memberstack NextJS library to be compatible with Next.js v15 server actions

Template Details

This template is used to integrate Memberstack into a Next.js application, providing a starting point for authentication, user management, and membership features. The README states that it demonstrates two integration approaches: first, wrapping the main layout or root component with Memberstack's AuthProvider to manage authentication state on the client and access user data through React hooks; second, using Next.js server actions to handle authentication flows, route protection, and server-side APIs. In the template, login and profile (including the profile update form) use the client-side approach, while sign-up uses the server actions approach. Route protection uses server-side middleware, and the README also mentions that it can be switched to a client-side Protected Route Provider. The README does not provide a dependency list, specific framework version numbers, testing and deployment processes, nor does it state performance or security guarantees in a production environment.

Next.jsReactStarter

Is it right for your project?

Use Cases

  • Quickly integrate Memberstack authentication and membership features into a Next.js project
  • Compare two authentication implementation approaches: client-side AuthProvider and server-side server actions
  • Configure route protection for pages that require login before access

Suitable For

  • Developers using Next.js and planning to integrate Memberstack
  • Developers who want to reference both client-side and server-side authentication integration approaches
  • Projects that need a starting point for login, sign-up, and user profile pages

Getting started & customization

Use these recorded setup notes alongside the repository instructions for your chosen version.

  1. 1

    Create an application in the Memberstack Dashboard, obtain the Public Key from Dev Tools, and write it to NEXT_PUBLIC_MEMBERSTACK_PUBLIC_KEY in .env

  2. 2

    The Public Key for test mode starts with pb_sb_, and for production mode starts with pb_; use the corresponding key according to the current mode

  3. 3

    Start the development server with npm run dev, yarn dev, pnpm dev, or bun dev, and visit http://localhost:3000

  4. 4

    If IDE debugging is needed, configure the debugger to listen on port 9230

  5. 5

    The README does not provide build, test, and deployment steps

Read repository instructions

License & source material

Usage conditions & limitations

Free to use · keep license notice

This entry covers the free version under the MIT license in a public repository; the free scope is the code of that version and does not mean that external services or third-party assets are free.

Must comply with when using

  • Free use, modification, commercial use, and distribution of this version's code are permitted.
  • When distributing copies or substantial portions of the code, retain the original author's copyright notice and the complete MIT license notice.
  • The code is provided as is; warranties and limitations of liability are governed by the original license and applicable law.

Additional costs & items to verify

  • Demo images, fonts, icons, and other third-party assets need to be checked against their respective licenses and cannot be judged solely by the code's MIT license.
  • External services such as domains, hosting, databases, payments, or AI may incur additional charges.
  • Before use, you need to create an application in the Memberstack Dashboard and obtain that application's Public Key to run it.
  • The Memberstack Public Key must be written to NEXT_PUBLIC_MEMBERSTACK_PUBLIC_KEY in .env for normal use.
  • In test mode, the Public Key starts with pb_sb_, and in production mode it starts with pb_; use the corresponding key according to the current mode.
  • You must select the matching Public Key based on the application's current mode (test or production).
View Original Text Basis

Permission is hereby granted, free of charge

Original License Text

If you haven't already, navigate to the [Memberstack Dashboard](https://app.memberstack.com) and create a new app. You can name it whatever you like—for this example, we'll use `nextjs-memberstack`.

Original README

Go to the **Dev Tools** tab of your newly created app. Locate your **Public Key** and copy it. Then, add the key to your `.env` file in your project:

Original README

- When in **Test Mode**, the public key will be prefixed with `pb_sb_`.

Original README

Ensure you are using the appropriate key based on your app's current mode.

Original README
https://github.com/raqlo/template-nextjs-memberstack/blob/main/LICENSEhttps://github.com/raqlo/template-nextjs-memberstack/blob/main/README.md

Compiled by DeepSeek based on repository license and README ·2026-10-14. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.

Project checks & description sources

Template Information

Source platforms
GitHub
Documentation and maintenance reference score
More documented · 82 / 100
Technologies
Next.js · React
Website type
Starter
How this score is calculated

Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.

What to verify for this project

Repository update recorded
2025-03-19
Screenshot last checked
2026-10-14

A demo link is listed. Check it with your own content and viewport sizes; its presence does not confirm that forms, authentication or payments work.

The catalog identifies Next.js as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.

Use a selection guide →

How this description was prepared

AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.

Review declaration: codex-user-requested-batch-review-20261015 · 2026-10-15

Inspect the recorded source material

SHA-256: 59fb46d8b982e47cf0f17deae18fba94ca7a31176b50f9bde12db6362a2bfb47

2026-10-14T05:52:06.336Z

Source file / repository
# Next.js Memberstack Starter Template
This project provides a simple and effective starting point for integrating **Memberstack** into your **Next.js** application.
With this template, you can quickly set up a secure and scalable app, leveraging Memberstack’s features for authentication, user management, and membership functionality.

- **Demo**: [template-nextjs-memberstack.vercel.app](https://template-nextjs-memberstack.vercel.app/)

## Getting Started

### Creating Up Your Memberstack App
1. **Create a New App** <br />
   If you haven't already, navigate to the [Memberstack Dashboard](https://app.memberstack.com) and create a new app. You can name it whatever you like—for this example, we'll use `nextjs-memberstack`.

2. **Retrieve Your Public Key** <br />
   Go to the **Dev Tools** tab of your newly created app. Locate your **Public Key** and copy it. Then, add the key to your `.env` file in your project:
    ```dotenv
       NEXT_PUBLIC_MEMBERSTACK_PUBLIC_KEY=pb_...
    ```
3. **Test and Production Keys**
    - When in **Test Mode**, the public key will be prefixed with `pb_sb_`.
    - When in **Production Mode**, it will be prefixed with `pb_`.

Ensure you are using the appropriate key based on your app's current mode.

### Run development server

To start the development server, use one of the following commands depending on your on your package manager:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
Once the server is running, open your browser and navigate to [http://localhost:3000](http://localhost:3000) to see your app in action.

#### Using the debugger
If you want to be able to take advantage of the debugging capabilities of your IDE, you can setup your debugger to listen to port 9230 while the next process is running

## Adding Memberstack to Your NextJs Project
Adding Memberstack to Your Next.js Project
You can integrate Memberstack into your Next.js project in different ways, depending on your needs. This template demonstrates two common approaches, but you can choose the one that best fits your optimization goals or how you prefer to use Next.js.

**1. Client-Side Approach with the AuthProvider Component**   <br />For a simple, client-side authentication setup, wrap your main layout or root component with Memberstack’s AuthProvider. This approach allows you to manage authentication entirely on the client side, making it easy to access user data and authentication states throughout your app. You can also use Memberstack’s React hooks to interact with authentication features within your client components.

📌 Example in this template: The `login` and `profile` features, including the profile update form, follow this approach.

**2. Server-Side Approach with Server Actions**   <br />For enhanced security and customization, you can integrate Memberstack using Next.js server actions. This approach is useful for securely managing authentication flows, enforcing route protection, and creating custom server-side APIs that interact with Memberstack.

📌 Example in this template: The `sign-up` feature uses server actions for authentication.

Additionally, this template uses server-side middleware to protect routes, ensuring only authenticated users can access certain pages. However, you can also implement protected routes on the client side using a Protected Route Provider that restricts access based on authentication state.

This template is designed to give you a starting point, so you can see how both approaches work and decide which one best suits your project.

## Credits and Acknowledgments

This library incorporates modified pieces of code from the original Memberstack NextJS library. With the release of newer versions of NextJS, the original library was deprecated. I updated and adjusted the code to ensure compatibility with NextJS v15, enabling the use of server actions.

Special thanks to [Tailspark](https://tailspark.co/) for providing quick and easy components that make faster build times possible. The code is licensed under the MIT license.
Report a correction

Explore similar templates

Compare previews and descriptions within the same stack and category.