Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7dd87a6
Experimental SSR playground.
molefrog Nov 25, 2025
8f3d18a
Update.
molefrog Nov 25, 2025
853031f
Fix useSearch in SSR regression.
molefrog Dec 1, 2025
e5aa211
Improve the fix.
molefrog Dec 1, 2025
d7845f5
One more test.
molefrog Dec 1, 2025
19aef65
Merge branch 'fix/ssr-use-search-regression' into exp/sourdough
molefrog Dec 2, 2025
37bf221
Fix the app.
molefrog Dec 2, 2025
84e7b08
Merge branch 'fix/ssr-use-search-regression' into exp/sourdough
molefrog Dec 2, 2025
bc54b6d
Build in memory.
molefrog Dec 2, 2025
a4a1966
Merge branch 'v3' into exp/sourdough
molefrog Dec 2, 2025
29a48c4
Serve static and add favicon.
molefrog Dec 2, 2025
a39eddc
React 19.
molefrog Dec 2, 2025
1f739ff
Tailwind and wouter-commerce.
molefrog Dec 2, 2025
20e6a25
Format.
molefrog Dec 2, 2025
0b1ac0e
Wouter commerce.
molefrog Dec 3, 2025
b452d9f
Handler redirects on the server-side.
molefrog Dec 3, 2025
8adc324
Add to cart using history state.
molefrog Dec 3, 2025
9bec2f1
Use actual products with images.
molefrog Dec 4, 2025
6957589
Implement custom status codes.
molefrog Dec 4, 2025
674b99d
Support dynamic port.
molefrog Dec 8, 2025
bea07e3
Move navbar to components.
molefrog Dec 8, 2025
1b78af9
Use `useSearchParams` hook.
molefrog Dec 8, 2025
0fa84c1
Sourdough becomes magazin.
molefrog Dec 9, 2025
ebe3dbb
Dynamic titles via react helmet.
molefrog Dec 9, 2025
d6809a8
Fix type error.
molefrog Dec 9, 2025
849b7e6
Remove console.log
molefrog Dec 9, 2025
a3903c9
Rewrite the copy.
molefrog Dec 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
description: Use Bun instead of Node.js, npm, pnpm, or vite.
globs: "*.ts, *.tsx, *.html, *.css, *.js, *.jsx, package.json"
alwaysApply: false
---

Default to using Bun instead of Node.js.

- Use `bun <file>` instead of `node <file>` or `ts-node <file>`
- Use `bun test` instead of `jest` or `vitest`
- Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
- Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
- Bun automatically loads .env, so don't use dotenv.

## APIs

- `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
- `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
- `Bun.redis` for Redis. Don't use `ioredis`.
- `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
- `WebSocket` is built-in. Don't use `ws`.
- Prefer `Bun.file` over `node:fs`'s readFile/writeFile
- Bun.$`ls` instead of execa.

## Testing

Use `bun test` to run tests.

```ts#index.test.ts
import { test, expect } from "bun:test";

test("hello world", () => {
expect(1).toBe(1);
});
```

## Frontend

Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.

Server:

```ts#index.ts
import index from "./index.html"

Bun.serve({
routes: {
"/": index,
"/api/users/:id": {
GET: (req) => {
return new Response(JSON.stringify({ id: req.params.id }));
},
},
},
// optional websocket support
websocket: {
open: (ws) => {
ws.send("Hello, world!");
},
message: (ws, message) => {
ws.send(message);
},
close: (ws) => {
// handle close
}
},
development: {
hmr: true,
console: true,
}
})
```

HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle.

```html#index.html
<html>
<body>
<h1>Hello, world!</h1>
<script type="module" src="./frontend.tsx"></script>
</body>
</html>
```

With the following `frontend.tsx`:

```tsx#frontend.tsx
import React from "react";

// import .css files directly and it works
import './index.css';

import { createRoot } from "react-dom/client";

const root = createRoot(document.body);

export default function Frontend() {
return <h1>Hello, world!</h1>;
}

root.render(<Frontend />);
```

Then, run index.ts

```sh
bun --hot ./index.ts
```

For more information, read the Bun API docs in `node_modules/bun-types/docs/**.md`.
83 changes: 67 additions & 16 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "A minimalistic routing for React and Preact. Monorepo package.",
"type": "module",
"workspaces": [
"packages/wouter",
"packages/wouter-preact"
"packages/*"
],
"scripts": {
"fix:p": "prettier --write \"./**/*.(js|ts){x,}\"",
Expand Down Expand Up @@ -139,8 +138,8 @@
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^16.3.0",
"@types/bun": "1.3.3",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@types/react": "^19",
"@types/react-dom": "^19",
"copyfiles": "^2.4.1",
"eslint": "^7.19.0",
"eslint-plugin-react-hooks": "^4.6.2",
Expand All @@ -150,9 +149,9 @@
"preact": "^10.23.2",
"preact-render-to-string": "^6.5.9",
"prettier": "^2.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "^19",
"react-dom": "^19",
"size-limit": "^11.2.0",
"typescript": "^5.8.0"
}
}
}
34 changes: 34 additions & 0 deletions packages/magazin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# dependencies (bun install)
node_modules

# output
out
dist
*.tgz

# code coverage
coverage
*.lcov

# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# caches
.eslintcache
.cache
*.tsbuildinfo

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store
Loading
Loading