
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@flowglad/nextjs
Advanced tools
A Next.js integration package for Flowglad, providing utilities for both client and server-side functionality.
A Next.js integration package for Flowglad, providing utilities for both client and server-side functionality.
npm install @flowglad/nextjs
# or
yarn add @flowglad/nextjs
# or
bun add @flowglad/nextjs
Import client-side components and utilities directly from the package:
import { Component } from '@flowglad/nextjs';
For server-side code, use the dedicated server import path:
import { serverFunction } from '@flowglad/nextjs/server';
This separation ensures proper code splitting and prevents server-only code from being included in client bundles.
The package provides a React context for managing billing and subscription state. Here's how to use it:
// In your app's root layout or page
import { FlowgladProvider } from '@flowglad/nextjs';
export default function RootLayout({ children }) {
return (
<FlowgladProvider
baseURL="https://your-app.com" // Base URL of your app (optional, defaults to relative /api/flowglad)
loadBilling={true} // Set to true to load billing data
>
{children}
</FlowgladProvider>
);
}
// In your components
import { useBilling } from '@flowglad/nextjs';
function BillingComponent() {
const {
customer,
subscriptions,
paymentMethods,
createCheckoutSession,
cancelSubscription,
loaded,
errors
} = useBilling();
if (!loaded) {
return <div>Loading...</div>;
}
if (errors) {
return <div>Error: {errors[0].message}</div>;
}
return (
<div>
<h2>Current Subscriptions</h2>
{subscriptions?.map(sub => (
<div key={sub.id}>
{sub.name} - {sub.status}
<button onClick={() => cancelSubscription({ subscriptionId: sub.id })}>
Cancel
</button>
</div>
))}
<button onClick={() => createCheckoutSession({
successUrl: 'https://your-app.com/success',
cancelUrl: 'https://your-app.com/cancel',
priceId: 'price_123'
})}>
Subscribe
</button>
</div>
);
}
import { nextRouteHandler } from '@flowglad/nextjs/server';
import { flowglad } from '@/lib/flowglad';
import { verifyToken } from '@/lib/auth';
// Create the route handler with customer ID extraction
export const { GET, POST } = nextRouteHandler({
getCustomerExternalId: async (req) => {
const token = req.headers.get('authorization')?.split(' ')[1];
if (!token) throw new Error('Unauthorized');
const decoded = await verifyToken(token);
return decoded.userId;
},
flowglad,
});
import { pagesRouteHandler } from '@flowglad/nextjs/server';
import { flowglad } from '@/lib/flowglad';
import { verifyToken } from '@/lib/auth';
// Create the route handler with customer ID extraction
export default pagesRouteHandler({
getCustomerExternalId: async (req) => {
const token = req.headers.authorization?.split(' ')[1];
if (!token) throw new Error('Unauthorized');
const decoded = await verifyToken(token);
return decoded.userId;
},
flowglad,
});
The route handlers will automatically:
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A Next.js integration package for Flowglad, providing utilities for both client and server-side functionality.
The npm package @flowglad/nextjs receives a total of 1,079 weekly downloads. As such, @flowglad/nextjs popularity was classified as popular.
We found that @flowglad/nextjs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.