64 lines
1.5 KiB
Markdown
64 lines
1.5 KiB
Markdown
# Apple Form
|
|
|
|
Apple-style 3-field step-by-step customer form with FastAPI backend.
|
|
|
|
## Frontend
|
|
|
|
Single-file HTML (`index.html`) — zero dependencies, native system fonts.
|
|
|
|
- 3-step wizard: Email → Name → Domain
|
|
- Apple design system: `#f5f5f7` backgrounds, Apple Blue `#0071e3` accent, SF Pro typography
|
|
- Slide animations between steps, step-dot progress indicator
|
|
- SVG checkmark draw animation on success
|
|
- POSTs to the backend at `http://192.168.1.121:8080/api/submit`
|
|
|
|
### Open directly
|
|
|
|
```bash
|
|
firefox index.html
|
|
```
|
|
|
|
Or serve from an HTTP server:
|
|
|
|
```bash
|
|
python3 -m http.server 8000
|
|
```
|
|
|
|
## Backend
|
|
|
|
FastAPI server in a Proxmox LXC CT:
|
|
|
|
| Detail | Value |
|
|
|---|---|
|
|
| CT ID | 121 |
|
|
| Hostname | form-login |
|
|
| IP | 192.168.1.121 |
|
|
| Port | 8080 |
|
|
| Database | SQLite (`/srv/form-backend/submissions.db`) |
|
|
| Service | `form-backend.service` (enabled, auto-start) |
|
|
|
|
### Endpoints
|
|
|
|
| Method | Path | Description |
|
|
|---|---|---|
|
|
| POST | `/api/submit` | Submit form data `{email, name, domain}` → `{ok, id}` |
|
|
| GET | `/api/submissions` | List all submissions (JSON) |
|
|
| GET | `/health` | Health check |
|
|
|
|
### Test
|
|
|
|
```bash
|
|
curl http://192.168.1.121:8080/health
|
|
curl -X POST http://192.168.1.121:8080/api/submit \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{"email":"jane@example.com","name":"Jane","domain":"example.io"}'
|
|
```
|
|
|
|
### Server code
|
|
|
|
`server.py` lives at `/srv/form-backend/server.py` on the CT.
|
|
|
|
```bash
|
|
ssh root@192.168.1.109 'pct exec 121 -- systemctl status form-backend'
|
|
```
|