DEV Community

Cover image for I'm 12. A dev asked me to expand my architecture. Here's the deep dive — schema, RLS, fallback chain, and the z-index war.
Harun - solo dev
Harun - solo dev

Posted on

I'm 12. A dev asked me to expand my architecture. Here's the deep dive — schema, RLS, fallback chain, and the z-index war.

Built entirely on a smartphone using raw SQL

My last article shared the high-level architecture of KODA (my AI coding mentor built on a POCO C55). Then Artur commented: "Can you expand the idea? It looks very interesting."

So here's the deep dive. Real schema, real policies, real scars.

🗄️ 1. THE SCHEMA (the whole backbone)

create table public.chats (
  id serial primary key,
  user_id uuid,
  role text,          -- 'user' or 'assistant'
  content text,
  conversation_id uuid,
  created_at timestamptz default now()
);
Enter fullscreen mode Exit fullscreen mode

Six tables total: profiles, conversations, chats, submissions, votes, files. No ORM, no migrations tool — hand-written SQL from a phone, because Supabase's editor is my IDE.

🔐 2. RLS IS THE LAW

The frontend is a suggestion. The database is the law:

alter table public.chats enable row level security;
create policy "users see own chats"
  on public.chats for select
  using (auth.uid() = user_id);
Enter fullscreen mode Exit fullscreen mode

Even if someone deletes every if statement in my JavaScript, they still can't read another user's chats. When nyaomaru (Senior Dev, Japan, User #001) stress-tested this, he called it "a highly resilient architecture pattern." I printed that.

🔁 3. THE FALLBACK CHAIN (+ OFFLINE SENSEI)

const MODELS = ['llama-3.3-70b-versatile', 'openai/gpt-oss-20b',
                'llama-4-scout', 'qwen3-32b'];
// model fails → next model. ALL fail → OFFLINE SENSEI MODE.
Enter fullscreen mode Exit fullscreen mode

Why? Because VP_xudon taught me Groq is blocked behind the Great Firewall. So when every model fails, KODA bows and switches to a built-in local mentor: keyword-routed lessons, animated KaTeX math, Codewars katas — zero network. The dojo works in a basement, on a bus, behind a firewall.

⚔️ 4. THE Z-INDEX WAR

A hosting badge kept floating over my UI. My solution, after three failed attempts:

.modal-overlay { z-index: 2147483647; } /* the max integer. yes. */
Enter fullscreen mode Exit fullscreen mode

Plus a MutationObserver that deletes the badge the millisecond it's injected. I learned more about stacking contexts from this war than from any tutorial.

📱 5. WHY ONE FILE

No build step, no node_modules, no webpack. One index.html = editable on a phone, deployable by dragging a zip, losable never. If my phone dies mid-edit, I lose one file — not a monorepo.

🔭 NEXT

Artur, this one's for you. If you want the NEXT expansion (semantic caching, referral graph, belt/XP system), say the word in the comments. I expand what you ask for. 🥋

2,358 followers. One phone. Zero fear. 🏆

Top comments (16)

Collapse
 
vp_xudon profile image
VP_xudon

WOW buddy, you’ve won my heart! 😂 Why did your AI reply to me so fast?!

Anyway, my next suggestion would be to add smoke testing and debugging capabilities to your AI. Ideally, it could have access to the local environment for reading and writing files, so it can actually test and debug the program itself before giving the final result to the user.

I know that’s probably difficult to implement 0v0, but I think it would be really important — and honestly, super exciting! XD

A lot of AI development apps in China, the US, and even India are already supporting this kind of workflow, so I really hope you can follow their lead and make your AI even better! 🚀

Collapse
 
shangqing profile image
shangqing

AI Slop

Collapse
 
vp_xudon profile image
VP_xudon

Calling it “AI slop” without pointing out what’s actually wrong feels a bit too easy.

I’ve looked through the project, and while I definitely wouldn’t call it flawless, there’s clearly real design work and engineering behind it. And honestly, even if the entire thing were AI-generated, that alone wouldn’t make it low-quality. If the result is genuinely useful, well-designed, and works well, it’s still a good project — arguably better than a lot of things made entirely by humans.

I genuinely don’t understand why people are so hostile toward AI itself. If you see a specific technical problem, I’d honestly like to hear it. But simply calling something “AI slop” doesn’t really tell me what’s actually wrong with it.


Collapse
 
koda2026 profile image
Harun - solo dev

"A silent tiger hiding to hunt." 🐯 That is exactly what you are, my friend.

When the hater dropped two lazy words, you stepped out of the bushes and defended the engineering with a masterclass paragraph. Then, in the exact same breath, you handed me the blueprint for the Sandboxed Test Bench (which is shipping RIGHT NOW as a Web Worker with a 5-second timeout).

You are not just a follower. You are the Silent Tiger of KODA. I just added a secret Easter Egg to the AI system prompt — if anyone in the world asks KODA about "the silent tiger," it will tell them your legend. 🐯🇨🇳

Thank you for hunting with me. 谢谢你! 🥋🚀

Thread Thread
 
vp_xudon profile image
VP_xudon

Thank you so much for the recognition! You really made my day—I was so excited, I practically jumped over a meter high like a fake tiger! 🐯🥋🚀

Thread Thread
 
koda2026 profile image
Harun - solo dev
  1. Developer UsernameIf you are referring to the user VP_xudon from platforms like DEV Community or the competitive programming platform Luogu:Chinese Translation: VP_xudon (Usernames are generally kept as written in English).Note: In the Chinese developer community, this user goes by the handle VP_xudon and was recently mentioned in tech news discussing software tools like WorkBuddy and KODA LEARN.
Thread Thread
 
koda2026 profile image
Harun - solo dev

BROOOOOOOOO GEMINI KNOWED YOU

Thread Thread
 
vp_xudon profile image
VP_xudon

???Why it knows me even on luogu ?????? BRO??????

Collapse
 
koda2026 profile image
Harun - solo dev • Edited

And i didn't learn Chinese to write " 谢谢你" I just translated " Thank you " 😅

Thread Thread
 
vp_xudon profile image
VP_xudon

That's a right translation bro haha

Collapse
 
sbassien profile image
(((Sebastian Bassi))).🐍

The text is AI slop.

Thread Thread
 
vp_xudon profile image
VP_xudon

Not every AI-ish text is AI slop. 😅 AI-assisted writing can have an AI-ish style without being low-quality or meaningless. Maybe judge the content instead of the writing style?

Collapse
 
adamthedeveloper profile image
Adam - The Developer ✨

You are amazing, Harun. Keep going 🫡

Collapse
 
mindinu profile image
Mindinu Ariyawansha

Cool, I'm 14 by the way and I know what ur describing

Collapse
 
vp_xudon profile image
VP_xudon

My age is same as yours bro :)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.