Spaces:
Sleeping
Sleeping
Commit ·
6a3e50b
1
Parent(s): 3b74a95
chore: add Dockerfile and Space README
Browse files- .dockerignore +11 -0
- Dockerfile +20 -0
- README.md +46 -3
.dockerignore
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
node_modules
|
| 2 |
+
build
|
| 3 |
+
.svelte-kit
|
| 4 |
+
.data
|
| 5 |
+
.data-*
|
| 6 |
+
.env
|
| 7 |
+
.env.*
|
| 8 |
+
test-results
|
| 9 |
+
playwright-report
|
| 10 |
+
docs
|
| 11 |
+
tests
|
Dockerfile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM node:22-slim AS build
|
| 2 |
+
WORKDIR /app
|
| 3 |
+
COPY package.json package-lock.json ./
|
| 4 |
+
RUN npm ci
|
| 5 |
+
COPY . .
|
| 6 |
+
RUN npm run build && npm prune --omit=dev
|
| 7 |
+
|
| 8 |
+
FROM node:22-slim
|
| 9 |
+
WORKDIR /app
|
| 10 |
+
ENV NODE_ENV=production \
|
| 11 |
+
PORT=7860 \
|
| 12 |
+
HOST=0.0.0.0 \
|
| 13 |
+
STORAGE=hf \
|
| 14 |
+
BODY_SIZE_LIMIT=8M
|
| 15 |
+
COPY --from=build /app/build ./build
|
| 16 |
+
COPY --from=build /app/node_modules ./node_modules
|
| 17 |
+
COPY --from=build /app/package.json ./package.json
|
| 18 |
+
EXPOSE 7860
|
| 19 |
+
USER node
|
| 20 |
+
CMD ["node", "build"]
|
README.md
CHANGED
|
@@ -1,10 +1,53 @@
|
|
| 1 |
---
|
| 2 |
title: Splitwise
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: green
|
| 5 |
-
colorTo:
|
| 6 |
sdk: docker
|
|
|
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: Splitwise
|
| 3 |
+
emoji: 💸
|
| 4 |
colorFrom: green
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
pinned: false
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# Splitwise-style expense splitter
|
| 12 |
+
|
| 13 |
+
Shared expenses for a small group of friends: equal / percent / exact splits, receipt photos,
|
| 14 |
+
balances with simplified debts, settlements, and an admin who manages users.
|
| 15 |
+
|
| 16 |
+
Data lives in a private Hugging Face Storage Bucket as an append-only event log
|
| 17 |
+
(`events/*.json` → hourly compaction into `ledger.jsonl`) plus `users.json`. There is no
|
| 18 |
+
database. See `docs/superpowers/specs/2026-08-29-splitwise-clone-design.md`.
|
| 19 |
+
|
| 20 |
+
## Space configuration
|
| 21 |
+
|
| 22 |
+
Set these in the Space **Settings → Variables and secrets**:
|
| 23 |
+
|
| 24 |
+
| Name | Kind | Value |
|
| 25 |
+
|---|---|---|
|
| 26 |
+
| `HF_TOKEN` | secret | fine-grained token with **write** access to the bucket below |
|
| 27 |
+
| `HF_BUCKET` | variable | `buckets/assafvayner/splitwise-data` |
|
| 28 |
+
| `HF_PREFIX` | variable | directory inside the bucket for this deployment, e.g. `prod` (integration tests use `test/<id>/`); empty = bucket root |
|
| 29 |
+
| `SESSION_SECRET` | secret | `openssl rand -base64 32` |
|
| 30 |
+
| `ORIGIN` | variable | the public URL of the Space, e.g. `https://assafvayner-splitwise.hf.space` (required for form submissions) |
|
| 31 |
+
| `CURRENCY` | variable | ISO code, default `USD` |
|
| 32 |
+
| `COMPACTION_INTERVAL_MS` | variable | default `3600000` (1 hour) |
|
| 33 |
+
|
| 34 |
+
First boot creates the `admin` user with password `1234`; the first admin login forces a password change.
|
| 35 |
+
Then create your friends' accounts on `/admin`.
|
| 36 |
+
|
| 37 |
+
## Local development
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
cp .env.example .env # STORAGE=local writes to .data/
|
| 41 |
+
npm install
|
| 42 |
+
npm run dev
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
`npm test` runs unit tests; `npm run test:e2e` runs the Playwright smoke test against a production build;
|
| 46 |
+
`npm run test:integration` runs the real-bucket tests under a throwaway `test/<id>/` prefix (needs `HF_TOKEN`/`HF_BUCKET` in `.env`; skipped otherwise).
|
| 47 |
+
|
| 48 |
+
## Deploy
|
| 49 |
+
|
| 50 |
+
```bash
|
| 51 |
+
git remote add space https://huggingface.co/spaces/assafvayner/splitwise
|
| 52 |
+
git push space main
|
| 53 |
+
```
|