SoftKit API Reference
website·Indexed 32 days ago
https://docs.softkit.devAPI documentation for SoftKit, featuring modules for i18n (internationalization) and validation. Includes detailed references for functions like mergeDeep and i18nValidationMessage, type aliases such as TranslateOptions and I18nValidationError, and validation definitions including IsUUIDValidatorDefinition and IsUrlValidatorDefinition.
What's inside SoftKit
- The Backend Client Generator creates a client library designed for other backend services that need to make synchronous HTTP calls to a specific microservice. It is specifically optimized for NestJS applications, providing automatic NestJS module generation, error proxying from the microservice to the client, and integration with ClsService for automatic propagation of user tokens and request IDs for tracing.
Overview of Softkit features and capabilities
Softkit is a developer toolkit designed to automate routing tasks and reduce technical debt. Key capabilities include:
- Development Tools: Softkit CLI for code generation, automatic Swagger OpenAPI documentation, and automatic API client generation.
- Core Services: Multi-tenancy support with logical segregation, typed configuration management, health monitoring, and standardized error handling following RFC7807.
- Security: Authentication and Authorization, including per-tenant configuration for SAML and OpenID Connect.
- Observability: Out-of-the-box support for New Relic, Grafana, Sentry, and Datadog.
- Infrastructure & Deployment: CI/CD automation, Docker images, Kubernetes manifests, Terraform manifests, and GitOps practices.
- Database Support:
- SQL: PostgreSQL (preferred), MySQL, MariaDB, SQLite, Microsoft SQL Server, Oracle, SAP HANA, and SQL.js.
- NoSQL: MongoDB.
Overview of @softkit/eslint-backend default plugins and rules
The
@softkit/eslint-backendconfiguration provides a comprehensive set of rules for JavaScript and TypeScript projects focused on security, performance, and best practices.Default Plugins Included:
@nx@typescript-eslint/eslint-pluginsimple-import-sortsecuritysonarjsjestunicornpromiseunused-imports
Key Rule Behaviors:
- Flags unused imports and variables as errors or warnings.
- Enforces Nx workspace module boundaries.
- Includes customized rules for Jest test files and specific overrides for TS/JS file patterns.
Overview of available Softkit Libraries
Softkit provides a suite of purpose-built libraries to streamline software development. Available libraries include:
- Async Storage: Asynchronous data storage solutions.
- Auth: Authentication and authorization mechanisms.
- Bootstrap: Application setup tools.
- Clients: HTTP Client for platform applications.
- Common Types: Shared type definitions across services.
- Config: Configuration management.
- Crypto: Cryptographic functions for secure data.
- ESLint Backend: Backend linting rules.
- Exceptions: Standardized exception handling (RFC7807).
- File Storage: File management and storage.
- Health Check: Operational health monitoring for AWS services.
- I18n: Internationalization support.
- Logger: Monitoring and debugging utilities.
- Mail: Email integration and management.
- Redis: Caching and data retrieval utilities.
- Resource Plugin: Generators for CRUD resource development.
- Server HTTP Client: HTTP client for server-side requests.
- String Utils: String manipulation functions.
- Swagger Utils: OpenAPI and Swagger tools.
- Test Utils: Code quality and testing utilities.
- TypeORM: TypeORM integrations and utilities.
- TypeORM Service: Service layer abstraction.
- Validation: Data validation and error checking.
Overview of @softkit/i18n for NestJS
@softkit/i18n is a highly configurable internationalization library for NestJS projects. It allows developers to implement multi-language support with the ability to plug in custom language resolvers, loaders, and formatters. Key capabilities include type-safe translations, variable formatting, nested translations, fallback language support, live reloading, and support for plurals.Overview of Softkit libraries for NestJS and NodeJS
Softkit is a toolkit providing a set of libraries intended to be used as a framework for software development on NestJS and NodeJS. It includes specialized modules for authentication, configuration, database management via TypeORM, and various utility services.Overview of Softkit Crypto Library features
The
@softkit/cryptolibrary provides the following core capabilities:Cryptography
- Password Hashing: Secure hashing using
argon2. - Password Verification: Utilities to verify plain-text passwords against hashed values.
Pseudo Random Data Generation
- NanoID: Generation of unique identifiers via
nanoid. - Custom Alphabet: Support for generating IDs using a custom set of characters.
- Number Generation: Generation of random numbers for various applications.
- Password Hashing: Secure hashing using
Overview of @softkit/test-utils features
The @softkit/test-utils library provides several utilities for modern testing environments:
- Database Management:
startPostgresconfigures a PostgreSQL container for realistic testing scenarios. - Redis Server Setup:
startRedisinitializes a Redis container for fast, in-memory data storage. - Local AWS Simulation:
startLocalstackreplicates AWS services locally to avoid cloud costs during testing. - Enhanced Assertions: Provides additional Jest assertions, such as
expectNotNullAndGet, to improve test expressiveness.
- Database Management:
Overview of the EntityHelper class
TheEntityHelperis an abstract class that extendsBaseEntityand implements theBaseEntityinterface. It serves as a helper for managing entities within TypeORM, providing both instance-level methods for manipulating specific entity records and static methods for collection-level operations.Introduction to the Softkit framework
Softkit is an opinionated less-code framework built on NestJS. It is designed to expedite the development of robust software solutions by enforcing industry best practices and standards, effectively acting as a pre-implemented core architecture to reduce time-to-market and technical debt.Overview of BaseEntityService
BaseEntityService is a core class within the@softkit/service-apilibrary that extendsAbstractBaseService. It provides a standardized way to handle entity operations including creation, updating, archiving, and deletion. Key capabilities include built-in transactional support for data consistency, advanced query handling (pagination, sorting, transformation), and integrated error handling via@softkit/exceptions.Generate a backend client library for microservice communication
The Backend Client Generator allows you to create a client library that enables other backend services to make synchronous HTTP calls to your microservice. This tool is used to simplify the integration process and ensure seamless communication between different services in a microservice architecture.