Sign up Log in
n/program · 1mo ago · 440 views
u/luobikangSilver
n/programu/luobikang · 1mo ago

How elementary school kids can use coding software to build a project well

How elementary school kids can use coding software to build a project well
This post is long, so you might want to bookmark it. If there are any mistakes, experts are welcome to correct me.
Continuing from the programming post on my profile last time,
how to use prompts to build a multi-function blog project.

jules is an experimental AI project from Google. Google released Antigravity (antigravity.google) and Jules almost at the same time.
After November 11, 2026, jules's editing feature will be shut down, and only history will remain.
As someone who took part in the trial, I think jules is much more convenient to use than Antigravity. Antigravity can't be used on Android phones; it only works on a computer that's powered on and connected to the internet. The computer has to be running Windows 10 or later. It supports Apple and Linux systems. This makes it pretty inconvenient for me—it's a real pain. As someone who relies heavily on an Android phone, there's no way I'm going to switch to another computer or device just for one feature.
Okay, back to the point.
A blog project called White Fox. Write the project intro, deployment guide, build instructions, and variables in the repo. Support deployment in various ways and on various platforms, including Tencent Cloud and Alibaba Cloud. CF one-click pull deployment is preferred; for Pages one-click file upload deployment, explain how to get the upload package. A nice-looking UI.
Implement one-click blog bookmarking. Built-in bookshelf and full management features; you can upload local ebooks to the bookshelf. Built-in gallery. Built-in music and video player; you can find and play local files, and also play website files by entering a URL. Implement one-click download by entering a file URL. Built-in website bookmarking feature and section. Built-in search engine and web browsing; you can one-click add websites found in search results to bookmarks. You can bookmark manually entered URLs. You can optionally one-click add locally uploaded bookmark URLs to bookmarks. You can use locally uploaded bookmarks. Can connect to D1 and databases on various platforms to sync bookmarks and browsing history, and sync the gallery and blog. Can connect to R2 and object storage on various platforms for file storage. Built-in cloud drive feature: you can log in to a cloud drive and one-click save files from the site to a specified folder in the cloud drive, and also one-click reference files or URLs from the cloud drive on the site. The admin password is the variable set at deployment. Implement registration; the admin has a one-click switch to allow or disallow registration. Default username and password registration, and state that password recovery is not supported. Support email registration; the admin can set the email address that auto-replies with the verification code during registration.
Start writing the project and save it to the repo.
[Image]

Once you understand how to use prompts, you also need to know how to find project errors.
First, look for them manually: open it up, take a look, and actually use it—that's the best approach. Don't trust AI too much.
Many things have a deep side, and AI programming is no exception. AI can save time and effort, but it's not omnipotent and can't do everything. So for classmates without some programming basics, doing this well is still somewhat difficult. When problems come up and you don't know how to solve them, the best move is still to ask another AI. Of course, it's even better if you can troubleshoot the problem yourself.
First, find the right problem—different errors have different causes. For example, this error: when logging in, it's the same admin, the same project, the same password, but you log into different rooms. In this situation, you don't even know how to ask the question. Is it a data sync problem or an admin account problem?
When asking another AI, you can write:
Please analyze the following code or website. You need to enter or upload it yourself first. Effectively solve the issue where, after binding the database, the same project and same admin password log into different interfaces.

Here's the AI's answer:
Root causes

  1. The sync room key is randomly generated on each device.
    getOrInitSecureSyncKey() generates a random wf-xxxx the first time each browser opens, so each device reads and writes a different site_sync record in D1.

  2. After binding the database, each device's articles, appearance, and config are independent, which looks like "the same password enters a different interface." There's also nowhere in the settings page to change this key.

  3. When there's no session, it defaults to site owner. currentUser initializes to admin when there's no login record, so after logging out and refreshing, or switching to another device, you go straight into the site owner interface.

  4. The admin password is only compared on the frontend. The comparison uses credentials from each device's build or cache, and it even hardcodes whitefox2025, fox, and the site name as fallback account passwords, so login results differ by device.

Changes

  1. Unify the sync room: all devices share whitefox-site-main by default. Old random keys are automatically migrated back to the shared room, and local data is merged with the cloud without loss. You can also set SYNC_ROOM_KEY on the server to force it.

  2. Server-side auth: added functions/api/auth.js and functions/_lib/auth.js. The site owner username and password are verified server-side via the Cloudflare environment variables ADMIN_USERNAME / ADMIN_PASSWORD. After passing, a session token is issued (valid for 30 days; old tokens automatically become invalid after a password change).

  3. Protect writes: writes to /api/sync require a site owner token; reads are still public. After sharing the room, if writes aren't restricted, anyone can overwrite the site data.
    Default identity changed to guest: when the page loads, it checks the token with the server. If the local leftover site owner state has an invalid token, it automatically downgrades to guest.

  4. Remove hardcoded account passwords: login goes through server-side verification only. It falls back to build-time variables only in environments without Functions (like local development).
    Other: sync the version number when pulling cloud data to reduce 409 conflicts when a new device pushes for the first time; AuthModal now submits asynchronously. README and .env.example have been updated.

What to do after upgrading
Set ADMIN_PASSWORD in Cloudflare Pages' Environment variables; it's recommended to also set ADMIN_USERNAME.
Redeploy, and log in to the site owner account again on each device.
If you don't set ADMIN_PASSWORD, login falls back to the frontend build-time variables, and writes to /api/sync won't be protected—same as before the fix. So be sure to set it.

This kind of quick response is basically something a human would find hard to do.
But before fixing things, you need to get the project details right. If you don't get the details right first and just go fix things, you'll likely cause secondary problems. Order matters. It's like renovating a house: you do the masonry first, then the carpentry. When making scrambled eggs with tomatoes, you have to scramble the eggs first.
For example, after finishing the first step of basic framework construction for a blog project, what optimization prompts do you need? As follows: (Each sentence is a fix/optimization instruction. You need to consider the processing capability of the AI you're currently using. You can input several sentences or a paragraph at once. But over 1,000 characters places higher demands on the coding software. Prompts aren't the same for every project—you need to look at your own project's needs, plan it yourself, and decide and modify.)
Prompts
Implement direct binding and R2 in the CF dashboard. After connecting the D1 database and object storage, effectively solve sync issues. Add explanations for the D1 database and R2 object storage to the in-site deployment guide. Database connection and backend database connection should work normally and show status, with status lights. More deployment platform guides, and explain them in the repo. Ensure perfect and effective data sync, including uploaded file list, file thumbnails, files, articles, saved cloud drive data, configured email, interface, and more. Multilingual switching must work. Pages Functions route proxy. Parameterized SQL. Optimistic version locking. Date.now() unified millisecond timestamps. Retry mechanism and status indicator. Password and username set at deployment. Add a browsing history section to the left of blog articles. Records can be deleted and one-click jump. Only admins can use all editing features. Registered users can only manage files they uploaded themselves and cannot delete or modify other users' files or admin settings. Non-users can only browse and view. Perfectly fix normal upload and download of site owner files. Add a one-click feature to select and insert cloud gallery images into blog posts. Implement the ability to change the homepage intro section photo. Implement the ability to change the homepage intro section text. Show the site's total capacity and used capacity in the homepage intro section. Add a file section visible only to admins. Single or batch upload, view, edit, download, and delete files, with rich file support and management features.
Add a detailed usage guide for the cloud drive and multi-cloud scheduling hub. Implement upload and download of local ebooks. Full admin management of ebooks. Media/audio-video options support uploading and playing local media, with full media file management. Files saved by media/audio-video. Blog articles can be downloaded with one click, supporting txt format. Add a batch upload documents option next to upload/add ebook, allowing one-click selection of multiple documents to upload. Implement in-site management of files uploaded to the cloud drive and files referenced from the cloud drive. Upload and download progress bars. Ebook mobile interface supports full-screen viewing without blocking the top of the phone display. The logout button and function work normally. The login and registration panels work normally. Move the layout switch button into the settings section. The header can be opened and collapsed. Custom site-wide background photo and custom site-wide avatar; photos and homepage intro section photos all support local image upload settings. System management options visible only to admins.
Add a theme color and global background customization section. From top to bottom, the section contains these function buttons: theme color button (one-click quick color scheme), custom background color palette, custom avatar, site-wide background photo, homepage intro section photo. All sections can be opened and collapsed. Add one-click switching between mobile and desktop interfaces. Add a registered user management list section (admin only). Add an object storage and cloud drive file management section.
Make Worker's interaction with storage, databases, AI, etc. connect effectively. Implement direct binding of databases and R2 in the CF dashboard.

Translated by AI from 简体中文

3
12
Log into join the discussion.

12 replies

Sort order
  1. azhaoyihao Glory Post King 1mo ago

    That's awesome.

    Translated by AI from 简体中文

    1
  2. zys2013 Gold 3 YEARS 1mo ago

    Are you really a primary school kid? That's wild!

    Translated by AI from 简体中文

    1
  3. loc-yes Diamond Diamond member 1mo ago

    Prodigy

    Translated by AI from 简体中文

    0
  4. ytmm 💬 Gold n/fitness Node owner 1mo ago

    That's amazing

    Translated by AI from 简体中文

    0
  5. Arvin_Leung 🚗 Glory Solved 2 1mo ago

    They’ll go far.

    Translated by AI from 简体中文

    0
  6. seeker Diamond Diamond member 1mo ago

    The future is yours

    Translated by AI from 简体中文

    0
  7. stan95 Gold 3 YEARS 1mo ago

    Nice one 👍🏻

    Translated by AI from 简体中文

    0
  8. Tmuse Diamond 3 YEARS 1mo ago

    A primary school kid — that's insane

    Translated by AI from 简体中文

    0
  9. user94 Filthy rich Diamond 1mo ago

    Holy crap, are you in elementary school?

    Translated by AI from 简体中文

    0
  10. briank Silver 3 YEARS 1mo ago

    That's awesome. Impressive, impressive.

    Translated by AI from 简体中文

    0
  11. sub Silver 1mo ago

    Huh? Even elementary schoolers are big shots now?

    Translated by AI from 简体中文

    0
  12. mingnin Silver 1mo ago

    ?zdjd

    0