npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

create-bun-stack

v1.0.9

Published

Rails-inspired fullstack application generator for Bun

Downloads

32

Readme

create-bun-stack


🎯 Quick Start

# Using bun create
bun create bun-stack

# Or using bunx/npx directly
bunx create-bun-stack

# Or from GitHub directly
bun create jasencarroll/create-bun-stack

🤔 Why create-bun-stack?

Missing that Rails feeling in modern JavaScript? We were too. So we built the generator that brings Rails-like productivity to the Bun ecosystem.

⚡ Bun + Rails Philosophy = Developer Happiness

  • Convention over Configuration - Stop bikeshedding, start shipping
  • Batteries Included - Auth, database, testing, styling - it's all there
  • Zero Config - Works out of the box with sensible defaults
  • Type Safety - Full TypeScript with proper types everywhere
  • Lightning Fast - Powered by Bun's blazing fast runtime

📊 How It Compares

| Feature | create-bun-stack | create-react-app | Next.js | Vite | | --------------- | ---------------- | ---------------- | ------------- | ---------------- | | Fullstack | ✅ Built-in | ❌ Frontend only | ✅ API routes | ❌ Frontend only | | Database | ✅ Configured | ❌ DIY | ❌ DIY | ❌ DIY | | Auth | ✅ JWT ready | ❌ DIY | ❌ DIY | ❌ DIY | | Testing | ✅ Integrated | ✅ Jest | ✅ Jest | ✅ Vitest | | Type Safety | ✅ End-to-end | ⚠️ Frontend only | ✅ Good | ✅ Good | | Performance | 🚀 Bun speed | 🐌 Webpack | 🏃 Fast | 🏃 Fast | | Setup Time | ⚡ < 30s | 😴 2-3 min | 😴 1-2 min | ⚡ < 1 min |

✨ Features

🏗️ Fullstack Architecture

// API endpoint with type safety
export const users = {
  "/:id": {
    GET: async (req: Request & { params: { id: string } }) => {
      const user = await db.users.findById(req.params.id);
      return Response.json(user);
    }
  }
};

// React component with data fetching
function UserProfile({ id }: { id: string }) {
  const { data: user } = useQuery({
    queryKey: ['user', id],
    queryFn: () => fetch(`/api/users/${id}`).then(r => r.json())
  });

  return <div>Welcome, {user?.name}!</div>;
}

🔐 Authentication Built-in

// Register a new user
const { token, user } = await auth.register({
  email: "[email protected]",
  password: "secure123",
});

// Protected routes just work
const protectedRoute = withAuth(async (req, user) => {
  return Response.json({ message: `Hello ${user.name}!` });
});

🗄️ Dual Database Support

// Works with PostgreSQL in production
DATABASE_URL = "postgresql://...";

// Falls back to SQLite for local dev
// Just works - no config needed!

🧪 Testing That Actually Works

// Real integration tests, no mocks needed
test("creates a user", async () => {
  const response = await fetch("http://localhost:3000/api/users", {
    method: "POST",
    body: JSON.stringify({ name: "Test User" }),
  });

  expect(response.status).toBe(201);
});

🛡️ Security First

  • ✅ CSRF Protection
  • ✅ Secure Headers (CSP, HSTS, etc.)
  • ✅ Input Validation with Zod
  • ✅ SQL Injection Protection via Drizzle ORM
  • ✅ Bcrypt Password Hashing

🎨 Modern Frontend Stack

  • React 18 with Suspense & Error Boundaries
  • React Router for client-side routing
  • Tailwind CSS for styling
  • React Query for server state
  • TypeScript everywhere

🚀 Developer Experience

  • Hot Reload - See changes instantly
  • Type Safety - Catch errors at compile time
  • File-based Routing - Intuitive API structure
  • Auto-imports - Bun handles your imports
  • Built-in Formatter - Prettier & Biome configured

📦 What's Included

my-app/
├── src/
│   ├── app/           # React frontend
│   │   ├── components/
│   │   ├── hooks/
│   │   ├── pages/
│   │   └── main.tsx
│   ├── server/        # Bun backend
│   │   ├── routes/
│   │   ├── middleware/
│   │   └── index.ts
│   ├── db/            # Database layer
│   │   ├── schema.ts
│   │   ├── seed.ts
│   │   └── repositories/
│   └── lib/           # Shared utilities
├── public/            # Static assets
├── tests/             # Test files
└── package.json       # One file to rule them all

🚦 Commands

bun run dev        # Start development server
bun test          # Run tests
bun run build     # Build for production
bun run db:push   # Sync database schema
bun run db:seed   # Seed database
bun run check     # Type check, lint, format

🌍 Deployment

Deploy anywhere Bun runs:

  • Railway - One click deploy
  • Fly.io - Edge deployments
  • Docker - Containerize with Bun's official image
  • VPS - Any Linux server with Bun installed
FROM oven/bun:1
COPY . .
RUN bun install
EXPOSE 3000
CMD ["bun", "run", "src/server/index.ts"]

🤝 Contributing

We love contributions! Check out our Contributing Guide to get started.

# Fork and clone
git clone https://github.com/yourusername/create-bun-stack
cd create-bun-app

# Install dependencies
bun install

# Make your changes
bun run test

# Submit a PR!

📚 Documentation

🐛 Troubleshooting

# Kill the process using port 3000
lsof -ti:3000 | xargs kill -9

# Or use a different port
PORT=3001 bun run dev
# For PostgreSQL issues
psql -U postgres -c "CREATE DATABASE myapp_dev;"

# Or just use SQLite (automatic fallback)
rm .env  # Remove DATABASE_URL
bun run dev

Make sure your server is running:

# In one terminal
bun run dev

# In another terminal
bun test

🔓 Open-Sourced Leverage

Bun Stack is more than a fullstack starter — it's everything you'd build if you had the time.

  • ✅ Security defaults (CSRF, JWT, password hashing)
  • ✅ End-to-end TypeScript
  • ✅ Auth, routing, DB, CI/CD
  • ✅ Docker + 1-click Railway deploy
  • ✅ Convention-driven structure No yak shaving. No config hell. No architecture debates.

Just code. Just ship.


Built by Jasen

Engineer. Systems thinker. MBA. ADHD-fueled DX evangelist. I built Bun Stack to democratize the leverage that took me 15 years to earn. Now it’s yours. Just ship.

📄 License

MIT © Jasen Carroll