@korioinc/next-conf
v2.0.12
Published
Configuration management for Next.js applications
Downloads
1,230
Readme
@korioinc/next-conf
Configuration management system for Next.js applications.
Installation
pnpm add @korioinc/next-confFeatures
- Centralized Configuration: Manage all app configurations in one place
- Type-safe: Full TypeScript support with autocompletion
- Environment-aware: Different configs for development/production
- Plugin System: Extensible plugin architecture
- Next.js Optimized: Built specifically for Next.js applications
Usage
Basic Setup
Create a next-kit.config.ts file in your project root:
import { defineConfig } from '@korioinc/next-conf';
export default defineConfig({
app: {
name: 'My App',
description: 'My awesome Next.js app',
},
api: {
baseUrl: process.env.NEXT_PUBLIC_API_URL || 'https://api.example.com',
timeout: 30000,
},
cookie: {
accessTokenName: '_at',
refreshTokenName: '_rt',
},
auth: {
redirectPath: '/dashboard',
loginPath: '/login',
},
});Using Configuration
import { getConfig } from '@korioinc/next-conf';
// In your components or API routes
const config = getConfig();
console.log(config.app.name); // "My App"Plugin System
import { defineConfig } from '@korioinc/next-conf';
import { myPlugin } from '@korioinc/next-conf/plugin';
export default defineConfig({
// Your config
}, {
plugins: [myPlugin()],
});Configuration Options
| Option | Type | Description |
|--------|------|-------------|
| app.name | string | Application name |
| app.description | string | Application description |
| api.baseUrl | string | API base URL |
| api.timeout | number | Request timeout in ms |
| cookie.accessTokenName | string | Access token cookie name |
| cookie.refreshTokenName | string | Refresh token cookie name |
| auth.redirectPath | string | Post-login redirect path |
| auth.loginPath | string | Login page path |
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
