Step 4 — Know your project layout

Before persistence and auth, orient yourself in the repo you have been editing.

What you will learn

  • Where HTTP enters and how AppRealm boots once per process
  • Which folders you will touch in Steps 5–15
Before you start

Request path

flowchart LR HTTP[public/index.php] --> Boot[bootstrap/application.php] Boot --> Realm[AppRealm] Realm --> Switch[MainSwitch v1] Switch --> Task[TaskService]
PathYou will use it for
bootstrap/application.phpBoot chain; add providers in Step 14
environment/settings.ini[db], [app_switches], middleware
environment/.envDEBUG, PORT, secrets
services/TaskService, MemberService (Step 9)
switches/Register service aliases
middlewares/Step 10 — RequestIdMiddleware
authentications/Step 9 — JWT backend
providers/Step 14 — AppProvider
database/Step 5 — schema.sql
storage/logs/Runtime logs
public/SPA build in Step 12

Deep reference: Application structure.

Checkpoint

You should still be able to run:

curl -s -X POST http://127.0.0.1:8000/api/v1/ \
  -H "Content-Type: application/json" \
  -d '{"service":"task","action":"list"}'

Common mistakes

  • Creating routes.php for API versions — use [app_switches] instead.
  • Putting business logic in public/index.php — keep it in services.