Getting Started / Folder Structure

New Projects

Folder Structure

Understanding the Archery folder structure is key to building organized and scalable applications. Archery follows a Laravel-inspired layout that separates framework core, application logic, and configuration.

Root Directory

  • bin/: Contains application entry points. The main server script is typically bin/server.dart.
  • lib/: The heart of your application and the framework.
  • test/: Your application's automated tests.
  • pubspec.yaml: Dart package configuration and dependencies.

The lib Directory

The lib directory is split into two main sections:

1. lib/archery/

This directory contains the core framework code. While you'll interact with these classes, you typically won't modify files here.

  • core/: Core framework components like the IoC container, Kernel, and Router.
  • packages/: Bundled framework packages.

2. lib/src/

This is where your application-specific code lives.

  • config/: JSON configuration files. Archery's AppConfig loads .json files from this directory recursively (e.g., app.jsondatabase.json).
  • database/: Database migrations and schema definitions.
  • http/: The web layer of your application.
    • routes/: Route definitions, typically split into web.dart and api.dart.
    • views/: Blade-style HTML templates for server-side rendering.
    • public/: Assets that are served directly (images, CSS, JS).
  • providers/: Service providers for registering and booting services in the IoC container.
  • storage/: The default location for file-based storage, including the SQLite database and JSON model files.