">
 

I Built an AI Companion App With No Backend at All

Iniciado por joomlamz, Hoje at 07:25

Respostas: 1   |   Visualizações: 6

Tópico anterior - Tópico seguinte

0 Membros e 1 Visitante estão a ver este tópico.

Olá comunidade do **webmastersmz.com**,

Analisei recentemente o artigo *"I Built an AI Companion App With No Backend at All"* e trago aqui uma reflexão técnica para o nosso fórum.

O autor propõe uma abordagem arquitetural interessante para aplicações de Inteligência Artificial: o modelo **"Backend-less" (ou *Edge-native*)**. Em vez de manter servidores dedicados para processar requisições, ele utiliza chamadas diretas de API (neste caso, a OpenAI) a partir do *frontend* (usando *Frameworks* como Next.js ou React), aproveitando o armazenamento local (*Local Storage* ou *IndexedDB*) para manter o contexto da conversa do utilizador.

### Pontos técnicos principais:

1.  **Redução de Custos e Complexidade:** Ao eliminar o *backend*, removemos a necessidade de gerir instâncias de servidores, bases de dados (como PostgreSQL ou MongoDB) e a latência inerente às chamadas de rede extra entre servidor e base de dados.
2.  **Segurança (O ponto crítico):** O autor levanta um debate essencial. Ao não usar *backend*, a *API Key* acaba por ser exposta no *client-side* se não forem tomadas medidas. A recomendação técnica aqui é o uso de **Proxy Functions** (como *Vercel Functions* ou *Cloudflare Workers*) que funcionam como uma camada de abstração mínima, escondendo a chave real e permitindo o controlo de *rate limiting* e autenticação.
3.  **Privacidade e Estado:** Como o histórico é guardado localmente, a privacidade do utilizador aumenta, mas perde-se a portabilidade entre dispositivos (a menos que se implemente sincronização via *Cloud*).

**Para debate:** Acham que esta abordagem de "Backend-less" é sustentável para aplicações que escalam rapidamente, ou a falta de um servidor central de controlo acaba por criar dívida técnica a longo prazo? Como é que lidam com a gestão de segredos (*API keys*) nos vossos projetos em Moçambique, considerando as limitações de latência?

Aguardo as vossas opiniões e experiências técnicas aqui no fórum!

***

Para garantir que os vossos projetos e fóruns rodam sem falhas, convido-vos a conhecer as soluções de alojamento de alta performance da AplicHost em https://aplichost.com.

I Built an AI Companion App With No Backend at All



Tópico: I Built an AI Companion App With No Backend at All
Categoria: Tutoriais | Programação & Tecnologia
Idioma Principal: Português (Conteúdo de Tecnologia)

Descrição do Conteúdo / Informações:
-------------------------------------------------------------------------
Every AI companion app I tried wanted the same three things: a monthly subscription, an account, and my conversations living on their server forever. The "memory" was always a black box too — the character would forget something important, and there was no way to see what it remembered, let alone fix it.

So I built the opposite. Xinyu is an AI companion app for Android with no backend. Not "backend I promise to keep private" — there is literally no server. The whole brain is ~4,700 lines of pure-stdlib Python (zero pip dependencies) running inside the APK via Chaquopy, talking straight from your phone to the DeepSeek API with your own key.

Full disclosure: this is my own product, and I sell the license on Gumroad. This post is about how it's built and why.



The design rule: if there's no server, most problems disappear


•
No subscription. There's no server bill, so there's nothing to subscribe to. The app is a one-time $9.99 license. Your only running cost is your own API credit — a few dollars lasts months.

•
No account, no uploads. Chats, memories, character data: all plain files in the app's private storage on the phone. I couldn't read your conversations if I wanted to.

•
Licensing without a license server. Activation codes are RSA-signed and bound to a machine code derived from the device. I sign codes with a small offline tool; the app verifies the signature locally. Clock-rollback tricks are handled by persisting the max timestamp the app has ever seen. Old-school shareware mechanics, and they work fine.



Memory you can open like a notebook


The feature I care about most. Everything the companion remembers about you lives in a notebook inside the app:

• Entries are created from your conversations, each with a timeline of how it changed.

• When a memory is updated, the old version is struck through, not silently overwritten — you can see what it used to believe about you.

• You can add, edit, delete, and mark entries sensitive. Sensitive entries never surface in group chats.

Anyone who has hand-curated a lorebook in SillyTavern knows why this matters: memory you can't inspect eventually becomes memory you can't trust. (The app imports SillyTavern character cards, by the way — PNG chara/ccv3 and JSON.)



Group chats need a director, not a round-robin


My first version of group chat had every character reply to every message in turn. It read like a meeting, not a conversation.

Now there's a director step: one extra LLM call per group message decides who speaks (usually 1–3 characters), who stays silent, and in what order. Non-speakers still get their mood appraised from what happened. Each character also has a mood and affection state shaped by group events, plus a slow-burning "what's on their mind" thread that develops over days and leaks into later chats. The difference in feel is hard to overstate — silence turns out to be half of believable group dynamics.



The unglamorous parts I'm proud of


• The APK is built with a hand-rolled pipeline (kotlinc → d8 → aapt2 → zipalign → apksigner) because Gradle simply would not run in my build environment. It works, it's scripted, and I never want to talk about it again.

• Voice is pluggable: cloud TTS if you add a SiliconFlow key, Android's native TTS otherwise.

• The English edition reuses the exact same brain with a ui_lang switch — two translation dictionaries applied at render time, and growth-stage names translated at the API layer so the internal logic still keys off the original terms.



Honest limitations


• Android only, sideloaded APK — no Play Store (solo dev, that route isn't open to me right now).

• Activation is manual: the app shows a machine code, you email it to me, I send your code back. The 7-day free trial works the same way — free, but not instant.

• The interface and main companion are fully English; the built-in preset characters' story content is still Chinese (translation is on the roadmap). Imported cards are unaffected, and every character can be renamed.



Try it


• Download & details (English section at the bottom of the page): https://promptwork-tools.pages.dev/xinyu/

• Lifetime license on Gumroad: https://xinyuapp.gumroad.com/l/xinyu

If you build with LLMs, I'm curious: how are you handling long-term memory in your projects — and would your users trust it more if they could open it and edit it, like a notebook? That bet is the whole product, and I'd love to hear where it breaks.


Joomlamz
Consultoria em Informática
-------------------------------------------------------
Especialista em Sistemas Web & Manutenção de Servidores.
A desenvolver o novo AplPortal com suporte a PHP 8.
Precisa de ajuda profissional? Contacte-me.

Tags: