Getting Started
I’ll be guiding you on how to setup the backend.
Installation
IDE
I recommend setting up your preferred IDE first for the Laravel application environment. We personally use PHPStorm for convenience, but you can choose any IDE you like.
Local Development Environment
We are using Laravel Sail to run the application locally, but you can use whichever you prefer, such as Laravel Homestead, Laravel Herd, or even XAMPP.
If you’re going to use Laravel Sail, it’s recommended to review the Laravel Sail documentation.
Setup Backend
Clone Repository
-
Clone the repository from GitHub using your preferred terminal.
Terminal window git clone https://github.com/DipluX-Solutions/capturit-laravel.git -
Install packages
Terminal window cd capturit-laravelcomposer installnpm install && npm run build
Setup environment variable
-
Create a
.envfile and copy the contents inside the.env.examplefile..env.example APP_NAME=CapturitAPIAPP_ENV=localAPP_KEY=APP_DEBUG=trueAPP_TIMEZONE=UTCAPP_URL=APP_LOCALE=enAPP_FALLBACK_LOCALE=enAPP_FAKER_LOCALE=en_USAPP_MAINTENANCE_DRIVER=fileAPP_MAINTENANCE_STORE=databaseBCRYPT_ROUNDS=12LOG_CHANNEL=stackLOG_STACK=single,sentry_error,sentry_criticalLOG_DEPRECATIONS_CHANNEL=nullLOG_LEVEL=debugDB_CONNECTION=mysqlDB_HOST=127.0.0.1DB_PORT=3306DB_DATABASE=DB_USERNAME=rootDB_PASSWORD=SESSION_DRIVER=databaseSESSION_LIFETIME=120SESSION_ENCRYPT=falseSESSION_PATH=/SESSION_DOMAIN=nullBROADCAST_CONNECTION=logFILESYSTEM_DISK=localQUEUE_CONNECTION=redisCACHE_STORE=databaseCACHE_PREFIX=MEMCACHED_HOST=127.0.0.1REDIS_CLIENT=predisREDIS_HOST=127.0.0.1REDIS_PASSWORD=nullREDIS_PORT=6379REDIS_DB=0REDIS_CACHE_DB=1ABLY_API_KEY=MAIL_MAILER=smtpMAIL_HOST=smtp.sendgrid.netMAIL_PORT=465MAIL_USERNAME=apikeyMAIL_PASSWORD=MAIL_ENCRYPTION=sslMAIL_FROM_ADDRESS=MAIL_FROM_NAME=AWS_ACCESS_KEY_ID=AWS_SECRET_ACCESS_KEY=AWS_DEFAULT_REGION=us-east-1AWS_BUCKET=AWS_USE_PATH_STYLE_ENDPOINT=falseVITE_APP_NAME="${APP_NAME}"CLOUDFLARE_R2_TOKEN=CLOUDFLARE_R2_ACCESS_KEY_ID=CLOUDFLARE_R2_SECRET_ACCESS_KEY=CLOUDFLARE_R2_BUCKET=CLOUDFLARE_R2_BACKUP_BUCKET=CLOUDFLARE_R2_ENDPOINT=CLOUDFLARE_R2_URL=FIREBASE_CREDENTIALS=FIREBASE_PROJECT_ID=OCTANE_SERVER=swooleCIPHERSWEET_KEY=SENTRY_LARAVEL_DSN=nullDISCORD_BACKUP_WEBHOOK= -
Update the
APP_KEYYou can generate the
APP_KEYusing a command, or you can use the existingAPP_KEYon the server. If you want to generate a newAPP_KEYwithout using the one on the server, simply run the command.Terminal window php artisan key:generate -
Update the
APP_URLto match your local url.env APP_URL=http://localhost:8080 -
Update the
ABLY_API_KEYYou can obtain the API_KEY from Ably or you can ask the owner/client to provide it so you can set it up locally.
-
Update the
MAIL_XXXYou can setup this after creating an account from Twilio SendGrid or you can ask the owner/client to provide it so you can set it up locally.
You can obtain the
MAIL_PASSWORDafter generating an API key. You should be able to create it underSettings -> API KeysYou can obtain the
MAIL_FROM_ADDRESSafter setting up the Sender Identity underSettings -> Sender Authentication.You can decide what to put in
MAIL_FROM_NAME, it’s simply the sender’s name. -
Update
CLOUDFLARE_R2_XXXYou should able to set this up after creating R2 API Tokens.
- Create/Login your CloudFlare Account
- Go to R2 Object Storage
- Create buckets for capturit-backup and capturit-storage
- capturit-backup: For storing backup of project files and database
- capturit-storage: For storing images such as event cover, album photos, etc…
- Create an API token by navigating to
Manage R2 API Tokens - Update the
.envfile with the details displayed after creating the API token. Simply add the information to the.envfile.
-
Update
FIREBASE_XXXYou should be able to set this up after the mobile developer sets up the Firebase account. Just ask them for the details.
You’ll need to get the json file from Firebase then put it in
storage -> app -> keys.env FIREBASE_CREDENTIALS=keys/capturit_firebase.jsonAfter getting the json file, open it and copy the value from
project_idkey then paste it in .env.env FIREBASE_PROJECT_ID=<project_id> -
Update
CIPHERSWEET_KEYJust follow the Ciphersweet docs
-
Update
SENTRY_LARAVEL_DSNYou don’t need to set this up in your local environment, as it is used for error monitoring in deployment projects.
-
Update
DISCORD_BACKUP_WEBHOOKThis is related to backups and is used for sending backup events to Discord. You can use other platforms, such as Slack, to send events. Simply modify it in
config -> backup.php
We are done setting up the environment variable.
Setup the database
To set up the database, ensure that MySQL is running on your machine or VM. Then, run the following command:
php artisan migrate --seedThis will set up the base database for Capturit.
Run the application
This depends on how you set up your local environment, but you can simply run this command:
php artisan serveThis should allow your Laravel application to run.