Skip to content

Commit 9d9cd22

Browse files
committed
refactor: replace Astro frontend with Vite and Preact
1 parent fc5be2a commit 9d9cd22

29 files changed

Lines changed: 2168 additions & 7429 deletions

.github/copilot-instructions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
## Overview
44

55
- Ruby web app that converts websites into RSS 2.0 feeds.
6-
- Built with **Roda** backend + **Astro** frontend, using the **html2rss** gem (+ `html2rss-configs`).
7-
- **Frontend:** Modern Astro-based UI with component architecture, served alongside Ruby backend.
6+
- Built with **Roda** backend + **Preact** frontend, using the **html2rss** gem (+ `html2rss-configs`).
7+
- **Frontend:** Vite-built Preact UI, served alongside Ruby backend.
88

99
## Documentation website of core dependencies
1010

@@ -14,10 +14,10 @@ Search these pages before using them. Find examples, plugins, UI components, and
1414

1515
1. https://roda.jeremyevans.net/documentation.html
1616

17-
### Astro & Starlight
17+
### Preact & Vite
1818

19-
1. https://docs.astro.build/en/getting-started/
20-
2. https://starlight.astro.build/getting-started/
19+
1. https://preactjs.com/guide/v10/getting-started/
20+
2. https://vite.dev/guide/
2121

2222
### html2rss
2323

@@ -40,8 +40,8 @@ Fix rubocop `RSpec/MultipleExpectations` adding rspec tag `:aggregate_failures`.
4040
- ✅ Validate all inputs. Pass outbound requests through **SSRF filter**.
4141
- ✅ Add caching headers where appropriate (`Rack::Cache`).
4242
- ✅ Errors: friendly messages for users, detailed logging internally.
43-
-**Frontend**: Use Astro components in `frontend/src/`. Keep it simple.
44-
-**CSS**: Use frontend styles provided by Astro Starlight.
43+
-**Frontend**: Use Preact components in `frontend/src/`. Keep it simple.
44+
-**CSS**: Use the app-owned frontend styles in `frontend/src/styles/`.
4545
-**Specs**: RSpec for Ruby, build tests for frontend.
4646
- ✅ When a spec needs to tweak environment variables, wrap the example in `ClimateControl.modify` so state is restored automatically.
4747

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ jobs:
127127
run: npm ci
128128
working-directory: frontend
129129

130-
- name: Build frontend
130+
- name: Build frontend static assets
131131
run: npm run build
132132
working-directory: frontend
133133

@@ -162,7 +162,7 @@ jobs:
162162
run: npm ci
163163
working-directory: frontend
164164

165-
- name: Build frontend
165+
- name: Build frontend static assets
166166
run: npm run build
167167
working-directory: frontend
168168

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ USER html2rss
7777

7878
COPY --from=builder /usr/local/bundle /usr/local/bundle
7979
COPY --chown=$USER:$USER . /app
80-
COPY --from=frontend-builder --chown=$USER:$USER /app/frontend/dist ./public/frontend
80+
COPY --from=frontend-builder --chown=$USER:$USER /app/public/frontend ./public/frontend
8181

8282
CMD ["bundle", "exec", "puma", "-C", "./config/puma.rb"]

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dev: ## Start development server with live reload
2828
dev-ruby: ## Start Ruby server only
2929
@bin/dev-ruby
3030

31-
dev-frontend: ## Start Astro dev server only
31+
dev-frontend: ## Start frontend dev server only
3232
@cd frontend && npm run dev
3333

3434
test: ## Run all tests (Ruby + Frontend)
@@ -111,7 +111,7 @@ openai-lint-spectral: openapi-lint-spectral ## Alias for openapi-lint-spectral
111111

112112
clean: ## Clean temporary files
113113
@rm -rf tmp/rack-cache-* coverage/
114-
@cd frontend && rm -rf dist/ .astro/ node_modules/
114+
@cd frontend && rm -rf dist/ node_modules/
115115
@echo "Clean complete!"
116116

117117
frontend-setup: ## Setup frontend dependencies

README.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# html2rss-web
44

5-
html2rss-web converts arbitrary websites into RSS 2.0 feeds with a slim Ruby backend and an Astro-powered frontend.
5+
html2rss-web converts arbitrary websites into RSS 2.0 feeds with a slim Ruby backend and a Preact frontend.
66

77
## Links
88

@@ -12,25 +12,16 @@ html2rss-web converts arbitrary websites into RSS 2.0 feeds with a slim Ruby bac
1212

1313
## Highlights
1414

15-
- Responsive Astro interface with gallery and custom feed creation.
15+
- Responsive Preact interface for demo, sign-in, conversion, and result flows.
1616
- Automatic source discovery with token-scoped permissions.
1717
- Signed public feed URLs that work in standard RSS readers.
1818
- Built-in SSRF defences, input validation, and HMAC-protected tokens.
1919

2020
## Architecture
2121

2222
- **Backend:** Ruby + Roda, backed by the `html2rss` gem for extraction.
23-
- **Frontend:** Astro static site with progressive enhancement.
23+
- **Frontend:** Preact app built with Vite into `public/frontend`.
2424
- **Distribution:** Docker Compose by default; other deployments require manual wiring.
25-
26-
## Documentation
27-
28-
In-repo docs live under `frontend/src/content/docs/` and are published by Astro.
29-
30-
- [Configuration Guide](frontend/src/content/docs/configuration.md)
31-
- [Security Guide](frontend/src/content/docs/security.md)
32-
- [REST API v1](frontend/src/content/docs/api/v1.md)
33-
- [Testing Overview](frontend/src/content/docs/testing.md)
3425
- [v2 Migration Guide](docs/migrations/v2.md)
3526

3627
## REST API Snapshot
@@ -73,17 +64,17 @@ bundle exec rspec
7364
make openapi
7465
```
7566

76-
Dev URLs: Ruby app at `http://localhost:4000`, Astro dev server at `http://localhost:4001`.
67+
Dev URLs: Ruby app at `http://localhost:4000`, frontend dev server at `http://localhost:4001`.
7768

7869
## Make Targets
7970

8071
| Command | Purpose |
8172
| -------------------- | ------------------------------------------------------- |
8273
| `make help` | List available shortcuts. |
8374
| `make setup` | Install Ruby and Node dependencies. |
84-
| `make dev` | Run Ruby (port 4000) and Astro (port 4001) dev servers. |
75+
| `make dev` | Run Ruby (port 4000) and frontend (port 4001) dev servers. |
8576
| `make dev-ruby` | Start only the Ruby server. |
86-
| `make dev-frontend` | Start only the Astro dev server (port 4001). |
77+
| `make dev-frontend` | Start only the frontend dev server (port 4001). |
8778
| `make test` | Run Ruby and frontend test suites. |
8879
| `make test-ruby` | Run Ruby specs. |
8980
| `make test-frontend` | Run frontend unit and contract tests. |
@@ -105,8 +96,8 @@ The OpenAPI file is generated from Ruby request specs only.
10596

10697
| Command | Purpose |
10798
| ----------------------- | --------------------------------------------- |
108-
| `npm run dev` | Astro dev server with hot reload (port 4001). |
109-
| `npm run build` | Production build. |
99+
| `npm run dev` | Vite dev server with hot reload (port 4001). |
100+
| `npm run build` | Build static assets into `public/frontend`. |
110101
| `npm run test:run` | Unit tests (Vitest). |
111102
| `npm run test:contract` | Contract tests with MSW. |
112103

bin/dev

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ cleanup() {
2626
wait $RUBY_PID 2>/dev/null || true
2727
fi
2828

29-
# Kill Astro server and its children
30-
if [ ! -z "$ASTRO_PID" ]; then
29+
# Kill frontend dev server and its children
30+
if [ ! -z "$FRONTEND_PID" ]; then
3131
# Kill the npm process and its children
32-
pkill -P $ASTRO_PID 2>/dev/null || true
33-
kill $ASTRO_PID 2>/dev/null || true
34-
wait $ASTRO_PID 2>/dev/null || true
32+
pkill -P $FRONTEND_PID 2>/dev/null || true
33+
kill $FRONTEND_PID 2>/dev/null || true
34+
wait $FRONTEND_PID 2>/dev/null || true
3535
fi
3636

3737
# Clean up any remaining processes on our ports
3838
pkill -f "puma.*html2rss-web" 2>/dev/null || true
39-
pkill -f "astro.*dev.*4001" 2>/dev/null || true
39+
pkill -f "vite.*4001" 2>/dev/null || true
4040

4141
echo "✅ Development servers stopped"
4242
exit 0
@@ -77,18 +77,18 @@ if [ "$ruby_started" != "true" ]; then
7777
exit 1
7878
fi
7979

80-
# Start Astro dev server
80+
# Start frontend dev server
8181
cd frontend
8282
npm run dev &
83-
ASTRO_PID=$!
83+
FRONTEND_PID=$!
8484

85-
# Verify Astro server started
85+
# Verify frontend server started
8686
sleep 3
87-
if ! kill -0 $ASTRO_PID 2>/dev/null; then
88-
echo "Astro dev server failed to start"
87+
if ! kill -0 $FRONTEND_PID 2>/dev/null; then
88+
echo "Frontend dev server failed to start"
8989
kill $RUBY_PID 2>/dev/null || true
9090
exit 1
9191
fi
9292

9393
echo "✅ Development environment ready at http://localhost:4001"
94-
wait $RUBY_PID $ASTRO_PID
94+
wait $RUBY_PID $FRONTEND_PID

frontend/.astro/types.d.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

frontend/astro.config.mjs

Lines changed: 0 additions & 57 deletions
This file was deleted.

frontend/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta name="robots" content="noindex, nofollow" />
7+
<meta
8+
name="description"
9+
content="Convert websites to RSS feeds instantly with html2rss-web."
10+
/>
11+
<title>Turn Any Website Into an RSS Feed Instantly</title>
12+
</head>
13+
<body>
14+
<div id="app"></div>
15+
<script type="module" src="/src/main.tsx"></script>
16+
</body>
17+
</html>

0 commit comments

Comments
 (0)