This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is an AdonisJS 6 application with Inertia.js and Vue 3 for the frontend, using PostgreSQL as the database. The stack includes:
- Backend: AdonisJS 6 with TypeScript
- Frontend: Vue 3 with Inertia.js (SSR enabled)
- Styling: Tailwind CSS v4 + shadcn-vue components
- Database: PostgreSQL with Lucid ORM
- Authentication: AdonisJS Auth
- Testing: Japa test runner
# Development server with hot module replacement
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run all tests
npm test
# Run specific test suite
node ace test functional
node ace test unit
# Type checking
npm run typecheck
# Linting and formatting
npm run lint
npm run format
# Database migrations
node ace migration:run
node ace migration:rollback
node ace migration:fresh
node ace make:migration <name>The backend follows AdonisJS conventions with TypeScript path aliases defined in package.json (e.g., #controllers/*, #models/*, #middleware/*):
-
start/: Application bootstraproutes.ts: HTTP route definitionskernel.ts: Middleware stack configuration (server and router middleware)env.ts: Environment variables validation schema
-
app/: Application codemodels/: Lucid ORM models (e.g.,user.ts)middleware/: HTTP middleware (auth_middleware,guest_middleware,silent_auth_middleware)exceptions/: Custom exception handlers
-
config/: Configuration files for all AdonisJS packages (database, auth, session, inertia, vite, etc.) -
database/migrations/: Database schema migrations
The frontend lives in the inertia/ directory with SSR enabled:
-
inertia/app/: Application entry pointsapp.ts: Client-side entrypointssr.ts: Server-side rendering entrypoint
-
inertia/pages/: Inertia page components (Vue SFCs)- Routed via
router.renderInertia()instart/routes.ts errors/: Error page components
- Routed via
-
inertia/components/: Reusable Vue componentsui/: shadcn-vue components (installed viashadcn-vueCLI)
-
inertia/lib/: Utility functionsutils.ts: Frontend utilities (e.g.,cn()for Tailwind class merging)
-
inertia/css/: Global styles -
Alias:
~/resolves toinertia/directory (defined invite.config.ts)
Middleware is configured in start/kernel.ts:
Server middleware (runs on all requests):
- Container bindings
- Static file serving
- CORS
- Vite middleware (dev only)
- Inertia middleware
Router middleware (runs on matched routes):
- Body parser
- Session
- Shield (CSRF protection)
- Auth initialization
Named middleware (applied explicitly to routes):
auth: Requires authenticated userguest: Requires unauthenticated user
- SSR enabled: Server-side rendering configured in
config/inertia.tsandvite.config.ts - Root view:
inertia_layout(Edge template inresources/views/) - Shared data: Configure in
config/inertia.tssharedDataobject - Pages are rendered via
router.on('/').renderInertia('home')in routes
HotHook is configured in package.json to reload:
app/controllers/**/*.tsapp/middleware/*.ts
Tests are organized by suite in adonisrc.ts:
- Unit tests:
tests/unit/**/*.spec.ts(2s timeout) - Functional tests:
tests/functional/**/*.spec.ts(30s timeout)
Bootstrap configuration: tests/bootstrap.ts
- Connection: PostgreSQL (configured in
config/database.ts) - ORM: Lucid (AdonisJS's ActiveRecord implementation)
- Migrations: Stored in
database/migrations/with natural sorting enabled - Environment variables:
DB_HOST,DB_PORT,DB_USER,DB_PASSWORD,DB_DATABASE
All environment variables are validated in start/env.ts. Required variables include:
NODE_ENV,PORT,APP_KEY,HOST,LOG_LEVELSESSION_DRIVER(cookie or memory)- Database connection variables (see above)
See .env.example for a complete list.
- Vite build hook: Runs on build (configured in
adonisrc.tshooks) - Metafiles:
resources/views/**/*.edgeandpublic/**are copied to build - Experimental flags:
mergeMultipartFieldsAndFilesandshutdownInReverseOrderenabled