
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.
@dockethealth/supertokens-nestjs
Advanced tools

The library makes it easier to use SuperTokens in NestJS applications. It does that by exposing NestJS entities (modules, guards, decorators, etc.) which abstract some of the logic that a user would normally need to write by themselves. That being said, the library does not include any additional functionality besides what you can create with the SuperTokens Node SDK.
npm install supertokens-node supertokens-nestjs
SuperTokensModule inside your main application moduleimport { Module } from '@nestjs/common'
import { SuperTokensModule } from 'supertokens-nestjs'
@Module({
imports: [
SuperTokensModule.forRoot({
framework: 'express',
supertokens: {
connectionURI: '...',
},
appInfo: {
appName: '...',
apiDomain: '...',
websiteDomain: '...',
},
recipeList: [
/* ... */
],
}),
],
controllers: [
/* ... */
],
providers: [
/* ... */
],
})
export class AppModule {}
SuperTokensAuthGuard to protect your routesimport { Module } from '@nestjs/common'
import { APP_GUARD } from '@nestjs/core'
import { SuperTokensAuthGuard } from 'supertokens-nestjs'
@Module({
imports: [
/* ... */
],
controllers: [
/* ... */
],
providers: [
{
provide: APP_GUARD,
useClass: SuperTokensAuthGuard,
},
],
})
export class AppModule {}
import { Controller, UseGuards } from '@nestjs/common'
import { SuperTokensAuthGuard } from 'supertokens-nestjs'
@Controller()
@UseGuards(SuperTokensAuthGuard)
export class AppController {}
bootstrap functionimport supertokens from 'supertokens-node'
import { SuperTokensExceptionFilter } from 'supertokens-nestjs'
import { appInfo } from './config'
async function bootstrap() {
const app = await NestFactory.create(AppModule)
app.enableCors({
origin: [appInfo.websiteDomain],
allowedHeaders: ['content-type', ...supertokens.getAllCORSHeaders()],
credentials: true,
})
app.useGlobalFilters(new SuperTokensExceptionFilter())
await app.listen(3001)
}
import { Controller, Delete, Get, Patch, Post } from '@nestjs/common'
import { PublicAccess, Session, VerifySession } from 'supertokens-nestjs'
@Controller()
class AppController {
@Get('/user')
@VerifySession()
async getUserInfo(@Session('userId') userId: string) {}
@Get('/user/:userId')
@VerifySession({
roles: ['admin'],
})
async deleteUser() {}
@Get('/user/profile')
@PublicAccess()
async getUserProfile() {}
}
FAQs
SuperTokens integration for NestJS applications
We found that @dockethealth/supertokens-nestjs 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.