Skip to content

tamglaeser/feedbackapp

Repository files navigation

Feedback App

This project implements a feedback application allowing the user to

  1. Import a CSV file containing feedback from Feedier on an hourly basis through a CRON job
  2. Create a feedback entry through a form
  3. Export all feedback as a JSON file and send it to all the admin users every Friday at 3pm, through a CRON job
  4. Import feedback manually with a JSON or CSV file if logged in

Getting Started

Installation

  1. Clone the repository:

    git clone git@github.com:tamglaeser/feedbackapp.git
  2. Navigate to the project directory:

    cd feedbackapp
  3. Install PHP dependencies:

    composer install
  4. Install Node.js dependencies:

    npm install
  5. Generate application key:

    php artisan key:generate
  6. Compile assets:

    npm run dev

Usage

To start the development server, run:

php artisan serve

You can now open http://localhost:8000 to see the application.

Project Structure

feedbackapp/
│
├── app/               # Contains core application code (controllers, models, etc.)
│   ├── Console/       # Artisan console commands
│   │   ├── Commands/  # Contains implementation of my two CRON commands
│   │   ├── Kernel.php # Contains scheduler of CRON commands
│   ├── Exceptions/    # Exception handling
│   ├── Http/          # Controllers, middleware, requests
│   ├── Mail/          # Mailables
│   ├── Models/        # ie. Feedback, User
│   ├── Providers/     # Service providers
│   └── Services/      
│
├── bootstrap/         # Bootstrapping and application startup
│   └── ...            # Framework initialization files
│
├── config/            # Configuration files for various application components
│   └── ...            # Files such as database, services, app settings, etc.
│
├── database/          # Database-related files
│   ├── migrations/    # Database migration files to create / modify tables
│   └── seeds/         # Database seeders
│
├── public/            # Publicly accessible files served by the webserver
│   └── ...            # Assets, index.php, etc.
│
├── resources/         # Views, language files, and frontend assets
│   ├── js/            # Vue components, app.js
│   ├── views/         # Blade templates/views
│   └── ...            # Other assets, such as CSS
│
├── routes/            # Route definitions for the application
│   └── ...            # Web.php, API.php, etc.
│
├── storage/           # Storage for logs, file uploads, and other temporary files
│   ├── app/           # Files generated by the application
│   ├── framework/     # Framework-generated files
│   └── ...            # Other storage-related items
│
├── .env               # Environment-specific configuration file
├── .gitignore         # Files and directories ignored by version control
├── artisan            # Laravel's command-line interface executable
├── composer.json      # Defines PHP dependencies for the Laravel application
├── package.json       # Node.js dependencies and scripts (if present)
└── ...                # Other project-related files and folders

Database

Using SQLite as my database; find under database/database.sqlite. See configurations within the .env file.

Mail

Using Mailtrap as "dummy" mailbox to test my email sending. Configurations can be found in .env file; modify the host, username, password, and other configurations to set up with your own Mailtrap account. Will then be able to see the sent emails in your Mailtrap inbox, including the To and From addresses, content, and attachments.

Sentry

Using Sentry to capture exceptions or messages as events. Replace SENTRY_LARAVEL_DSN (currently set to null) in the .env file to your Sentry Laravel DNS to see the events on your Sentry account.

CRON Jobs

To set up CRON to call the Laravel command scheduler every minute, running the commands when scheduled, execute

php artisan schedule:run >> /dev/null 2>&1

This will ensure steps 1 and 3 of this application are processed, importing feedback data from Feedier every hour and sending feedback data to admin users every Friday at 3pm.

To see all available commands provided by Artisan, execute

php artisan list

The two schedule CRON jobs can be found here as commands:

php artisan csv:process  # Import Feedier CSV file
php artisan export:feedback  # Export feedback as JSON and send it to admin users

Certificate Authority

To set up my certificate for my first CRON job - importing the Feedier CSV file - and avoid an SSL error, I had to download the latest cURL bundle of all the CAs (which includes the Amazon one), and add the path of this cacert.pem as my php.ini openssl.cafile variable. In case the Amazon CA were missing from this file, I could download the certificate from the Feedier Production Site and add the CA to the cacert.pem.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published