Back

Company


Feb 10, 2023

Back

Company


Feb 10, 2023

Changelog Feb 10, 2023

James Perkins

James Perkins


Introducing @clerk/fastify , Redwood v4 support, Next.js Middleware page protection and improvements to components.


The team has been making improvements to the Clerk product and introducing new packages, here is a round up from the last two weeks.

Introducing @clerk/fastify

We had a a number of requests recently for a dedicated package for Fastify and as of today you can now use Clerk with Fastify using our latest package.

To learn how it works check out our new getting started guide in our docs or our fastify starter repository.

Redwood v4 support

Our Clerk integration for Redwood has been upgraded to be able to support Redwood V4. With that you can check out the latest integration guide in the Redwood documentation.

Next.js middleware protection strategy

We introduced middleware as a way to protect pages during the month of November, after a few tweaks and improvements. We are happy to announce this is now the recommended way to protect your pages. Below is an example of using Clerk + Middleware together.

middleware.ts
1
import { withClerkMiddleware, getAuth } from '@clerk/nextjs/server'
2
import { NextResponse } from 'next/server'
3
import type { NextRequest } from 'next/server'
4
5
// Set the paths that don't require the user to be signed in
6
const publicPaths = ['/', '/sign-in*', '/sign-up*']
7
8
const isPublic = (path: string) => {
9
return publicPaths.find(x =>
10
path.match(new RegExp(`^${x}$`.replace('*$', '($|/)')))
11
)
12
}
13
14
export default withClerkMiddleware((request: NextRequest) => {
15
if (isPublic(request.nextUrl.pathname)) {
16
return NextResponse.next()
17
}
18
// if the user is not signed in redirect them to the sign in page.
19
const { userId } = getAuth(request)
20
21
if (!userId) {
22
// redirect the users to /pages/sign-in/[[...index]].ts
23
24
const signInUrl = new URL('/sign-in', request.url)
25
signInUrl.searchParams.set('redirect_url', request.url)
26
return NextResponse.redirect(signInUrl)
27
}
28
return NextResponse.next()
29
})
30
31
export const config = { matcher: '/((?!.*\\.).*)' }

The Control Components strategy can continued to be used and we have no plans to remove this strategy.

Clerk Component improvements

We made some improvements to the Clerk components now if a user opens any Clerk component in a modal on a mobile phone they will present with a cross in the top right corner to close them.

Changes to User Impersonation

User impersonation is now only accessible in the Clerk dashboard if the user has the role of admin or is in their own personal space.

How to stay up to date with Clerk?

The best way to keep up with Clerk is to subscribe to our newsletter. We send out updates every week. Updates include new features, what we have been working on, and blog posts you may have missed!

Clerk Community Discord

Clerk has a community Discord. When you join, you will find a place:

  • Find the latest Clerk news and announcements
  • Share your project with the Clerk community, and talk about your experience
  • Request features and gets help integrating Clerk from the team and community.

Clerk Twitter

Our Twitter account (@clerkdev) announces the latest features and improvements. We would also be psyched if you tagged us in projects you have built.

Clerk's logo

Start Now,
No Strings Attached

Start completely free for up to 5,000 monthly active users and up to 10 monthly active orgs. No credit card required.

Start building

Pricing built for

businesses of all sizes.

Learn more about our transparent per-user costs to estimate how much your company could save by implementing Clerk.

View pricing
Clerk's logo

Newsletter!

The latest news and updates from Clerk, sent to your inbox.

Clerk logo

Clerk - Complete User Management

TwitterLinkedInGitHubDiscordFacebook

© 2023 Clerk Inc.


product
Features

© 2023 Clerk Inc.