New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@hedhog/core

Package Overview
Dependencies
Maintainers
5
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hedhog/core

@hedhog/core is a core library for building dynamic and scalable applications. It provides a collection of utilities, decorators, DTOs, and helper functions to streamline development with TypeScript and NestJS. This library is designed to simplify tasks l

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
93
decreased by-78.67%
Maintainers
5
Weekly downloads
 
Created
Source

@hedhog/core

Hedhog Avatar

A lightweight and robust library for managing database entities and relationships in TypeScript. The Hedhog Core simplifies defining database columns, foreign keys, timestamps, and decorators while maintaining clean and maintainable code.


🌟 Features

  • TypeScript First: Built for TypeScript with robust type definitions.
  • NestJS Integration: Seamlessly integrates with NestJS for decorator and pipe support.
  • Database Schema Utilities: Simplify ORM tasks with utilities for common schema definitions like primary keys, foreign keys, and timestamps.
  • DTO Support: Predefined DTOs for consistent data validation.
  • Localization Helper: Easy-to-use functions for managing translations.
  • Modular Design: Import only what you need to keep your application lightweight.

🚀 Getting Started

Installation

Install the package via npm:

npm install @hedhog/core

Or using yarn:

yarn add @hedhog/core

📚 Usage

Example: Using Decorators

import { Public, Role, User } from '@hedhog/core';

@Controller('example')
export class ExampleController {
  @Public()
  @Get('public')
  getPublicData() {
    return { message: 'This route is public!' };
  }

  @Role()
  @Get('private')
  getPrivateData(@User() user: any) {
    return { message: `Hello ${user.name}, this route is private!` };
  }
}

Example: Database Column Utilities

import { idColumn, foreignColumn, timestampColumn } from '@hedhog/core';

const id = idColumn();
const foreignKey = foreignColumn({ name: 'userId' });
const timestamp = timestampColumn('createdAt');

console.log(id, foreignKey, timestamp);

📦 Package Details

  • Name: @hedhog/core
  • Version: 1.0.4
  • Author: Hcodebr
  • License: MIT
  • Repository: GitHub
  • Dependencies:
    • class-validator
    • @nestjs/common
    • typeorm

🛠 Development

Build

Run the following command to build the package:

npm run build

Publish

To publish the package to npm:

npm run prod

🐛 Issues

Have a bug or a feature request? Please check the issues page or open a new issue.


❤️ Contributing

Contributions are welcome! Please see the contributing guide for more details.


📄 License

This project is licensed under the MIT License. See the LICENSE file for details.


Keywords

FAQs

Package last updated on 27 Jan 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc