Sub topic 2
Building the Screens
Assume you understand pages, forms, accounts, and basic web requests. This chapter focuses on turning one core user flow into screens, logic, integrations, and safe access rules.
Design screens around actions
Start with the smallest screen set that supports the flow. For a task tracker, this might be:
| Screen | Main action | Data needed |
|---|---|---|
| Task list | View and complete tasks | title, client, due date, status |
| Create task | Save a new task | title, client, due date |
Keep each screen focused. A form should validate required fields, show useful errors, and confirm successful saves. Design empty, loading, and failure states before adding visual polish.
Add workflows and logic
A workflow connects an event to an outcome. For example, submitting the form should:
- Check that the title is present.
- Attach the signed-in user as the owner.
- Save the task with status
todo. - Return the user to the task list.
Keep business rules in one place. Do not rely only on a button being hidden. The server or database must reject invalid status values and unauthorized updates.
Prompt an AI app builder
Give the builder structured requirements instead of a broad request. Name the users, core flow, fields, access rules, and exclusions.
Build TaskNest for signed-in freelancers.
Create a task with title, client name, and due date.
Show each user only their own tasks.
Allow status values todo, doing, and done.
Include loading, empty, validation, and error states.
Do not add teams, uploads, payments, or notifications.Review generated output
Test every user path, including refreshing after a save, submitting blank fields, opening another user's URL, and using a second account. Compare the generated data model and queries with your requirements. Correct missing ownership checks before improving layout.
> callout note > Treat generated code as a draft. Inspect permissions, validation, error handling, and stored data rather than trusting the interface.
Connect services safely
Use an integration for a prepared connection, an API for direct requests, and a webhook for event delivery to your app. Verify webhook signatures against the raw request body before processing an event. Store API keys in environment settings, never in browser code.
Add accounts and access control
Authentication proves who a user is. Authorization decides what that user may do. Enforce authorization at the database or server boundary. A task query should filter by the current user's identity, and an update should check ownership again.
Exercise
Why is hiding another user's task in the interface insufficient?
Show answer
A user can bypass the interface and send a direct request, so the server or database must enforce ownership.