Skip to content

Commit

Permalink
Add palm springs demo code, de-traveljoyified
Browse files Browse the repository at this point in the history
  • Loading branch information
tireymorris committed Dec 12, 2023
1 parent 4536b0a commit 8f1f939
Show file tree
Hide file tree
Showing 26 changed files with 661 additions and 120 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ package-lock.json

server

*.sqlite
db.sqlite
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
# hyperwave 🌊

hyperwave is a server-side framework for building web applications.
https://hyperwave.codes/

* fast: Bun and Hono for best-in-class performance
* lightweight: ~20kb payload, loads in < 5 seconds on slow 3G
* productive: use the best tools for the job: Tailwind, HTMX, and TypeScript
* portable: compile a binary to deploy anywhere
hyperwave is a server-side framework for building web applications.

---
- fast: Bun and Hono for best-in-class performance
- lightweight: ~20kb payload. Demo loads in a couple seconds even while throttled to 2G.
- productive: use the best tools for the job: Tailwind, HTMX, and TypeScript
- portable: compile a binary to deploy anywhere

### Setup

`bun setup`
`bun install && bun run src/db.ts && bun dev`

Visit port 3000 and edit `server.tsx`

---

### Example

This is the endpoint serving our initial landing page:

```typescript
app.get("/", ({ html }) =>
html(
Expand All @@ -38,6 +40,7 @@ app.get("/", ({ html }) =>
),
);
```

- The API serves a full HTML document to the client, which includes Tailwind classes and HTMX attributes
- The response is wrapped in a `<Layout />` tag, a server-rendered functional component, which takes a `title` prop
- The button, when clicked, will issue a `GET` request to `/instructions` and replace the content of its parent div with the response.
Expand Down
12 changes: 12 additions & 0 deletions assets/icons/calendar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function Calendar() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height="16"
width="14"
viewBox="0 0 448 512"
>
<path d="M128 0c17.7 0 32 14.3 32 32V64H288V32c0-17.7 14.3-32 32-32s32 14.3 32 32V64h48c26.5 0 48 21.5 48 48v48H0V112C0 85.5 21.5 64 48 64H96V32c0-17.7 14.3-32 32-32zM0 192H448V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V192zm64 80v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm128 0v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H336zM64 400v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H208zm112 16v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H336c-8.8 0-16 7.2-16 16z" />
</svg>
);
}
12 changes: 12 additions & 0 deletions assets/icons/chart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function Chart() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height="16"
width="16"
viewBox="0 0 512 512"
>
<path d="M32 32c17.7 0 32 14.3 32 32V400c0 8.8 7.2 16 16 16H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H80c-44.2 0-80-35.8-80-80V64C0 46.3 14.3 32 32 32zM160 224c17.7 0 32 14.3 32 32v64c0 17.7-14.3 32-32 32s-32-14.3-32-32V256c0-17.7 14.3-32 32-32zm128-64V320c0 17.7-14.3 32-32 32s-32-14.3-32-32V160c0-17.7 14.3-32 32-32s32 14.3 32 32zm64 32c17.7 0 32 14.3 32 32v96c0 17.7-14.3 32-32 32s-32-14.3-32-32V224c0-17.7 14.3-32 32-32zM480 96V320c0 17.7-14.3 32-32 32s-32-14.3-32-32V96c0-17.7 14.3-32 32-32s32 14.3 32 32z" />
</svg>
);
}
12 changes: 12 additions & 0 deletions assets/icons/check.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function Check() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height="16"
width="14"
viewBox="0 0 448 512"
>
<path d="M64 80c-8.8 0-16 7.2-16 16V416c0 8.8 7.2 16 16 16H384c8.8 0 16-7.2 16-16V96c0-8.8-7.2-16-16-16H64zM0 96C0 60.7 28.7 32 64 32H384c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM337 209L209 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L303 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z" />
</svg>
);
}
12 changes: 12 additions & 0 deletions assets/icons/credit_card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function CreditCard() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height="16"
width="18"
viewBox="0 0 576 512"
>
<path d="M512 80c8.8 0 16 7.2 16 16v32H48V96c0-8.8 7.2-16 16-16H512zm16 144V416c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V224H528zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H512c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm56 304c-13.3 0-24 10.7-24 24s10.7 24 24 24h48c13.3 0 24-10.7 24-24s-10.7-24-24-24H120zm128 0c-13.3 0-24 10.7-24 24s10.7 24 24 24H360c13.3 0 24-10.7 24-24s-10.7-24-24-24H248z" />
</svg>
);
}
12 changes: 12 additions & 0 deletions assets/icons/file.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function File() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height="16"
width="12"
viewBox="0 0 384 512"
>
<path d="M320 464c8.8 0 16-7.2 16-16V160H256c-17.7 0-32-14.3-32-32V48H64c-8.8 0-16 7.2-16 16V448c0 8.8 7.2 16 16 16H320zM0 64C0 28.7 28.7 0 64 0H229.5c17 0 33.3 6.7 45.3 18.7l90.5 90.5c12 12 18.7 28.3 18.7 45.3V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64z" />
</svg>
);
}
12 changes: 12 additions & 0 deletions assets/icons/gear.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function Gear() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height="16"
width="16"
viewBox="0 0 512 512"
>
<path d="M495.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6 15.9 6.4 24.6c-4.4 11.9-9.7 23.3-15.8 34.3l-4.7 8.1c-6.6 11-14 21.4-22.1 31.2c-5.9 7.2-15.7 9.6-24.5 6.8l-55.7-17.7c-13.4 10.3-28.2 18.9-44 25.4l-12.5 57.1c-2 9.1-9 16.3-18.2 17.8c-13.8 2.3-28 3.5-42.5 3.5s-28.7-1.2-42.5-3.5c-9.2-1.5-16.2-8.7-18.2-17.8l-12.5-57.1c-15.8-6.5-30.6-15.1-44-25.4L83.1 425.9c-8.8 2.8-18.6 .3-24.5-6.8c-8.1-9.8-15.5-20.2-22.1-31.2l-4.7-8.1c-6.1-11-11.4-22.4-15.8-34.3c-3.2-8.7-.5-18.4 6.4-24.6l43.3-39.4C64.6 273.1 64 264.6 64 256s.6-17.1 1.7-25.4L22.4 191.2c-6.9-6.2-9.6-15.9-6.4-24.6c4.4-11.9 9.7-23.3 15.8-34.3l4.7-8.1c6.6-11 14-21.4 22.1-31.2c5.9-7.2 15.7-9.6 24.5-6.8l55.7 17.7c13.4-10.3 28.2-18.9 44-25.4l12.5-57.1c2-9.1 9-16.3 18.2-17.8C227.3 1.2 241.5 0 256 0s28.7 1.2 42.5 3.5c9.2 1.5 16.2 8.7 18.2 17.8l12.5 57.1c15.8 6.5 30.6 15.1 44 25.4l55.7-17.7c8.8-2.8 18.6-.3 24.5 6.8c8.1 9.8 15.5 20.2 22.1 31.2l4.7 8.1c6.1 11 11.4 22.4 15.8 34.3zM256 336a80 80 0 1 0 0-160 80 80 0 1 0 0 160z" />
</svg>
);
}
12 changes: 12 additions & 0 deletions assets/icons/house.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function House() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height="16"
width="18"
viewBox="0 0 576 512"
>
<path d="M575.8 255.5c0 18-15 32.1-32 32.1h-32l.7 160.2c0 2.7-.2 5.4-.5 8.1V472c0 22.1-17.9 40-40 40H456c-1.1 0-2.2 0-3.3-.1c-1.4 .1-2.8 .1-4.2 .1H416 392c-22.1 0-40-17.9-40-40V448 384c0-17.7-14.3-32-32-32H256c-17.7 0-32 14.3-32 32v64 24c0 22.1-17.9 40-40 40H160 128.1c-1.5 0-3-.1-4.5-.2c-1.2 .1-2.4 .2-3.6 .2H104c-22.1 0-40-17.9-40-40V360c0-.9 0-1.9 .1-2.8V287.6H32c-18 0-32-14-32-32.1c0-9 3-17 10-24L266.4 8c7-7 15-8 22-8s15 2 21 7L564.8 231.5c8 7 12 15 11 24z" />
</svg>
);
}
15 changes: 15 additions & 0 deletions assets/icons/magnify.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export default function Magnify() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height="16"
width="16"
viewBox="0 0 512 512"
>
<path
opacity="1"
d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"
/>
</svg>
);
}
12 changes: 12 additions & 0 deletions assets/icons/question.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function Question() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height="16"
width="10"
viewBox="0 0 320 512"
>
<path d="M80 160c0-35.3 28.7-64 64-64h32c35.3 0 64 28.7 64 64v3.6c0 21.8-11.1 42.1-29.4 53.8l-42.2 27.1c-25.2 16.2-40.4 44.1-40.4 74V320c0 17.7 14.3 32 32 32s32-14.3 32-32v-1.4c0-8.2 4.2-15.8 11-20.2l42.2-27.1c36.6-23.6 58.8-64.1 58.8-107.7V160c0-70.7-57.3-128-128-128H144C73.3 32 16 89.3 16 160c0 17.7 14.3 32 32 32s32-14.3 32-32zm80 320a40 40 0 1 0 0-80 40 40 0 1 0 0 80z" />
</svg>
);
}
12 changes: 12 additions & 0 deletions assets/icons/user.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function User() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
height="16"
width="14"
viewBox="0 0 448 512"
>
<path d="M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512H418.3c16.4 0 29.7-13.3 29.7-29.7C448 383.8 368.2 304 269.7 304H178.3z" />
</svg>
);
}
Binary file modified bun.lockb
Binary file not shown.
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@
"name": "hyperwave",
"version": "1.0.50",
"scripts": {
"build": "bun css && bun build --compile ./src/server.tsx",
"css": "unocss \"src/**/*.tsx\" -o public/styles/uno.css",
"css:watch": "unocss \"src/**/*.tsx\" -o public/styles/uno.css --watch",
"server:watch": "bun --watch run src/server.tsx",
"dev": "concurrently \"bun css:watch\" \"bun server:watch\"",
"db": "bun run src/db.ts",
"setup": "bun install && bun db && bun dev",
"test": "bun run test",
"dev": "concurrently \"bun css:watch\" \"bun server:watch\"",
"prettier": "bunx prettier --write src/ test/ --plugin prettier-plugin-tailwindcss",
"build": "bun css && bun build --compile ./src/server.tsx"
"server:watch": "bun --watch run src/server.tsx",
"test": "bun run test"
},
"dependencies": {
"hono": "^3.6.3"
"@unocss/preset-web-fonts": "^0.58.0",
"hono": "^3.6.3",
"unocss": "^0.58.0"
},
"devDependencies": {
"@unocss/cli": "^0.56.5",
"bun-types": "latest",
"concurrently": "^8.2.1",
"prettier": "^3.1.0",
"prettier-plugin-tailwindcss": "^0.5.9"
},
"module": "src/server.tsx"
Expand Down
Loading

0 comments on commit 8f1f939

Please sign in to comment.