Skip to main content
Glama
installation.md2.26 kB
# Installation Get started with Macroforge in just a few minutes. Install the package and configure your project to start using TypeScript macros. ## Requirements * Node.js 24.0 or later * TypeScript 5.9 or later ## Install the Package Install Macroforge using your preferred package manager: npm ``` npm install macroforge ``` bun ``` bun add macroforge ``` pnpm ``` pnpm add macroforge ``` Info Macroforge includes pre-built native binaries for macOS (x64, arm64), Linux (x64, arm64), and Windows (x64, arm64). ## Basic Usage The simplest way to use Macroforge is with the built-in derive macros. Add a `@derive` comment decorator to your class: user.ts ``` /** @derive(Debug, Clone, PartialEq) */ class User {   name: string;   age: number;   constructor(name: string, age: number) {     this.name = name;     this.age = age;   } } // After macro expansion, User has: // - toString(): string              (from Debug) // - clone(): User                   (from Clone) // - equals(other: unknown): boolean (from PartialEq) ``` ## IDE Integration For the best development experience, add the TypeScript plugin to your `tsconfig.json`: tsconfig.json ``` {   "compilerOptions": {     "plugins": [       {         "name": "@macroforge/typescript-plugin"       }     ]   } } ``` This enables features like: * Accurate error positions in your source code * Autocompletion for generated methods * Type checking for expanded code ## Build Integration (Vite) If you're using Vite, add the plugin to your config for automatic macro expansion during build: vite.config.ts ``` import macroforge from "@macroforge/vite-plugin"; import { defineConfig } from "vite"; export default defineConfig({   plugins: [     macroforge({       generateTypes: true,       typesOutputDir: ".macroforge/types"     })   ] }); ``` ## Next Steps Now that you have Macroforge installed, learn how to use it: * [Create your first macro](../docs/getting-started/first-macro) * [Understand how macros work](../docs/concepts) * [Explore built-in macros](../docs/builtin-macros)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/macroforge-ts/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server