SPB Git

spb/search-box Public

Agentic web research engine — hypotheses, verbatim evidence, contradictions, sourced answers streamed live. Claude Opus 5 + Firecrawl + PostgreSQL.

TypeScript 76.9% CSS 18.7% SQL 2.1% JavaScript 1.8% Shell 0.5%
1.3 KB · 44 lines javascript
Raw Blame History
1/**2 * Search-box.ai3 * Author: Simon-Pierre Boucher4 * Contact: contact@spboucher.ai5 * File: apps/web/next.config.mjs6 * Description: Next.js config — loads repo-root .env and transpiles workspace packages.7 */89import { readFileSync } from "node:fs";10import { dirname, join } from "node:path";11import { fileURLToPath } from "node:url";1213// Secrets live in the repo-root .env (gitignored); Next only auto-loads app-dir env files.14const repoRoot = join(dirname(fileURLToPath(import.meta.url)), "..", "..");15try {16  for (const line of readFileSync(join(repoRoot, ".env"), "utf8").split("\n")) {17    const m = line.match(/^([A-Z0-9_]+)=(.*)$/);18    if (m && process.env[m[1]] === undefined) process.env[m[1]] = m[2];19  }20} catch {21  // .env optional when vars are exported by the environment22}2324/** @type {import('next').NextConfig} */25const nextConfig = {26  transpilePackages: [27    "@search-box/agent",28    "@search-box/anthropic",29    "@search-box/db",30    "@search-box/events",31    "@search-box/firecrawl",32    "@search-box/research",33    "@search-box/shared"34  ],35  serverExternalPackages: ["pg"],36  webpack: (config) => {37    // Workspace packages use ESM ".js" import specifiers for ".ts" sources.38    config.resolve.extensionAlias = { ".js": [".ts", ".tsx", ".js"] };39    return config;40  }41};4243export default nextConfig;44