Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.{ts,tsx,js,jsx,json,yml,yaml}]
quote_type = single
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
APP_NAME=hyperwave
EMAIL_FROM="noreply@example.com"
HOST=http://localhost:3000
NODE_ENV=development
PORT=3000
RESEND_API_KEY=go_get_an_api_key_from_resend.com
SECRET_KEY=change_this_to_a_secure_random_key_with_32_chars
SKIP_AUTH=false
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ package-lock.json

server

# SQLite databases
db.sqlite
app.db
*.db
*.db-shm
*.db-wal
.env
47 changes: 47 additions & 0 deletions DEPLOY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Fly.io SQLite Deployment

## 1. Create persistent volume for SQLite database

```bash
fly volumes create data --region dfw --size 1
```

This creates a 1GB persistent volume named "data" in the Dallas region.

## 2. Set environment variables

```bash
fly secrets set RESEND_API_KEY="your_resend_api_key_here"
fly secrets set HOST="https://hyperwave.fly.dev"
fly secrets set EMAIL_FROM="noreply@hyperwave.fly.dev"
```

## 3. Deploy the application

```bash
fly deploy
```

## 4. Verify deployment

```bash
fly status
fly logs
```

## Database persistence

The SQLite database will be stored at `/data/app.db` inside the container, which is mounted to the persistent volume. This ensures your data survives deployments and machine restarts.

## Volume management

```bash
# List volumes
fly volumes list

# Show volume details
fly volumes show data

# Backup database (optional)
fly ssh console -C "cp /data/app.db /tmp/backup.db"
```
35 changes: 9 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,21 @@
# use the official Bun image
# see all versions at https://hub.docker.com/r/oven/bun/tags
FROM oven/bun:1 AS base
WORKDIR /usr/src/app

# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile

# install
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile

# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
FROM base AS release
COPY --from=install /usr/src/app/node_modules node_modules
COPY . ./
RUN cp .env.example .env

# Env vars
ENV NODE_ENV=production
ENV PORT=3000
ENV DATABASE_PATH=/data/app.db

# copy production dependencies and source code into final image
FROM base AS release
COPY --from=prerelease /usr/src/app .
COPY --from=install /temp/dev/node_modules node_modules
COPY --from=prerelease /usr/src/app/public public
RUN mkdir -p /data

# run the app
USER bun
EXPOSE 3000/tcp
WORKDIR /usr/src/app
ENV PORT=3000
ENTRYPOINT ["bun", "run", "src/server.tsx"]
Loading