LaunchFast Logo LaunchFast

Introducing Partial Paid and Protected Pages comes with baked-in partial paid and protected page(s) to help you prevent un-paid and un-authenticated users access specific content on such pages. With the payment methods such as Stripe and Lemon Squeezy integrated in and authentication methods such as Google, Twitter and Credentials, such payment callbacks’ and user authentication methods can be used by your system to grant access only to a specific content on such pages for the paid and authenticated users only.

Here’s how easily you can create partial paid and protected pages with

  • Create a file, say partial_paid_and_protected.astro with the following code:
// File: src/pages/partial_paid_and_protected.astro

import redis from '@/lib/db/upstash'
import { getSession } from '@/lib/utils/auth'

const session: any = getSession(Astro.cookies)

let paid: number

if (session?.email) paid = await redis.hget('access',

<html lang="en">
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
  <body class="font-display">
    <!-- Show the Header if the user is logged in AND paid -->
    {paid && <Header />}
    <!-- Show the Divider if the user is logged in -->
    {session['email'] && <Divider className="mt-3 border-gray-100/50" />}
  • That’s it! The Upstash Redis instance integrated in the boilerplate takes care of fetching the user paid status and the getSession function takes care of decoding the user authentication status. Using Astro JSX, specific components or HTML is conditionally rendered (from the server) to the user.

Worry not, with you get such a page partial_paid_and_protected.astro built for you with goodies on top.

Learn More Using Firebase Realtime Database in Astro with Vue: A Step-by-Step Guide → Authenticating users in Astro with Clerk and React: A Step-by-Step Guide → Deploy Astro to AWS Elasic Beanstalk: A Step-by-Step Guide →