# TrueTake

**Across every app you get paid on — do you actually owe the IRS right now?**

Most side-hustle finance tools are a receipt tracker with an AI summary bolted on.
TrueTake is built around one specific, current, under-known fact: **self-employment
tax kicks in at just $400 of net side-hustle income — even if your regular income
tax owed is $0** because you're under the standard deduction. No platform withholds
it, no 1099 form is required for it to be legally owed, and almost no teen (or
parent) knows the threshold is that low.

The numbers are computed by a small deterministic rules engine (`rules.js`), not
by the LLM — Gemini's job is only to (1) turn a messy photo of a receipt/payment
screenshot into structured line items, and (2) explain the already-computed
numbers in plain English / answer follow-ups. This keeps the compliance-critical
math exactly right regardless of what the model is prompted to say, and is the
core "why AI, why here" architecture decision for the pitch.

There's also an optional third AI call: a "verify these numbers are still
current" button that cross-checks the hardcoded rules against a live, cited web
search (You.com's Research API) rather than asking users to just trust hardcoded
constants. Nice bonus for the "potential/execution" judging criteria, and not on
the critical path if you skip setting up that key.

## Sources for the 2025 figures in `rules.js`

- Self-employment tax: 15.3% (12.4% Social Security + 2.9% Medicare) on 92.35% of
  net self-employment earnings once those earnings reach $400 — IRS Schedule SE.
- Dependent standard deduction 2025: greater of $1,350 or (earned income + $450),
  capped at $15,750 (the regular single-filer standard deduction) — Rev. Proc. 2024-40.
- Unearned income filing threshold: $1,350. Kiddie tax threshold: $2,700 — see
  [Kiplinger, "Tax Filing Requirements for Minors"](https://www.kiplinger.com/taxes/does-your-child-need-to-file-a-tax-return).
- 1099-K threshold: reset to $20,000 + 200 transactions for 2025 and beyond after
  Section 70432 of the One Big Beautiful Bill Act (signed 2025-07-04) repealed the
  planned phase-down to $600. This is why the app does **not** scare users about
  surprise 1099-Ks — that threat mostly went away.
- Platform fee estimates (Etsy, Depop, eBay, Poshmark, Venmo goods & services) are
  approximate defaults for the "true hourly wage" calculator — they drift, so treat
  them as editable, not authoritative.

**This app gives educational estimates, not tax advice.** It says so in the UI.
For anything specific, point users to a parent/guardian, a real tax professional,
or [IRS Free File](https://www.irs.gov/filing/irs-free-file-do-your-taxes-for-free).

## Architecture (100% free tier)

```
Browser (Cloudflare Pages, static)
  index.html / style.css / app.js / rules.js
        |
        |  fetch() to three endpoints
        v
Cloudflare Worker (free tier, 100k req/day)
  worker/worker.js  — holds API keys as secrets, never sent to the browser
        |                                    |
        v                                    v
Google Gemini API                    You.com Research API
  (gemini-2.5-flash — free tier,       (optional — powers the
  extraction + explaining)              "verify sources" button)
```

No database. All entries persist in the browser's `localStorage`. No server bill,
ever, at hackathon-demo scale.

## Deploy it yourself (free)

### 1. Get a Gemini API key (required)
Go to [aistudio.google.com/apikey](https://aistudio.google.com/apikey) and create
a key — no credit card needed. It looks like `AIzaSy...`. `gemini-2.5-flash` has a
free-tier quota (roughly 250 requests/day, 10/minute as of mid-2026) that's plenty
for a demo.

### 1b. (Optional) Get a You.com API key
If you have a You.com key (`ydc-sk-...`), it powers the bonus "verify sources"
button. Skip this and that one button will just show a friendly "not configured"
message — extraction/explaining work fine without it.

### 2. Deploy the Worker
```bash
cd worker
npx wrangler login
npx wrangler deploy
npx wrangler secret put GEMINI_API_KEY   # paste your AIzaSy... key when prompted
npx wrangler secret put YDC_API_KEY      # optional — paste your ydc-sk-... key
```
Wrangler will print your Worker URL, e.g. `https://truetake-api.<you>.workers.dev`.

### 3. Point the frontend at your Worker
Edit `app.js` — set `WORKER_URL` at the top of the file to the URL from step 2.

### 4. Deploy the static site
Easiest path with a Cloudflare account already set up:
```bash
cd ..
npx wrangler pages deploy . --project-name=truetake
```
Or drag-and-drop the `truetake/` folder in the Cloudflare dashboard under
Workers & Pages → Create → Pages → Direct Upload. Netlify/GitHub Pages work too —
it's a static folder, no build step.

### 5. Test locally before deploying (optional)
```bash
npx serve .
```
then open the printed localhost URL. Chat/photo features need `WORKER_URL`
pointed at a deployed (or `wrangler dev`-run) Worker to respond.

## What's intentionally out of scope for the demo

- Only federal rules are modeled — no state tax.
- Entered amounts are treated as net self-employment income (the app doesn't
  separately track deductible business expenses beyond the wage calculator's
  materials-cost field).
- Platform fee percentages are approximate defaults, editable by design.
