Skip to content

Project Structure ​

Honovel encourages a feature-first structure. Code belonging to one business capability stays together, while shared infrastructure remains outside the feature.

The following shows an application after adding an example appointments feature and table. A fresh starter only includes the health endpoint, runtime providers and an empty database schema.

text
index.ts
src/
  env.ts
  runtime/
    Controller.ts
  features/
    appointments/
      controllers/
        AppointmentController.ts
      dto/
        requests/
          CreateAppointmentRequest.ts
        responses/
          AppointmentResponse.ts
      actions/
        CreateAppointment.ts
      repositories/
        AppointmentRepository.ts
      services/
        AvailabilityService.ts
  database/
    main/
      MainDatabase.ts
      drizzle.config.ts
      schema/
        index.ts
        appointments.ts
      migrations/
  middleware/
    RequestLoggingMiddleware.ts
frontend/
  nuxt.config.ts
  tsconfig.json
  app/
    app.vue
    assets/
      css/
        main.css
    pages/
      index.vue
      about.vue

Application runtime ​

src/runtime/Controller.ts is the application-level controller base generated by the starter:

ts
import { BaseController, BaseUrl } from 'honovel'

@BaseUrl('/api')
export abstract class Controller extends BaseController {}

Feature controllers extend this class instead of importing Core's compatibility Controller directly. Honovel composes @BaseUrl() values across the controller inheritance chain, so a feature prefix such as /appointments becomes /api/appointments. Keeping the API prefix in one application-owned class makes it easy to change or remove later.

The frontend/ directory is generated only when Nuxt is selected during project creation. Its default production mode is SSG/prerendering, with CSR available in the browser after hydration or as a pure SPA via ssr: false. Request-time SSR is not part of the current starter. For a project with no frontend files, dependencies or assets configuration, select --api-only during project creation. See Frontend for details.

Features ​

A feature represents an application capability such as appointments, billing, users, notifications or reports.

bash
npm run honovel -- make:feature appointments

Controllers ​

Controllers bind HTTP input, call application code and return responses:

By default, generated controllers extend #src/runtime/Controller, which contributes the /api prefix:

ts
import { Controller } from '#src/runtime/Controller'

@BaseUrl('/appointments')
export class AppointmentController extends Controller {
  constructor(private readonly createAppointment: CreateAppointment) {
    super()
  }

  @Post('/')
  store(request: CreateAppointmentRequest) {
    return this.createAppointment.handle(request.validated())
  }
}

Actions ​

Actions model focused application operations:

ts
export class CreateAppointment {
  constructor(private readonly appointments: AppointmentRepository) {}

  handle(input: CreateAppointmentInput) {
    return this.appointments.create(input)
  }
}

Repositories ​

Repositories keep persistence queries close to the feature:

ts
export class AppointmentRepository {
  constructor(private readonly database: MainDatabase) {}

  all() {
    return this.database.client.select().from(appointments)
  }
}

Database ownership ​

Database schemas and migrations are grouped by physical database under src/database/<name>/. Features sharing one database should share one migration history.

Generated output ​

.honovel/ contains generated compiler output. Application source should import framework APIs from honovel and honovel/cloudflare rather than from .honovel.

Framework tooling and source repository ​

The installed honovel package contains the compiler, generators, editor plugin and shared frontend/Cloudflare helpers. Starter projects call these through the CLI rather than copying helper scripts. Application-specific runtime wrappers remain under src/runtime/ so you can select your own providers.

This application structure differs from the framework source repository: framework sources live in core/, adapters and the initializer in packages/, and framework checks in test/. The Todo application under test/fixtures/application/ is a test fixture and is not copied into new projects.