Esc

Configuration

This guide covers the key configuration files in a Streak.js project.


tsconfig.json

Streak projects use JSX as a build-time templating language. The following settings are required:

{
  "compilerOptions": {
    "jsx": "react-jsx",
    "moduleResolution": "bundler",
    "baseUrl": "src/",
    "strict": true,
    "target": "ESNext",
    "module": "ESNext",
    "types": ["bun-types"]
  },
  "include": ["src/**/*"]
}
OptionWhy
jsx: "react-jsx"Enables TSX compilation without explicit React imports
moduleResolution: "bundler"Matches Bun's module resolution behavior
baseUrl: "src/"Allows bare imports like import { x } from "services/MyService"
strict: trueCatches common errors at build time

With baseUrl set to src/, imports resolve from the src directory:

import { getHomeData } from "services/SanityServices";  // src/services/SanityServices.ts
import Button from "@common/components/button/Button";   // src/common/components/button/Button.tsx

TailwindCSS

Streak uses Tailwind CSS compiled at build time. There is no CSS-in-JS.

tailwind.config.js

/** @type {import('tailwindcss').Config} */
export default {
  content: ["./src/**/*.{ts,tsx}"],
  theme: {
    extend: {},
  },
  plugins: [],
};

input.css

Create src/common/styles/input.css:

@tailwind base;
@tailwind components;
@tailwind utilities;

Build Scripts

Add these scripts to package.json:

{
  "scripts": {
    "css-build": "tailwindcss -i ./src/common/styles/input.css -o ./public/styles/tailwind.css",
    "css-dev": "tailwindcss -i ./src/common/styles/input.css -o ./public/styles/tailwind.css --watch",
    "dev": "concurrently \"bun run css-dev\" \"bun run dev:streak\"",
    "dev:streak": "streak-forge dev",
    "build": "bun run css-build && streak-forge pre-build"
  }
}

The compiled CSS is written to public/styles/tailwind.css and linked from your layout's <head>.

Note: the build script above only compiles CSS and runs streak-forge pre-build, an optional bundling step — it does not render pages. To produce the site's out/<url>/<version>/raw-content.json output, run streak-forge build (typically as a separate script, or a dedicated CI step).


ESLint

Streak projects use ESLint 9 with flat config and TypeScript support.

// eslint.config.js
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";

export default [
  eslint.configs.recommended,
  ...tseslint.configs.recommended,
  {
    files: ["src/**/*.{ts,tsx}"],
    rules: {
      "@typescript-eslint/no-explicit-any": "warn",
      "@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
    },
  },
  {
    ignores: ["out/", "public/assets/js/"],
  },
];

Install the dependencies:

bun add -d eslint @eslint/js typescript-eslint

Environment Variables

Streak reads the following environment variables (from a .env file in the project root, or from the shell) via src/config.ts:

VariableDefaultDescription
PORT3690Dev server port
STREAK_HMRenabledSet to "false" to disable the dev server's live-reload (HMR) stream
STREAK_DISABLE_CRITICAL_CSSfalseSet to "true" to disable critical CSS inlining during rendering
STREAK_DEBUGfalseSet to "true" to enable verbose debug logging during builds
PREBUILD_DIR<project>/.prebuildWhere streak-forge pre-build writes its bundled cache
READ_FROM_PREBUILDdisabledSet to "1" so streak-forge build loads modules from PREBUILD_DIR instead of raw src/
STATIC_BUILD_DIR"out"Output directory for streak-forge build

Set these in a .env file or pass them inline:

PORT=4000 bun run dev

.gitignore

Recommended .gitignore entries for a Streak project:

node_modules/
out/
.prebuild/
.env
*.log
public/styles/tailwind.css
  • out/ is generated by streak-forge build and should not be committed.
  • .prebuild/ is generated by streak-forge pre-build and should not be committed.
  • public/styles/tailwind.css is compiled from input.css and regenerated on build.
  • Third-party JS in public/assets/js/should be committed — it is loaded at runtime via loadPackage and is not regenerated by any build step.