or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

collections.mdconfiguration.mdindex.mdnavigation-utilities.mdnavigation.mdpreview.mdquerying.mdrendering.mdruntime-utilities.md

configuration.mddocs/

0

# Module Configuration

1

2

Comprehensive module configuration system with database settings, preview mode, build options, and experimental features for fine-tuning Nuxt Content behavior.

3

4

## Capabilities

5

6

### Module Options

7

8

Complete configuration interface for the Nuxt Content module.

9

10

```typescript { .api }

11

interface ModuleOptions {

12

/** Database configuration and adapter settings */

13

database: DatabaseConfig;

14

/** Local development database settings */

15

_localDatabase?: LocalDevelopmentDatabase;

16

/** Preview mode configuration */

17

preview?: PreviewOptions;

18

/** File watching and HMR configuration */

19

watch?: WatchOptions;

20

/** Content rendering configuration */

21

renderer?: RendererOptions;

22

/** Build-time processing options */

23

build?: BuildOptions;

24

/** Experimental feature flags */

25

experimental?: ExperimentalOptions;

26

}

27

```

28

29

**Usage Examples:**

30

31

```typescript

32

// nuxt.config.ts

33

export default defineNuxtConfig({

34

modules: ['@nuxt/content'],

35

36

content: {

37

database: {

38

type: 'sqlite',

39

sqlite: {

40

path: '.nuxt/content.db'

41

}

42

},

43

44

preview: {

45

enabled: true,

46

api: '/api/preview'

47

},

48

49

watch: {

50

enabled: true,

51

patterns: ['content/**/*']

52

},

53

54

renderer: {

55

components: {

56

'custom-alert': '~/components/Alert.vue'

57

}

58

},

59

60

build: {

61

preprocess: true,

62

generateTypes: true

63

},

64

65

experimental: {

66

advancedQuery: true,

67

serverComponents: false

68

}

69

}

70

});

71

```

72

73

### Database Configuration

74

75

Database adapter configuration supporting multiple database types.

76

77

```typescript { .api }

78

interface DatabaseConfig {

79

/** Database type/adapter */

80

type: 'sqlite' | 'd1' | 'postgresql' | 'libsql';

81

/** SQLite-specific configuration */

82

sqlite?: SqliteDatabaseConfig;

83

/** Cloudflare D1 configuration */

84

d1?: D1DatabaseConfig;

85

/** PostgreSQL configuration */

86

postgresql?: PostgreSQLDatabaseConfig;

87

/** LibSQL configuration */

88

libsql?: LibSQLDatabaseConfig;

89

}

90

91

interface SqliteDatabaseConfig {

92

/** Path to SQLite database file */

93

path: string;

94

/** Enable WAL mode for better concurrency */

95

walMode?: boolean;

96

/** Connection pool settings */

97

pool?: {

98

min?: number;

99

max?: number;

100

acquireTimeout?: number;

101

};

102

}

103

104

interface D1DatabaseConfig {

105

/** Cloudflare D1 database binding name */

106

binding: string;

107

/** D1 database ID */

108

databaseId: string;

109

/** Cloudflare account ID */

110

accountId?: string;

111

/** API token for D1 operations */

112

apiToken?: string;

113

}

114

115

interface PostgreSQLDatabaseConfig {

116

/** PostgreSQL connection string */

117

connectionString: string;

118

/** Connection pool settings */

119

pool?: {

120

min?: number;

121

max?: number;

122

acquireTimeout?: number;

123

idleTimeout?: number;

124

};

125

/** SSL configuration */

126

ssl?: {

127

require?: boolean;

128

ca?: string;

129

cert?: string;

130

key?: string;

131

};

132

}

133

134

interface LibSQLDatabaseConfig {

135

/** LibSQL database URL */

136

url: string;

137

/** Authentication token */

138

authToken?: string;

139

/** Sync URL for embedded replicas */

140

syncUrl?: string;

141

/** Sync interval in seconds */

142

syncInterval?: number;

143

}

144

```

145

146

**Usage Examples:**

147

148

```typescript

149

// SQLite configuration

150

const sqliteConfig = {

151

database: {

152

type: 'sqlite',

153

sqlite: {

154

path: './data/content.db',

155

walMode: true,

156

pool: {

157

min: 1,

158

max: 10,

159

acquireTimeout: 30000

160

}

161

}

162

}

163

};

164

165

// Cloudflare D1 configuration

166

const d1Config = {

167

database: {

168

type: 'd1',

169

d1: {

170

binding: 'CONTENT_DB',

171

databaseId: 'your-d1-database-id',

172

accountId: process.env.CLOUDFLARE_ACCOUNT_ID,

173

apiToken: process.env.CLOUDFLARE_API_TOKEN

174

}

175

}

176

};

177

178

// PostgreSQL configuration

179

const postgresConfig = {

180

database: {

181

type: 'postgresql',

182

postgresql: {

183

connectionString: process.env.DATABASE_URL,

184

pool: {

185

min: 2,

186

max: 20,

187

acquireTimeout: 30000,

188

idleTimeout: 600000

189

},

190

ssl: {

191

require: true,

192

ca: process.env.DB_SSL_CA

193

}

194

}

195

}

196

};

197

```

198

199

### Preview Options

200

201

Configuration for live content editing and preview functionality.

202

203

```typescript { .api }

204

interface PreviewOptions {

205

/** Enable preview mode */

206

enabled?: boolean;

207

/** API endpoint for preview operations */

208

api?: string;

209

/** Authentication configuration */

210

auth?: PreviewAuthConfig;

211

/** WebSocket configuration for real-time updates */

212

websocket?: WebSocketConfig;

213

/** Preview UI customization */

214

ui?: PreviewUIConfig;

215

}

216

217

interface PreviewAuthConfig {

218

/** Authentication strategy */

219

strategy: 'token' | 'session' | 'custom';

220

/** Token configuration for token strategy */

221

token?: {

222

secret: string;

223

expiresIn?: string;

224

algorithm?: string;

225

};

226

/** Session configuration for session strategy */

227

session?: {

228

cookieName?: string;

229

maxAge?: number;

230

secure?: boolean;

231

};

232

/** Custom authentication handler */

233

handler?: (request: Request) => Promise<boolean>;

234

}

235

236

interface WebSocketConfig {

237

/** Enable WebSocket for real-time updates */

238

enabled?: boolean;

239

/** WebSocket server port */

240

port?: number;

241

/** WebSocket path */

242

path?: string;

243

}

244

245

interface PreviewUIConfig {

246

/** Custom CSS for preview UI */

247

styles?: string;

248

/** Preview toolbar position */

249

position?: 'top' | 'bottom' | 'left' | 'right';

250

/** Custom preview components */

251

components?: Record<string, string>;

252

}

253

```

254

255

### Watch Options

256

257

File watching and hot module replacement configuration.

258

259

```typescript { .api }

260

interface WatchOptions {

261

/** Enable file watching */

262

enabled?: boolean;

263

/** File patterns to watch */

264

patterns?: string[];

265

/** Directories to ignore */

266

ignored?: string[];

267

/** Debounce delay in milliseconds */

268

debounce?: number;

269

/** Watch options for chokidar */

270

chokidar?: {

271

ignoreInitial?: boolean;

272

persistent?: boolean;

273

followSymlinks?: boolean;

274

depth?: number;

275

};

276

}

277

```

278

279

### Renderer Options

280

281

Content rendering and component configuration.

282

283

```typescript { .api }

284

interface RendererOptions {

285

/** Custom component mapping for MDC */

286

components?: Record<string, string>;

287

/** Global component props */

288

props?: Record<string, Record<string, unknown>>;

289

/** Prose component configuration */

290

prose?: ProseConfig;

291

/** Markdown processing options */

292

markdown?: MarkdownConfig;

293

/** Syntax highlighting configuration */

294

highlight?: HighlightConfig;

295

}

296

297

interface ProseConfig {

298

/** Enable prose components */

299

enabled?: boolean;

300

/** Prose component prefix */

301

prefix?: string;

302

/** Custom prose components */

303

components?: Record<string, string>;

304

}

305

306

interface MarkdownConfig {

307

/** Enable anchor links */

308

anchorLinks?: boolean;

309

/** Table of contents configuration */

310

toc?: {

311

depth?: number;

312

searchDepth?: number;

313

};

314

/** Remarkjs plugins */

315

remarkPlugins?: Array<string | [string, any]>;

316

/** Rehype plugins */

317

rehypePlugins?: Array<string | [string, any]>;

318

}

319

320

interface HighlightConfig {

321

/** Syntax highlighting theme */

322

theme?: string | { light: string; dark: string };

323

/** Supported languages */

324

langs?: string[];

325

/** Enable line numbers */

326

lineNumbers?: boolean;

327

}

328

```

329

330

### Build Options

331

332

Build-time processing and optimization configuration.

333

334

```typescript { .api }

335

interface BuildOptions {

336

/** Enable content preprocessing */

337

preprocess?: boolean;

338

/** Generate TypeScript types */

339

generateTypes?: boolean;

340

/** Minify generated content */

341

minify?: boolean;

342

/** Content caching strategy */

343

cache?: CacheConfig;

344

/** Asset optimization */

345

assets?: AssetConfig;

346

}

347

348

interface CacheConfig {

349

/** Enable content caching */

350

enabled?: boolean;

351

/** Cache directory */

352

dir?: string;

353

/** Cache TTL in seconds */

354

ttl?: number;

355

/** Cache invalidation strategy */

356

invalidation?: 'content' | 'time' | 'manual';

357

}

358

359

interface AssetConfig {

360

/** Optimize images */

361

images?: {

362

enabled?: boolean;

363

formats?: string[];

364

quality?: number;

365

sizes?: number[];

366

};

367

/** Bundle code blocks */

368

codeBlocks?: {

369

enabled?: boolean;

370

bundler?: 'esbuild' | 'rollup';

371

};

372

}

373

```

374

375

### Experimental Options

376

377

Feature flags for experimental functionality.

378

379

```typescript { .api }

380

interface ExperimentalOptions {

381

/** Advanced query features */

382

advancedQuery?: boolean;

383

/** Server-side Vue components in content */

384

serverComponents?: boolean;

385

/** Streaming content delivery */

386

streaming?: boolean;

387

/** Advanced caching strategies */

388

advancedCache?: boolean;

389

/** Real-time collaboration */

390

collaboration?: boolean;

391

}

392

```

393

394

## Configuration Examples

395

396

### Production Configuration

397

398

```typescript

399

// nuxt.config.ts - Production setup

400

export default defineNuxtConfig({

401

content: {

402

database: {

403

type: 'postgresql',

404

postgresql: {

405

connectionString: process.env.DATABASE_URL,

406

pool: { min: 5, max: 50 },

407

ssl: { require: true }

408

}

409

},

410

411

build: {

412

preprocess: true,

413

generateTypes: true,

414

minify: true,

415

cache: {

416

enabled: true,

417

ttl: 3600,

418

invalidation: 'content'

419

}

420

},

421

422

renderer: {

423

markdown: {

424

anchorLinks: true,

425

toc: { depth: 3 }

426

},

427

highlight: {

428

theme: { light: 'github-light', dark: 'github-dark' },

429

lineNumbers: true

430

}

431

}

432

}

433

});

434

```

435

436

### Development Configuration

437

438

```typescript

439

// nuxt.config.ts - Development setup

440

export default defineNuxtConfig({

441

content: {

442

database: {

443

type: 'sqlite',

444

sqlite: {

445

path: '.nuxt/content-dev.db',

446

walMode: true

447

}

448

},

449

450

preview: {

451

enabled: true,

452

auth: {

453

strategy: 'token',

454

token: {

455

secret: process.env.PREVIEW_SECRET,

456

expiresIn: '24h'

457

}

458

},

459

websocket: { enabled: true }

460

},

461

462

watch: {

463

enabled: true,

464

patterns: ['content/**/*', 'components/**/*.vue'],

465

debounce: 200

466

},

467

468

experimental: {

469

advancedQuery: true,

470

serverComponents: true

471

}

472

}

473

});

474

```

475

476

## Types

477

478

```typescript { .api }

479

interface LocalDevelopmentDatabase {

480

/** Enable local development database */

481

enabled?: boolean;

482

/** Database file path */

483

path?: string;

484

/** Auto-migrate on changes */

485

migrate?: boolean;

486

/** Development-only options */

487

devOptions?: {

488

logQueries?: boolean;

489

resetOnRestart?: boolean;

490

};

491

}

492

493

interface CacheEntry {

494

/** Cache key */

495

key: string;

496

/** Cached value */

497

value: unknown;

498

/** Creation timestamp */

499

createdAt: number;

500

/** Expiration timestamp */

501

expiresAt?: number;

502

/** Cache tags for invalidation */

503

tags?: string[];

504

}

505

506

type DatabaseBindParams = string | number | boolean | null | Buffer;

507

```