Block a user
@mintel/next-utils (1.9.11)
Installation
@mintel:registry=npm install @mintel/next-utils@1.9.11"@mintel/next-utils": "1.9.11"About this package
@mintel/next-utils
A collection of reusable utilities and helpers for Mintel Next.js projects, focusing on internationalization, environment safety, and security.
✨ Features
🌍 Internationalization (i18n)
Standardized helpers for next-intl:
createMintelMiddleware: A logging-enabled middleware wrapper.createMintelI18nRequestConfig: Centralized request configuration for server-side translations.
🔐 Environment Validation
Zod-based validation to ensure your app never boots with missing secrets:
validateMintelEnv: Validates standard Mintel variables (Mail, Sentry, Umami).
🛡 Rate Limiting
rateLimit: A simple in-memory rate limiter for protecting server actions and form submissions.
🚀 Usage
i18n Middleware (src/middleware.ts)
import { createMintelMiddleware } from "@mintel/next-utils";
export default createMintelMiddleware({
locales: ["en", "de"],
defaultLocale: "en",
logRequests: true,
});
Env Validation (scripts/validate-env.ts)
import { validateMintelEnv } from "@mintel/next-utils";
validateMintelEnv();
Rate Limiting
import { rateLimit } from "@mintel/next-utils";
export async function myAction(data: any) {
await rateLimit(data.email);
// ... logic
}
Dependencies
Dependencies
| ID | Version |
|---|---|
| next | 16.1.6 |
| next-intl | ^4.8.2 |
| zod | ^3.0.0 |
Development Dependencies
| ID | Version |
|---|---|
| @mintel/eslint-config | 1.9.11 |
| @mintel/tsconfig | 1.9.11 |
| eslint | ^9.39.2 |
| tsup | ^8.0.0 |
| typescript | ^5.0.0 |
Details
Assets (1)
Versions (11)
View all
next-utils-1.9.11.tgz
4.7 KiB