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

PathRole
src/appURLs and layouts
page/{route}Screen implementation
state/{domain}State, queries and actions
api/{domain}Server operations and validation
server/repositoryData reads and writes
libShared 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:

RuleCheck
api-structure, state-structureRequired files, action folders and exports, checked from each domain's index.ts
app-structureForbids src/app/page.tsx; home belongs in (app)/page.tsx
index-only-importRestricts cross-layer imports of API and state internals such as actions/types
client-component-no-api-importForbids direct API imports in service client pages
api-only-server-actionRestricts direct fetch in client pages and API routes outside allowed paths
no-db-in-apiForbids direct drizzle-orm imports in the API layer
api-create-action, api-action-errorChecks API action wrappers and error handling
no-native-interactiveRequires 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.