@saaslib/nestjs
TypeScript icon, indicating that this package has built-in type declarations

0.0.15 • Public • Published

Nestjs SaaS Library

Installation

$ npm i @saaslib/nestjs @nestjs/jwt @nestjs/config @nestjs/mongoose
$ npx @saaslib/nestjs init

Configuration

The required config variables were appended to your .env file. You can change the values as needed.

Import

import { Module } from '@nestjs/common'
import { ConfigModule } from '@nestjs/config'
import { JwtModule, JwtModuleOptions } from '@nestjs/jwt'
import { MongooseModule } from '@nestjs/mongoose'
import { SaaslibModule } from '@saaslib/nestjs'
import { AppController } from './app.controller'
import { AppService } from './app.service'
import { AuthController } from './user/auth/auth.controller'
import { AuthService } from './user/auth/auth.service'
import { User, UserSchema } from './user/user.model'
import { UserService } from './user/user.service'
import { UserController } from './user/users.controller'

const jwtOptions: JwtModuleOptions = {
  global: true,
  secret: process.env.JWT_SECRET,
  signOptions: { expiresIn: '5 minutes' },
}

@Module({
  imports: [
    ConfigModule.forRoot(),
    MongooseModule.forRoot(process.env.MONGO_URI),
    MongooseModule.forFeature([{ name: User.name, schema: UserSchema }]),
    JwtModule.register(jwtOptions),
    SaaslibModule.forRoot({
      jwt: jwtOptions,
      email: {
        from: 'hi@example.com',
        templates: {},
      },
    }),
  ],
  controllers: [AppController, AuthController, UserController],
  providers: [AppService, AuthService, UserService],
})
export class AppModule {}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.1567latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.1567
0.0.1438
0.0.132
0.0.127
0.0.110
0.0.100
0.0.90
0.0.80
0.0.50
0.0.40
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i @saaslib/nestjs

Weekly Downloads

114

Version

0.0.15

License

MIT

Unpacked Size

418 kB

Total Files

241

Last publish

Collaborators

  • marianopardo