Add info here
Return to the table of contents
-
Database
Definition of terms:
- DB_HOST - docker container name of the database
- DB_PORT - port used by the database
- DB_DATABASE - database username
- DB_PASSWORD - database password
Notes : DB_HOST should use docker container name of db, by default this is 'anidb-pgsql', but yours could be different. You can check this by running
docker ps
then check the container name of thepostgres
container. -
Cloudinary
- Fire up your browser and login your Cloudinary Account. If you have no account yet, you can create one for free.
- After logging in, navigate to the Cloudinary Console to retrieve your Cloudinary URL
- Copy the value of
API Environment variable
toCLOUDINARY_URL
of your ENV file
Return to the table of contents
-
Download and install Docker.
-
Clone the project, then install the dependencies
git clone https://github.com/RinMinase/anidb-be.git cd anidb-be
-
Run the necessary docker containers
docker compose up -d docker compose exec php sh
This runs only the necessary containers. As for running the optional containers, please see the section below.
-
Inside the docker image, copy the env file, install the necessary dependencies and generate the necessary key for laravel
cp .env.example .env composer install php artisan key:generate
-
Generate the necessary API key and take note of this is as this is REQUIRED to access the API
php artisan app:api-key
or you can generate your own from any application, and add it under
API_KEY
in your.env
file. Example:openssl rand -hex 36
-
Generate the necessary root password key and take note of this is as this is REQUIRED to create admin accounts
php artisan app:generate-root-password
or generate your own, and add it under
APP_REGISTRATION_ROOT_PASSWORD
in your.env
file. -
Cache the config file, then run the database migrations
php artisan config:cache php artisan migrate:fresh --seed
-
Fire up your browser and go to
localhost
.
Note:
If you need to access the container run, docker compose exec php sh
Return to the table of contents
List of optional containers:
Name | Description |
---|---|
dbui | GUI for postgres using sosedoff/pgweb |
You can run them individually by:
docker compose up -d <name>
Or run all of them by:
docker compose up -d --profile optional
Return to the table of contents
-
Navigate inside the
php
docker containerdocker compose exec php sh
-
Run the migrations when necessary, then install the dependencies also when necessary
php artisan migrate composer install
-
Fire up your browser and go to
localhost
.
Return to the table of contents
-
Navigate inside the
php
docker container [how] -
Run the command to run the scheduled tasks manually
php artisan schedule:run
There are a few commands specific to running tasks:
Name | Description |
---|---|
schedule:run |
Runs the scheduled tasks manually with respect to cron |
schedule:work |
Runs the scheduler daemon / worker |
schedule:list |
Lists the upcoming tasks to be run |
Return to the table of contents
-
Navigate inside the
php
docker container [how] -
Run the command to generate the documentations inside the container
docs
-
Fire up your browser and go to
localhost/docs
to open Swagger UI.
Return to the table of contents
-
Navigate inside the
php
docker container [how] -
Run the command below:
php artisan test
or if you want to run a specific test module
php artisan test --filter <Class name of Test File | function name>
or if you want to run a specific single test
php artisan test --filter test_function_name tests/Location/of/TestCase.php
Return to the table of contents
This shortcuts were created to reduce the need to keep typing the same long commands over and over again.
Shortcut | Long version |
---|---|
pa or artisan |
php artisan |
docs |
composer docs |
dump or da |
composer dumpautoload |
Return to the table of contents
.
βββ app/ # Application source code
β βββ docs.blade.php # Swagger page template
β βββ index.blade.php # Landing page template
β βββ ... # Other application-related files
βββ bootstrap/ # Project initializers
β βββ app.php # Framework bootstrapper
β βββ helpers.php # Helper functions
β βββ routes.php # Route definitions
βββ config/ # Laravel configuration files
βββ database/ # Database migrations and seeders
βββ docker/ # Docker functions
β βββ php-config/ # PHP settings for docker
β βββ sites/ # Nginx sites for docker
β βββ nginx.dockerfile # Nginx container docker file
β βββ php.dockerfile # PHP container docker file
β βββ ... # Other docker files
βββ public/ # Project entry point
βββ tests/ # Project test files
βββ .czrc # Commitizen configuration file
βββ docker-compose.yml # Main docker file
βββ phpunit.xml # Unit test configuration file
βββ Procfile # Heroku process file
βββ ... # Other project files
Laravel 11 - Core Framework
PHP 8.4 - Language syntax
PostgreSQL - Database
Docker - Container platform
Sentry - Application Monitoring
Swagger - API Documentation
Heroku - Hosting and Continuous Integration (CI) service
PHPUnit - Unit Testing
RESTful API - HTTP Requests Architecture