npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hegoatek/core

v1.2.1

Published

HegoaTek Core - Reusable NestJS modules for authentication, email, storage, and more

Readme

@hegoatek/core

A collection of reusable, production-ready NestJS modules designed for the HegoaTek ecosystem. This library implements the "Factory Pattern" to dynamically provide implementations for authentication, storage, and email based on configuration.

Installation

npm install @hegoatek/core

You will also need to install the necessary peer dependencies depending on which modules you use (NestJS, Prisma, AWS SDK, etc.).

Modules Overview

This library is organized into several sub-modules that can be imported individually or together.

1. Authentication (AuthCoreModule)

Provides a complete authentication system with support for multiple providers.

Supported Providers:

  • custom: JWT + bcrypt (Local)
  • supabase: Supabase Auth Integration

Usage:

The module requires a Prisma module/service to be injected for user persistence.

import { Module } from '@nestjs/common';
import { AuthCoreModule } from '@hegoatek/core/auth';
import { PrismaModule } from './prisma/prisma.module';
import { PrismaService } from './prisma/prisma.service';

@Module({
  imports: [
    AuthCoreModule.forRoot({
      prismaModule: PrismaModule,
      prismaService: PrismaService,
      // Config is automatically loaded from environment variables
    }),
  ],
})
export class AppModule {}

Environment Variables:

AUTH_PROVIDER=custom # or 'supabase'
JWT_SECRET=super-secret
JWT_EXPIRATION_SECONDS=86400

Prisma Service Requirement:

Your PrismaService must implement the PrismaServiceInterface expected by the auth provider:

interface PrismaServiceInterface {
  user: {
    findUnique: (args: any) => Promise<User | null>;
    create: (args: any) => Promise<User>;
    // ... other methods
  };
}

2. Storage (StorageModule)

Abstracts file storage operations, allowing you to switch between local storage and cloud object storage without changing your application code.

Supported Providers:

  • local: Stores files in a local directory (great for dev)
  • cloudflare-r2: S3-compatible storage for Cloudflare R2 (or AWS S3)

Usage:

import { Module } from '@nestjs/common';
import { StorageModule } from '@hegoatek/core/storage';

@Module({
  imports: [
    StorageModule.forRootAsync(), // Configuration loaded from env
  ],
})
export class AppModule {}

Service Usage:

import { Injectable, Inject } from '@nestjs/common';
import { StorageService } from '@hegoatek/core/storage';

@Injectable()
export class AppService {
  constructor(private readonly storageService: StorageService) {}

  async uploadFile(file: Express.Multer.File) {
    const url = await this.storageService.upload(file.buffer, 'uploads/my-file.png');
    return url;
  }
}

Environment Variables:

STORAGE_PROVIDER=cloudflare-r2 # or 'local'

# If using Cloudflare R2 / S3
R2_ACCOUNT_ID=xxx
R2_ACCESS_KEY_ID=xxx
R2_SECRET_ACCESS_KEY=xxx
R2_BUCKET_NAME=xxx

3. Mail (MailModule)

Email sending wrapper, currently optimized for Resend.

Usage:

import { Module } from '@nestjs/common';
import { MailModule } from '@hegoatek/core/mail';

@Module({
  imports: [MailModule],
})
export class AppModule {}

Environment Variables:

RESEND_API_KEY=re_123456
[email protected]

4. Common Utilities (CommonModule)

Includes shared NestJS infrastructure components:

  • HttpExceptionFilter: Standardized error responses
  • TransformInterceptor: Standardized success responses wrapping
  • ApiResponse interfaces
import { Module } from '@nestjs/common';
import { APP_FILTER, APP_INTERCEPTOR } from '@nestjs/core';
import { HttpExceptionFilter, TransformInterceptor } from '@hegoatek/core/common';

@Module({
  providers: [
    { provide: APP_FILTER, useClass: HttpExceptionFilter },
    { provide: APP_INTERCEPTOR, useClass: TransformInterceptor },
  ],
})
export class AppModule {}

5. Configuration (HegoatekConfigModule)

An opinionated wrapper around @nestjs/config that loads and validates environment variables specific to the HegoaTek ecosystem.

Architecture & Patterns

Factory Pattern for Providers

Instead of hardcoding implementation details, this library uses a Factory Pattern. The AUTH_PROVIDER and STORAGE_PROVIDER symbols are used to inject the correct service implementation at runtime based on environment variables.

Provider Injection Tokens

If you need to inject the underlying provider directly (though usually, you should use the wrapper services):

import { AUTH_PROVIDER, STORAGE_PROVIDER } from '@hegoatek/core';

Peer Dependencies

Ensure you have the following installed in your host application:

  • @nestjs/common
  • @nestjs/core
  • @nestjs/config
  • @prisma/client (if using Auth)
  • @aws-sdk/client-s3 (if using R2/S3 Storage)
  • resend (if using Mail)

License

MIT