Project structure

This section will give you an overview of the Expanse project structure and the import files and folders created during the initialization of the project.

This is the default structure of an Expanse project which provides sensible defaults for a typical web application. However, you are free to change and adapt it to your needs.

The app folder

The app folder is where you will put all your application code. This includes your models, controllers, services, and any other business logic you need to implement.

├── app
│  ├── console
│  │  └── commands
│  ├── http
│  │  ├── controllers
│  │  └── middleware
│  ├── providers
│  ├── routes
│  │  ├── api.py
│  │  └── web.py
│  ├── models
│  └── app.py
  • app.py: This is the entry point of your application where you can configure the bootstrapping of your application.
  • console: This folder contains all the Beam commands for your application.
  • http: This folder contains all the HTTP-related code, including controllers and middleware.
  • providers: This folder contains all the service providers that will be loaded by the framework.
  • routes: This folder contains all the route definitions for your application. By default, two files are created:
    • web.py: This file contains the web routes for your application.
    • api.py: This file contains the API routes for your application.
  • models: This folder contains all the database models for your application. By default, it is empty, and you can create your own models here.

The config folder

The config folder is where you will put all your configuration files. The files in this folder will be loaded by the framework and used to configure your application.

You can learn more about the configuration files in the configuration section.

The database folder

The database folder is where you will put all your database-related files, like migrations. This is also the default location for the SQLite database file.

The static folder

The static folder is where you will put all your static files, like CSS, JavaScript, and images that do not need any kind of processing or building.

You can learn more about the static files in the corresponding section.

The tests folder

The tests folder is where you will put all your tests for your application.

The views folder

The views folder is where you will put all your HTML or Jinja templates.