Alpas allows you to organize your directories, files, and classes the way you want it, but we highly recommend that you stick with the standard Alpas conventions for organizing your classes. Of course, you are free to create new directories and files/classes as you wish.
A standard Alpas project structure look something like this:
├── src/ ├── main/ ├── kotlin/ ├── configs/ ├── controllers/ ├── database/ ├── factories/ ├── migrations/ ├── seeds/ ├── entities/ ├── providers/ └── ConsoleKernel.kt └── HttpKernel.kt └── routes.kt └── start.kt ├── resources/ ├── css/ ├── js/ ├── templates/ ├── errors/ ├── layout/ ├── web/ ├── css/ ├── js/ ├── test/ ├── kotlin/ ├── storage/ └── .env └── alpas └── app_log_config.xml └── console_log_config.xml └── package.json └── webpack.mix.js
This is where all your app's custom configuration classes live.
A place for all your HTTP controllers. If you wish you could create subdirectories to better organize your controllers and we highly recommend that you do so.
A directory for keeping all your entity factories.
A directory for all your database migration files.
All the database seeders are kept in this folder.
A home for your Ozone entities.
This is where you should be put all your service providers.
This directory is for putting all your css source files. This directory is referenced
only from the
webpack.mix.js file. You could change the name or the location of this directory. If you
did so, make sure to modify the
webpack.mix.js file accordingly.
referenced only from the
webpack.mix.js file. You could change the name or the location of this
directory. If you end up making a change, make sure to modify the
accordingly. This folder is also where you'd put all your React/VueJS components.
The home for all your view templates.
This directory should contain HTTP errors related view templates. It comes with two templates — one for rendering a 404 error and another for rendering 500 errors. You could modify these pre-built templates as you wish but don't modify the names or relocate them.
You should place all your tests in here. Feel free to organize your tests in subfolders.
Here are some of the core files of interest.
This class extends the core
dev.alpas.http.HttpKernel class and is responsible for registering all the
service providers that should be loaded only when making HTTP requests.
/info/ You don't have to worry about which kernel class to load. Alpas knows what kernel class to load depending on whether you are running your app in "console mode" or "server mode" and loads the appropriate kernel for you automatically
This is where you should add all your application routes. All your routes defined in this file
are loaded from
This is the entry point of your application. There should be no reason to edit or rename this file. We highly recommend leaving this file as it is.
This is where you'd configure your app logs when it is running in "server mode" i.e. when serving requests.
Alpas scaffolds your project with Logback logging library and this xml file is configured for it. If you decide to use a different logging library, you might have to tweak this file accordingly.
console_log_config.xmlfiles should be deployed with your app. Just keep both of them next to the fat jar you have created to serve your app.
This script is responsible for compiling all your frontend assets such as .js scripts, .css files etc.