saas-maker
v0.0.17-rc.2
Published
Collection of utilities for building SaaS applications
Readme
saas-maker
Collection of utilities for building SaaS applications.
Installation
npm install saas-maker
# or
yarn add saas-maker
# or
pnpm add saas-makerFeatures
- Error handling utilities
- Request validation helpers
- Response formatters
- TypeScript support
Usage
import { throwOnNull, throwIfFalsy, tryCatch } from 'saas-maker';
// Example usage
const processUser = (userId: string | null) => {
// Will throw if userId is null
throwOnNull(userId, 'User ID is required');
// Rest of your code
};
// Try-catch wrapper
const result = tryCatch(() => {
// Your code that might throw
return 'success';
});
// result will be { success: true, data: 'success' } or { success: false, error: Error }Notes
Error handling:
- Add global error handling in your server handler and client side. Check for error which is instance of
AppError(or usegetErrorInfo)
License
MIT
