Week 002 — From Zero to Items
The first feature went from nothing to working this week. It wasn't pretty, but it foundation, learning, product, ai
Week of October 7, 2024
Progress
Created the items table, got PHP talking to the database via PDO, and built a basic form that saves an item — name, picture, owner ID, date added — to both the filesystem and the database. Mobile image capture turned out to be surprisingly easy: the browser just asks whether you want the camera or the photo library. No special code required.
Also cleaned up the dev setup along the way: moved database connection info into a shared dbconfig.php, started using .gitignore properly, and got more comfortable with VI and tmux for working directly on the server.
Getting the initial form and API structure off the ground leaned on Grok for scaffolding. Having working boilerplate to modify moved faster than starting from scratch — and it was the first indication that AI tools were going to be part of how this project got built.
Getting the initial form and API structure off the ground leaned on Grok for scaffolding. Having working boilerplate to modify moved faster than starting from scratch — and it was the first indication that AI tools were going to be part of how this project got built.
The Hard Part
Images were the main challenge. Getting from "file selected in a form" to "image stored on the server with a stable, retrievable path" involved more moving parts than expected: naming strategy, storage location, file type validation, and making sure the path saved to the database actually matched where the file landed.
The naming problem led to building a UUID function — a small utility that ended up getting reused throughout the codebase for more than just image names.
One unexpected observation: Safari shows a thumbnail preview when you select an image file. Chrome and Firefox don't. No code change was made for this, but it was the first hint that browser behavior differences were going to be a recurring theme.
error_log() became a key tool this week. It doesn't halt execution (I wasn't sure at first), and tailing the Apache error log is the fastest way to see what's actually going wrong on the server side.
Decision Made
Store all uploads in a flat /uploads/ directory for now, named by UUID. Per-user folders are the cleaner long-term approach — makes account deletion cleanup obvious — but the added complexity isn't worth it at this stage.
The Question That Appeared
A product question surfaced during image work that had nothing to do with images: if a user already has a physical QR code sticker from a starter pack, their item needs a pre-defined ID, not a generated one. If they don't have a sticker, an ID gets generated. How do these two paths coexist in the same system? No answer yet — just filed it away.
Next Week
Items can be created. Now they need to be listed, edited, and deleted.
