Skip to content

Commit

Permalink
add some sane defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
tireymorris committed Dec 6, 2023
1 parent 5df1d06 commit 46fadd3
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ package-lock.json
**/*.bun

server

*.sqlite
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# hyperwave 🌊

https://hyperwave.codes/

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.
* 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

---

### Setup

`bun install && bun dev`
`bun setup`

Visit port 3000 and edit `server.tsx`

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"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",
"prettier": "bunx prettier --write src/ test/",
"build": "bun css && bun build --compile ./src/server.tsx"
Expand Down
3 changes: 2 additions & 1 deletion public/styles/uno.css

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

1 change: 1 addition & 0 deletions src/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default function Layout({ title, children }) {
href="https://cdn.jsdelivr.net/npm/@unocss/reset/tailwind.min.css"
/>
<link rel="stylesheet" href="/styles/uno.css" />
<style>{`* { box-sizing: border-box; margin: 0; outline: none; }`}</style>
<script>htmx.config.globalViewTransitions = true</script>
</head>

Expand Down
28 changes: 26 additions & 2 deletions src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@ import { Database } from "bun:sqlite";

const db = new Database("db.sqlite", { create: true });

const query = db.query(`select "Hello world" as message`);
const createMovies = db.query(`
CREATE TABLE IF NOT EXISTS Movie (
movie_id INTEGER PRIMARY KEY,
name TEXT,
year TEXT,
runtime INTEGER,
categories TEXT,
release_date TEXT,
director TEXT,
writer TEXT,
actors TEXT,
storyline TEXT
);
`);

console.log(query);
const createActors = db.query(`
CREATE TABLE IF NOT EXISTS Actor (
actor_id INTEGER PRIMARY KEY,
name TEXT,
birthname TEXT,
birthdate TEXT,
birthplace TEXT
);
`);

createMovies.run();
createActors.run();

0 comments on commit 46fadd3

Please sign in to comment.