Getting Started
Installation
Quick Install (Recommended)
Run the installer script:
curl -fsSL https://raw.githubusercontent.com/red-creators/pun/main/install.sh | bash
Manual Installation
# Clone the repository
git clone https://github.com/red-creators/pun.git
cd pun
# Build and install
./install.sh
Creating Your First Project
Initialize a New Project
mkdir my-app
cd my-app
pun init
This creates:
my-app/
├── package.json
├── tsconfig.json
├── .gitignore
└── src/
└── index.ts
Run Your First Program
Edit src/index.ts:
interface Person {
name: string;
age: number;
}
const greet = (person: Person) => {
console.log(`Hello, ${person.name}! You are ${person.age} years old.`);
};
greet({ name: "World", age: 2024 });
Run it:
pun run src/index.ts
Development Workflow
Development Mode
Use pun dev for the best development experience:
pun dev src/index.ts
This enables:
- Hot reload (state preserved across changes)
- Automatic restart on file changes
- Fast feedback loop
Watch Mode
For simpler auto-restart without state preservation:
pun run src/index.ts --watch
Adding Dependencies
Install Packages
# Add a package
pun add lodash
# Add dev dependencies
pun add -D typescript @types/node
Install All Dependencies
pun install
Next Steps
- Explore the CLI Reference
- Learn about the Built-in APIs
- Write some Tests