Skip to content

Structure

Hexagonal architecture and DDD

The project's approach is loosely based on the hexagonal architecture pattern and domain-driven design.

In practice:

  • We utilize a Domain directory that contains all our internal business code
  • There's an Interfaces directory that organizes all user-facing controllers and related code based on where the request is coming from
  • Finally we have the default app folder containing generic, shared framework code

The main flow is somewhat like: interface => domain => app (and reversed to show output).

app

Generic, reusable framework code and setup.

assets

Generic project resources required for local development.

database/assets

Resources only used in database seeders or factories.

Domain

Main entry point for internal business code. Can be used by all interfaces (API, HTTP, console, etc).

Interfaces

Main entry point for code the user interacts with. Can be anything from API to HTTP web pages to console commands.

Interfaces/Admin

Code that houses (parts of) the legacy admin (aka backoffice).

Interfaces/ProviderAdmin

Code that houses (parts of) the legacy provider admin (backoffice).

Interfaces/StoreAdmin

Code that houses (parts of) the legacy store admin (backoffice).

Interfaces/Backoffice

All user-facing controllers and code for the new backoffice.

modules

The main entry point for all legacy modules. These are still in-use, but the approach is deprecated. Only make small changes or fixes to this code and try to refactor on-the-go.

modules/admin

The legacy admin module. If you need to tweak anything related to the global (deprecated) legacy admin, it's in here.

public/build

Vite's build output directory containing compiled front-end assets.

public/files

Static assets.

public/images

For static images. Use the PHP asset() helper to access them or use the direct URL (with a leading forward slash) in Vue components.

public/vendor

Auto-published (Laravel) vendor assets.

resources/images

Images, icons, and logos used in resource files. Non-static and compiled during the build process by Vite.

Use the Blade @svg() helper or the Icon.vue (and other derived) components to load an asset.

resources/js/pages

Vue Inertia pages.

resources/js/plugins

Global Vue plugins and configurations.

resources/js/types

Auto-generated TypeScript definitions.

resources/js/admin.js

The main front-end entry file for the (deprecated) legacy admin.

resources/js/main.ts

The main entry file for the entire app and the backoffice (excluding the legacy admin).

resources/data

Generic files required in production environments.

resources/server

Local and remote server configuration files.

stubs

Overrides main Laravel files like migration classes used in make commands.

tests/App

Generic tests for the Laravel framework that are not related to business code.

tests/assets

Resources and assets only used in tests.

tests/Concerns

Global test helper traits.

tests/Playwright

Playwright setup and tests, asserting full end-to-end front-end user interaction.

tests/Domain

Small tests for individual parts of the application's domain code.

tests/Interfaces

Tests for endpoints and their controllers or commands, organized by interface. Most tests go in here, asserting a full back-end interaction from start to finish.

tests/Routes

Dedicated tests for interface HTTP routes to assert the correct permissions.