Configuration
Complete reference for miniwork.config.ts.
Full Configuration
miniwork.config.ts
import { defineConfig } from '@miniwork/core';
export default defineConfig({
// Server
port: 3771,
host: 'localhost',
// Database
database: './data.db',
// Authentication
auth: {
enabled: true,
sessionDuration: 86400, // 24 hours
cookieName: 'session_id',
cookieOptions: {
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
sameSite: 'Lax',
maxAge: 86400,
},
},
// Server-Sent Events
sse: {
enabled: true,
heartbeat: 30000,
reconnect: 3000,
},
// Security
security: {
rateLimit: {
windowMs: 60000,
maxRequests: 100,
},
headers: {
contentSecurityPolicy: { ... },
hsts: { maxAge: 31536000 },
},
},
// Build
build: {
outDir: './dist',
minify: true,
},
});
Environment Variables
PORT=8080
DATABASE_URL=./production.db
SESSION_SECRET=your-secret-key
NODE_ENV=production
Config Options Reference
| Property | Type | Description |
|---|---|---|
port |
number |
Server port (default: 3771) |
host |
string |
Server host (default: localhost) |
database |
string |
SQLite database file path |
auth.enabled |
boolean |
Enable authentication |
auth.sessionDuration |
number |
Session duration in seconds |
sse.enabled |
boolean |
Enable Server-Sent Events |
sse.heartbeat |
number |
Heartbeat interval in ms |
security.rateLimit |
object |
Rate limiting configuration |