Skip to content

Commit 8317264

Browse files
committed
add magic link code and dashboard simulation
1 parent 8e4336c commit 8317264

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+8591
-246
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
indent_style = space
8+
indent_size = 2
9+
trim_trailing_whitespace = true
10+
11+
[*.{ts,tsx,js,jsx,json,yml,yaml}]
12+
quote_type = single

.env.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
APP_NAME=hyperwave
2+
EMAIL_FROM="[email protected]"
3+
HOST=http://localhost:3000
4+
NODE_ENV=development
5+
PORT=3000
6+
RESEND_API_KEY=go_get_an_api_key_from_resend.com
7+
SECRET_KEY=change_this_to_a_secure_random_key_with_32_chars
8+
SKIP_AUTH=false

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,10 @@ package-lock.json
4343

4444
server
4545

46+
# SQLite databases
4647
db.sqlite
48+
app.db
49+
*.db
50+
*.db-shm
51+
*.db-wal
52+
.env

DEPLOY.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Fly.io SQLite Deployment
2+
3+
## 1. Create persistent volume for SQLite database
4+
5+
```bash
6+
fly volumes create data --region dfw --size 1
7+
```
8+
9+
This creates a 1GB persistent volume named "data" in the Dallas region.
10+
11+
## 2. Set environment variables
12+
13+
```bash
14+
fly secrets set RESEND_API_KEY="your_resend_api_key_here"
15+
fly secrets set HOST="https://hyperwave.fly.dev"
16+
fly secrets set EMAIL_FROM="[email protected]"
17+
```
18+
19+
## 3. Deploy the application
20+
21+
```bash
22+
fly deploy
23+
```
24+
25+
## 4. Verify deployment
26+
27+
```bash
28+
fly status
29+
fly logs
30+
```
31+
32+
## Database persistence
33+
34+
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.
35+
36+
## Volume management
37+
38+
```bash
39+
# List volumes
40+
fly volumes list
41+
42+
# Show volume details
43+
fly volumes show data
44+
45+
# Backup database (optional)
46+
fly ssh console -C "cp /data/app.db /tmp/backup.db"
47+
```

Dockerfile

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,21 @@
1-
# use the official Bun image
2-
# see all versions at https://hub.docker.com/r/oven/bun/tags
31
FROM oven/bun:1 AS base
42
WORKDIR /usr/src/app
53

6-
# install dependencies into temp directory
7-
# this will cache them and speed up future builds
84
FROM base AS install
9-
RUN mkdir -p /temp/dev
10-
COPY package.json bun.lockb /temp/dev/
11-
RUN cd /temp/dev && bun install --frozen-lockfile
5+
COPY package.json bun.lock ./
6+
RUN bun install --frozen-lockfile
127

13-
# install
14-
RUN mkdir -p /temp/prod
15-
COPY package.json bun.lockb /temp/prod/
16-
RUN cd /temp/prod && bun install --frozen-lockfile
17-
18-
# copy node_modules from temp directory
19-
# then copy all (non-ignored) project files into the image
20-
FROM base AS prerelease
21-
COPY --from=install /temp/dev/node_modules node_modules
22-
COPY . .
8+
FROM base AS release
9+
COPY --from=install /usr/src/app/node_modules node_modules
10+
COPY . ./
11+
RUN cp .env.example .env
2312

24-
# Env vars
2513
ENV NODE_ENV=production
14+
ENV PORT=3000
15+
ENV DATABASE_PATH=/data/app.db
2616

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

33-
# run the app
3419
USER bun
3520
EXPOSE 3000/tcp
36-
WORKDIR /usr/src/app
37-
ENV PORT=3000
3821
ENTRYPOINT ["bun", "run", "src/server.tsx"]

0 commit comments

Comments
 (0)