🧩 Server Only

Execute logic exclusively on the server/Node environment using Toolkitify.

Some logic must never run in the browser—for example:

  • File system access
  • Secrets
  • Token generation
  • Heavy computation
  • Database calls

server-only ensures the code inside this module executes only in a server environment.

✅ Example

import "toolkitify/server-only";

// This will run only in Node/SSR
console.log("This code runs only in Node/SSR, not in the browser");

// Node's filesystem API can be used safely
const fs = require("fs");
console.log(fs.readdirSync("."));