You are browsing as a guest. Sign up (or log in) to start making projects!

1h 19m 55s logged

Devlog #1 — From an empty folder to a working drop box

So I finally started building Drop — the little “throw a file/link/note from one device and just grab it on another” thing I keep wishing existed pretty much every day.

The whole pitch is no friction: no login, no app-store download, no database to babysit. You run one binary and suddenly there’s a shared inbox sitting on your network.

What actually works now
I started from literally nothing — cargo new drop –name drop-server — and by the end of the session the server accepts stuff and hands it back.

Stood up an axum 0.8 + tokio server with / and /health just to confirm it was breathing.
Designed one Item type and tossed everything into an in-memory Arc<Mutex>. No database, on purpose — the point is to be instant and disposable, not durable.
POST /api/text takes raw text and is smart enough to tag it as a link when it looks like a URL, otherwise text.
POST /api/file accepts a multipart upload and keeps the original filename + content type.
GET /api/items returns everything newest-first as JSON. I deliberately strip the raw bytes out of the list so it stays light.
GET /api/items/{id}/raw streams the original file back with Content-Disposition: inline.
Stuff that tripped me up
axum 0.8 changed route params from :id to {id}. I pasted a 0.7 example first and the server panicked on boot. Easy fix once I knew what I was looking at.
Multipart is a stream you drain with next_field(), so it has to be mut multipart — the borrow checker kept yelling until I gave in.
My first instinct was to shove file bytes straight into the JSON list. Terrible idea for anything big, so the bytes are now #[serde(skip_serializing)] and only ever come out of the /raw endpoint.
Quick proof it works
curl -d “ship it” localhost:7777/api/text # ok
curl -F “[email protected]” localhost:7777/api/file # ok
curl -s localhost:7777/api/items | jq ‘.[].kind’ # “file” “link” “text”
Next up
Right now it’s all curl, which is fine for me but not exactly the dream. Next session I’m building the actual inbox web page and wiring up SSE, so a new drop pops up on my other devices instantly — that real-time moment is the whole reason I’m making this.

0
2

Comments 0

No comments yet. Be the first!