Code structure and lint
app and admin are services for different user types. Each service groups APIs and state by domain, and screens by route.
src/
app/ # Next.js routes and layouts
services/
app/ # End-user service
page/{route}/ # UI
state/{domain}/ # Models, queries and actions
api/{domain}/ # Server functions
admin/ # Admin service, same layers
server/repository/ # Data access
lib/ # Shared code and UI components
.agents/skills/ # Setup skills
.storybook/ # Page stories and API mocks
eslint-rules/ # Custom lint rules
AGENTS.md # Project instructions
Layer responsibilities
| Path | Role |
|---|---|
src/app | URLs and layouts |
page/{route} | Screen implementation |
state/{domain} | State, queries and actions |
api/{domain} | Server operations and validation |
server/repository | Data reads and writes |
lib | Shared UI and utilities |
Dependency direction: page → state → api → repository.
Rules checked by lint
Custom rules in eslint-rules/ are enabled in .oxlintrc.json and run by Oxlint. Key checks include:
| Rule | Check |
|---|---|
api-structure, state-structure | Required files, action folders and exports, checked from each domain's index.ts |
app-structure | Forbids src/app/page.tsx; home belongs in (app)/page.tsx |
index-only-import | Restricts cross-layer imports of API and state internals such as actions/types |
client-component-no-api-import | Forbids direct API imports in service client pages |
api-only-server-action | Restricts direct fetch in client pages and API routes outside allowed paths |
no-db-in-api | Forbids direct drizzle-orm imports in the API layer |
api-create-action, api-action-error | Checks API action wrappers and error handling |
no-native-interactive | Requires installed components for native interactive controls in service UI, except _components |
pnpm run validate runs type checking and lint. Other conventions, including implementation order, service separation and design guidance, live in AGENTS.md and .ai.md files.