Gate any path behind login or specific customer groups. The check runs on the server at render time, so gated content never reaches the browser. Needs: the Storesynk AI app on the Pro plan, a server-rendered storefront (Astro, Next.js, or React SSR), and customer accounts.
In the app
Section titled “In the app”- Open Page Gates and click Create.
- Give the gate a title and list the paths it protects. Each path matches as Starts with or Exact. Prefix matching is segment-aware:
/memberscovers/members/anythingbut not/membership. - Choose who can access: anyone logged in, or specific customer groups.
- Choose what happens when access is denied: send to login, redirect to a page, or hide the page (404).
- Mark it Active. Drafts are kept but not enforced.
Gates are evaluated in list order and the first match wins; the editor warns when an earlier gate shadows this one. Limits: 50 gates, 20 paths each.
On your storefront
Section titled “On your storefront”There are no tags. Each framework package exposes one helper that reads the gates, checks the request’s customer session, and applies the decision. Statically prerendered pages cannot be gated; the gated routes must render on the server.
Astro: add the middleware.
import { createGatesMiddleware } from '@storesynk/astro';
export const onRequest = createGatesMiddleware();Next.js: call it at the top of the gated layout or page.
import { requireGate } from '@storesynk/next';
const MembersLayout = async ({ children }: { children: React.ReactNode }) => { await requireGate('/members'); return children;};
export default MembersLayout;React SSR: it returns the decision for you to map to your router’s redirect or not-found.
import { checkGate } from '@storesynk/react/server';
const decision = await checkGate(url.pathname, { cookies: request.headers.get('cookie') });- The “send to login” outcome redirects to your site root with a
storesynk-loginparameter. The customer module on that page starts the hosted login and returns the shopper to the gated path, so the root page must render<storesynk-store customer-client-id="…">. - Gates are cached for 60 seconds by default (
ttlMs). A deleted gate stops applying as soon as the cache refreshes. - Anonymous visitors never pass, even on a groups gate.