Skip to content

Configuration

Lucent is configured via a lucent.config.ts file in your project root.

Basic Configuration

typescript
import { defineConfig } from "@lucent/core";

export default defineConfig({
  // Database configuration
  database: {
    type: "postgres",
    connectionString: process.env.DATABASE_URL,
  },

  // Server configuration
  server: {
    port: 3000,
    hostname: "localhost",
  },

  // Authentication
  auth: {
    jwtSecret: process.env.JWT_SECRET,
    jwtExpiry: "7d",
  },
});

Database Options

PostgreSQL

typescript
database: {
  type: 'postgres',
  connectionString: process.env.DATABASE_URL,
  // Optional settings
  maxConnections: 10,
  ssl: true
}

SurrealDB

typescript
database: {
  type: 'surrealdb',
  connectionString: 'ws://localhost:8000',
  namespace: 'lucent',
  database: 'lucent',
  username: 'root',
  password: 'root'
}

Server Options

typescript
server: {
  port: 3000,
  hostname: '0.0.0.0',
  // Enable CORS
  cors: {
    origin: ['https://your-domain.com'],
    credentials: true
  }
}

Authentication Options

typescript
auth: {
  jwtSecret: process.env.JWT_SECRET,
  jwtExpiry: '7d',
  // Password requirements
  password: {
    minLength: 8,
    requireUppercase: true,
    requireNumbers: true,
    requireSymbols: true
  }
}

Email Configuration

typescript
email: {
  provider: 'smtp',
  from: 'noreply@your-domain.com',
  smtp: {
    host: 'smtp.example.com',
    port: 587,
    secure: false,
    auth: {
      user: process.env.SMTP_USER,
      pass: process.env.SMTP_PASS
    }
  }
}

Storage Configuration

typescript
storage: {
  default: 'local',
  disks: {
    local: {
      type: 'local',
      basePath: './storage'
    },
    s3: {
      type: 's3',
      bucket: process.env.S3_BUCKET,
      region: process.env.S3_REGION,
      accessKeyId: process.env.S3_ACCESS_KEY,
      secretAccessKey: process.env.S3_SECRET_KEY
    }
  }
}

Logging

typescript
logger: {
  level: 'info',
  // Enable pretty printing in development
  pretty: process.env.NODE_ENV !== 'production'
}

Released under the MIT License.