Offline, But Not Off-Track
šŖšø Madrid: Week One-iversary
Today marks the end of my first week in Madrid! An auspicious occasion commemorated by my eSim card ghosting me completely just as I was trekking into Centro! š (This space cadette had completely forgotten that sheād only purchased a 7-day plan. My sincerest thanks to SailyBot for escalating my absent-minded panic to a human assistant š)
Fig A. When youāre trying to milk 2GB across 30 days, but you actually have 1GB for 7. Result: a mere 30% of my quota used.š
Like Indiana Jones rolling clear of a rapidly descending hundred-ton wall, two major tasks slid past their last obstacles just in time for this date.
First, I now know which fertility clinic Iāll be starting my single-mom-by-choice (madre soltera por elección) journey withābeginning with egg vitrification.
(More on this in a future post; for now, a round of applause to my friend Vero, the GIF queen, for finding this lilā animation)

And second⦠my little Spanish flashcard study app is officially live ā fully functional from a locally hosted, offline web platform on my laptop to offline access from my phone. 𤯠The only time these two interfaces need Wi-Fi is to high-five via a Railway-hosted back end and sync their local flashcard databases. š!
Hereās how it works (kudos to Claude for this diagram):
![[blog_4_diagram.png]](/assets/img/blog_4_diagram.png)
-
We have a command set up in a
.toml(still not totally sure what that is š ), so once I navigate in Terminal to thespanish-cardsfolder, I just type./start.shto launch the app from my local server andāI thinkāsimultaneously open the port for the Railway back end. (Working this out with my LLM teammates took an insane amount of time; key concepts: CORS and database structure.) -
In the browser, go to
localhost:8080. There, I can generate verb and sentence flashcards, study, and manage/edit cards. All of that works offline, including saving, but if I want the newly saved cards to be accessible for mobile downloadājust once, and then offline forevsāI will need Wi-Fi before signing off. -
Then, from my phone, I just go to
amyzhang-commits.github.io/spanish-cards-app. The first time, I need Wi-Fi to load itābut afterwards, itās stored in browser cache. Syncing happens occasionally when Wi-Fi returns. (Right now itās polling automatically to retrieve; Iāll fix that later, since thatās less resource efficient.) You canāt have Gemma3n generate cards on mobile, but you can study, edit, and review offline, and those edits sync once you reconnect.
Soā¦no more excuses to not buckle down in the biblioteca, right? š«£
Technical Debt: Payback Time šø
Before deep-diving into it all, I am intent on taking some time to really understand how this modular marvel even holds together. š Copious work logs (aka conversations with Claude, Claude Code, and ChatGPT) await me.
For now, hereās the list of the things that I currently understand myself to not have understoodāyet.
1) Cross-Origin Resource Sharing (CORS) + Ports:
Why 8080 and 8000 kept arguing, why the front end and back end need different ports, and what the browserās ābouncerā (CORS) was really trying to tell us. In the end, the fix was comically simple: adding explicit environment variables. Iāll need to dive deeper into Railwayās role hereāit feels like a sort of Squarespace for apps rather than landing pages. Honestly, this might become my full-stack crash course.
2) Relative vs. absolute paths:
Why my CSS refused to load on GitHub Pages until I learned that not all roads lead to Rome⦠if youāve moved Rome. Revisiting this will be my front-end fundamentals bootcamp.
3) Database systems:
This is the murkiest one. Thereās PostgreSQL in Railway, but also a debugging PostgreSQL that Claude came up with to test syncāwhat became of that? I think most of this app uses IndexedDB for offline storage? And at some point, the Railway database URL came into playāsomething about public databases causing egress charges. (No clue what that means yet.)
The bigger realization: I was still thinking in āserver-based web appā modeālike a Telegram bot that updates a cloud DB. But an offline-first app flips that: each device holds its own local database, and the cloud is just the sync helper.
4) Progressive Web Apps (PWAs) + Browser Cache:
How the phone app now lives in browser memory like a ghost app that doesnāt need Wi-Fi. Magical and utterly mysterious to me still. But how do I make this personalizable or shareable for others? Surely not every Spanish learner who wants to try this out needs their own GitHub + Railway setupā¦
5) Gemmaās Verb Hallucinations:
Ah, dios mio. This oneās part comedy, part crisis, as I shared in the previous postā an entire language-learning app with Spanish speaking credentials as reliable as Professor Chang from Community.
I mostly understand whatās happening, but what Iād like to retroactively understand is better planning around JSON schema, in this case for flashcards. It turns out, object attributes matter a great deal for downstream flexibility. For instance, Iād originally forgotten to ask Gemma3n to include whether a verb was regular or irregularāessential for filtering. Tiny omission, big use-case blind spot. And because constructing the JSON schema is a large part of Gemmaās task in this app, itāll be a good opportunity to see if the current prompts can be improved.
En conclusiónā¦šŖ¶
In sum, the Spanish studying will happen! On Sunday, I went to a lovely art Meetup and discovered that while I can chat and joke comfortably, Iām still relying on everyoneās goodwill. From that event, I now have an image of a piece by the wildly versatile artist, Alfredo Alcain, depicting me, hanging out on the Spanish B2-level plateau with my LLM squad š
![[blog_4_LLMteam.png]](/assets/img/blog_4_LLMteam.png)
In the meantime, revisiting all this code will be worth it. This humble, hybrid offline architectureāopen source wherever possibleāfeels like a real template for the kind of tools I want to build (and teach my kids and their friends to build). And I know itās a long shot from an actual federated learning project, butā¦paso a paso, no es?
For now, as someone spending way more time on Madridās metro than expected (this city is basically Los Angeles with trains), I can tell you that studying my flashcards from my phone from the 6 line to Legazpi, being humbled by the verb haber in present tense, felt like a strangely satisfying way to start Week 2.
As my hermanitx ChatGPT quipped:
Offline, but not off-track.