Guidance for AI coding agents (Claude Code, etc.) working in this repo.
This is the Magento AI Starter — Daffodil: a Magento Open Source backend (at magento/) paired with a Daffodil Angular storefront (at daffodil/), pre-wired for GitHub Codespaces. It is a learning / prototyping baseline, not a production store.
Users drive the project by typing natural-language requests at the claude prompt. The sections below map the requests in README.md to the exact commands you should run.
- Working directory:
/workspace(the repo root, containingmagento/+daffodil/) - Runtime: VS Code devcontainer (
.devcontainer/) backed by themagento2-devcontainersubmodule. Brings up MariaDB, Redis, OpenSearch, RabbitMQ, Mailpit, php-fpm, and nginx as sibling Docker services. - Magento root is
/workspace/magento/. Runbin/magentofrom there (or usecd magento && bin/magento ...). - Daffodil workspace is
/workspace/daffodil/. Run Angular commands from there. - Dependencies install automatically on first
devcontainer up—updateContentCommandrunscomposer installinmagento/andnpm ciindaffodil/in parallel. Both directories are gitignored, so a fresh Codespace clone is missing them until this step runs. - Magento is installed automatically right after deps —
postCreateCommandpipesmagento2-devcontainer/bin/setup-install.shtobash. The upstream script waits for sibling services (db/rabbitmq/opensearch) to accept TCP connections, auto-detects the monorepo layout (Magento atmagento/), and picks up$CODESPACE_NAMEto set a working--base-urlin Codespaces. - Backend (Magento) is exposed on the forwarded
nginx:8000port. - Storefront (Daffodil
ng serve) is exposed on port4200. - The Angular dev server's
proxy.conf.jsonforwards/graphqltohttp://nginx:8000over the docker network. The storefront calls/graphql(relative), so the browser sees a single origin and no CORS configuration is needed.
cd daffodil
npx ng serve --host 0.0.0.0 --port 4200This is a long-running command — leave it open. Codespaces forwards
4200 automatically. The first compile takes ~30 seconds; subsequent
edits hot-reload.
Magento is already installed on first launch. If the user explicitly
asks to reinstall (or setup:install was interrupted), wipe the
partial state and re-run the upstream installer:
rm -f magento/app/etc/env.php magento/app/etc/config.php
.devcontainer/magento2-devcontainer/bin/setup-install.sh | bashThe upstream script prints the bin/magento setup:install command
with the devcontainer's default service hostnames, prepends a cd "./magento" for the monorepo layout, and (in Codespaces) sets
--base-url to the forwarded :8000 URL.
Edit Angular components in daffodil/src/app/. The Daffodil schematic
laid out:
daffodil/src/app/daff/pages/home/home.component.ts— homepagedaffodil/src/app/daff/pages/not-found/not-found.component.ts— 404daffodil/src/app/daff/product/components/product-list/— listingdaffodil/src/app/daff/product/components/product-page/— PDPdaffodil/src/app/daff/navigation/components/navigation.component.ts— nav
The dev server hot-reloads on save — no command needed after editing.
For new components, use the Angular CLI:
cd daffodil
npx ng generate component features/<name>- Run
bin/magentofrom/workspace/magento/. - After changes to
app/etc/config.phpor DI:bin/magento setup:upgrade && bin/magento cache:clean. - After module changes:
bin/magento setup:upgrade && bin/magento cache:flush. - GraphQL schema lives under
magento/vendor/magento/module-*-graph-ql/etc/schema.graphqls. Schema changes needbin/magento cache:clean.
Commit everything with a Conventional Commits prefix. Pick the label from the nature of the change:
chore:— setup, config, no user-visible change (no release bump)docs:— documentation only (no release bump)fix:— bug fix (patch bump)feat:— new user-visible feature (minor bump)
git add -A
git commit -m "<type>: <short description>"release-please reads these labels and proposes versioned releases on push.
Commit (as above) and then:
git push- Magento admin credentials are dev defaults set by upstream
setup-install.sh:admin / admin123. These are for the devcontainer only — never ship them. - Daffodil ↔ Magento wiring lives in
daffodil/src/app/app.config.ts. TheprovideMagentoDriver({ uri: "/graphql" })URI is intentionally relative — the proxy indaffodil/proxy.conf.jsonhandles routing to the Magento backend. Don't switch this to an absolute URL. - CI:
.github/workflows/check-store.ymlruns PHPUnit, the Magento coding standard, and a smoke test againstmagento/on every push and PR. Don't push backend changes that you haven't at least tried to build locally. - Dep refresh —
composer.jsonorpackage.jsonedits don't auto- re-install. After changes, runcomposer installinmagento/ornpm installindaffodil/manually. (Rebuilding the container also re-runsupdateContentCommand.)
This starter is explicitly not production-ready:
- Default admin password (
admin123) is a known dev default. - Magento ships with
Magento_TwoFactorAuthenabled. Set up TOTP via the Mailpit-caught activation email on first admin login (see README step 6) — orbin/magento module:disable Magento_TwoFactorAuth Magento_AdminAdobeImsTwoFactorAuthif a user explicitly wants 2FA off for dev. - Magento is in default mode out of the install (no DI compile,
no static-content deploy).
bin/magento deploy:mode:set developerif the user wants live template reloads / friendlier errors. - No HTTPS — the storefront and admin both run over plain HTTP inside the devcontainer.
- The Angular dev server is
ng serve, not a production build. The proxy approach for/graphqlonly works behindng serve; for production, the storefront would be served as static files behind a reverse proxy (or withgraycore/magento2-corsconfigured to allow the storefront's origin).
If the user asks about taking this to production, flag the gap honestly rather than papering over it.