Fullstack · learning demo
Order Returns Manager
A fullstack demo to explore specification-driven development with Codex and GitHub Spec Kit. Fictional order returns provide a concrete setting for examining business rules, data consistency and independent visitor environments.
The demo in action
Why build it?
I already use AI agents in my development workflow. After completing Platzi’s Spec-Driven Development course, I decided to put its concepts into practice by building a functional demo from scratch.
My goal was to examine how SDD could complement that workflow: which ambiguities it helps surface, how it organizes decisions and where engineering judgment remains necessary.
An order-return flow offered concrete rules, competing operations and two simulated roles to explore. The experiment focused on the development process and its lessons, rather than creating a commercial returns platform.
The engineering question
How can specifications bring more structure to development with AI agents?
What I set out to explore
- Keep requirements, clarifications and decisions versioned alongside the implementation.
- Plan and validate the work progressively through ordered tasks.
- Deliver a usable fullstack flow with consistent data and independent visitor demos.
What I built
The demo manages full and partial returns against fictional e-commerce orders. Ten technology products, sample customers, orders and return histories provide a starting point for exploration. No real payments, refunds or logistics are performed.
Orders and return requests
Browse purchases, request full or partial returns, check eligibility and available quantities, cancel pending requests and follow status and history.
Administrative review
Approve or reject requests, confirm simulated receipt and configure the return window for new requests.
Independent visitor environments
Each browser context receives its own logical environment. Visitors can explore and reset their fictional data without resetting another visitor’s demo.
Decisions and tradeoffs
Independent demos without real accounts
Several visitors needed to use and reset the public demo without interfering with each other, while keeping real authentication outside its scope.
The server resolves an anonymous capability cookie and scopes PostgreSQL data by environment and generation. A short environment-row lock serializes related operations. Reset recreates the fictional data atomically and advances the generation, fencing writes from older tabs.
Alternatives considered
- Per-item locking could allow more parallel work within a demo, but requires more lock-order discipline.
- Serializable transactions with bounded retries were another option; one environment lock offered a simpler consistency model for this small demo.
Tradeoffs
- Operations within one environment wait on the same lock; this favors consistency and simplicity over within-demo throughput.
- Tabs in one browser context share an environment. Losing its cookies loses continuity; cross-device recovery is not provided.
- The cookie identifies a demo, not a verified person. Customer and administrator views are simulated roles.
My participation and AI assistance
I developed this personal learning project with Codex and GitHub Spec Kit, framing the objective and evaluating the resulting engineering choices.
Codex assisted development through a Spec Kit workflow: specification, clarification, planning, task decomposition, implementation and validation.
I retained responsibility for defining constraints, evaluating alternatives, reviewing the work and validating behavior. AI assistance did not replace that judgment.
Engineering in practice
APIs and business rules
Typed HTTP contracts and Zod validation enforce quantities, eligibility and allowed state transitions on the server, beyond the interface controls.
Relational modeling and consistency
Prisma and PostgreSQL constraints associate records with the same environment and generation. State, requested units, history and operation receipts commit together.
Concurrency and automated validation
Tests exercise competing requests for the last available unit, conflicting decisions, retries and resets. This connects the transaction strategy to explicit invariants.
Responsive interaction design
Customer and administrator views share a responsive workspace, keyboard-accessible dialogs, contextual feedback and light/dark appearance.
Results and learning
A functional demo supports the complete fictional return lifecycle, from request through administrative review and simulated receipt.
Specifications, research, plans, tasks and validation records remain in the repository, making the reasoning available beyond a conversation history.
Challenges encountered
- Keeping quantity availability, state and history consistent across retries, competing actions and resets required explicit transaction and generation rules.
- Validation records needed to distinguish the initial local baseline, later interface checks and public release evidence as the project evolved.
What I learned
- Specifications and decisions can live alongside the project instead of depending exclusively on an AI conversation history.
- Clarification helps identify ambiguities, constraints and decisions worth resolving before implementation.
- An ordered task plan supports progressive implementation and validation instead of attempting the entire solution in one pass.
- Defining the need and its constraints leaves room to evaluate technical alternatives without prescribing every implementation detail.
- Engineering judgment remains essential to frame problems, evaluate solutions and validate results. These are lessons from this experience, not evidence that SDD is universally superior.
Validation and its scope
The initial local record reports 99 passing automated cases: 23 unit, 27 PostgreSQL integration, 19 contract and 30 browser tests.
This describes that local run; it does not establish production performance or reliability.
Later interface work was checked on desktop and mobile, including keyboard interaction, responsive layouts and automated accessibility checks.
These interface checks have a different scope from the initial local test baseline.
A documented public release check completed the return lifecycle through simulated receipt and verified that another browser context could not access its request.
Preview environment isolation, scheduled cleanup and remaining release checks are still pending in the source validation record.
The interface in practice
Enlarge image
Enlarge image
Enlarge image
Enlarge image