|
| 1 | +# Running Hi.Events Locally Without Docker |
| 2 | + |
| 3 | +This guide provides instructions for setting up Hi.Events locally without using Docker, including the necessary prerequisites, |
| 4 | +setup steps, and configuration details. |
| 5 | + |
| 6 | +**For a faster and more reliable setup, we strongly recommend using the official [Docker setup](https://hi.events/docs/getting-started/quick-start).** |
| 7 | + |
| 8 | +## Prerequisites |
| 9 | + |
| 10 | +1. [Install PHP 8.2 or higher](https://www.php.net/downloads.php) |
| 11 | +2. [Install Composer](https://getcomposer.org/download/) |
| 12 | +3. [Install PostgreSQL](https://www.postgresql.org/download/) |
| 13 | +4. [Install Node.js](https://nodejs.org/en) |
| 14 | +5. [Install Yarn](https://yarnpkg.com/getting-started/install) |
| 15 | + |
| 16 | +### PHP Extensions |
| 17 | + |
| 18 | +Ensure the following PHP extensions are installed: `gd`, `pdo_pgsql`, `sodium`, `curl`, `intl`, `mbstring`, `xml`, `zip`, `bcmath`. |
| 19 | + |
| 20 | +## Setup |
| 21 | + |
| 22 | +First, fork the repository and clone it locally: |
| 23 | + |
| 24 | +```bash |
| 25 | +git clone https://github.com/youraccount/Hi.Events.git |
| 26 | +``` |
| 27 | + |
| 28 | +Hi.Events has two main directories: `backend` (Laravel) and `frontend` (React). |
| 29 | + |
| 30 | +### Backend Setup |
| 31 | + |
| 32 | +1. **Create the `.env` file:** |
| 33 | + |
| 34 | + Navigate to the `backend` directory and copy the example `.env` file: |
| 35 | + |
| 36 | + ```bash |
| 37 | + cd backend |
| 38 | + cp .env.example .env |
| 39 | + ``` |
| 40 | + |
| 41 | +2. **Database Configuration:** |
| 42 | + |
| 43 | + Update the `.env` file with your database credentials: |
| 44 | + |
| 45 | + ```bash |
| 46 | + DB_CONNECTION=pgsql |
| 47 | + DB_HOST=localhost |
| 48 | + DB_PORT=5432 |
| 49 | + DB_DATABASE=postgres |
| 50 | + DB_USERNAME=postgres |
| 51 | + DB_PASSWORD=postgres |
| 52 | + ``` |
| 53 | + |
| 54 | + This assume the default PostgreSQL configuration. Update the values as needed. |
| 55 | + |
| 56 | +3. **Mail Server Configuration:** |
| 57 | + |
| 58 | + Configure Mailtrap for email handling, or use the `log` driver to log emails locally: |
| 59 | + |
| 60 | + ```bash |
| 61 | + MAIL_MAILER=smtp |
| 62 | + MAIL_HOST=smtp.mailtrap.io |
| 63 | + MAIL_PORT=2525 |
| 64 | + MAIL_USERNAME=your_mailtrap_username |
| 65 | + MAIL_PASSWORD=your_mailtrap_password |
| 66 | + MAIL_ENCRYPTION=tls |
| 67 | + MAIL_FROM_ADDRESS=your_email |
| 68 | + MAIL_FROM_NAME="${APP_NAME}" |
| 69 | + |
| 70 | + # Alternatively use just this value to log emails locally: |
| 71 | + MAIL_MAILER=log |
| 72 | + ``` |
| 73 | + |
| 74 | +4. **URL Configuration:** |
| 75 | + |
| 76 | + Set the application and frontend URLs in the `.env` file: |
| 77 | + |
| 78 | + ```bash |
| 79 | + APP_URL=http://localhost |
| 80 | + APP_PORT=8000 |
| 81 | + APP_FRONTEND_URL=http://localhost:5678 |
| 82 | + ``` |
| 83 | + |
| 84 | +5. **Install Dependencies:** |
| 85 | + |
| 86 | + Install the backend dependencies: |
| 87 | + |
| 88 | + ```bash |
| 89 | + composer install |
| 90 | + ``` |
| 91 | + |
| 92 | +6. **Generate Application Key:** |
| 93 | + |
| 94 | + Generate the Laravel application key: |
| 95 | + |
| 96 | + ```bash |
| 97 | + php artisan key:generate |
| 98 | + ``` |
| 99 | + |
| 100 | +7. **Run Migrations:** |
| 101 | + |
| 102 | + Run the database migrations: |
| 103 | + |
| 104 | + ```bash |
| 105 | + php artisan migrate |
| 106 | + ``` |
| 107 | + |
| 108 | +8. **Configure File Storage:** |
| 109 | + |
| 110 | + Set the following values in your `.env` file: |
| 111 | + |
| 112 | + ```bash |
| 113 | + FILESYSTEM_PUBLIC_DISK=public |
| 114 | + FILESYSTEM_PRIVATE_DISK=local |
| 115 | + APP_CDN_URL=http://localhost:8000/storage |
| 116 | + ``` |
| 117 | + |
| 118 | + Then create a symbolic link for storage: |
| 119 | + |
| 120 | + ```bash |
| 121 | + php artisan storage:link |
| 122 | + ``` |
| 123 | + |
| 124 | +9. **Start the Backend Server:** |
| 125 | + |
| 126 | + Start the Laravel development server: |
| 127 | + |
| 128 | + ```bash |
| 129 | + php artisan serve |
| 130 | + ``` |
| 131 | + |
| 132 | + Visit `http://localhost:8000` to verify the backend is running. |
| 133 | + |
| 134 | +10. **Optional: Configure Stripe (for Payment Integration):** |
| 135 | + |
| 136 | +If you want to test the payment functionality, configure Stripe: |
| 137 | + |
| 138 | +```bash |
| 139 | +STRIPE_PUBLIC_KEY=your_public_key |
| 140 | +STRIPE_SECRET_KEY=your_secret_key |
| 141 | +STRIPE_WEBHOOK_SECRET=your_webhook_secret |
| 142 | +``` |
| 143 | + |
| 144 | +### Frontend Setup |
| 145 | + |
| 146 | +#### 1. **Create the `.env` File:** |
| 147 | + |
| 148 | +Navigate to the `frontend` directory and copy the example `.env` file: |
| 149 | + |
| 150 | + ```bash |
| 151 | + cd frontend |
| 152 | + cp .env.example .env |
| 153 | + ``` |
| 154 | + |
| 155 | +#### 2. **Configure Frontend `.env`:** |
| 156 | + |
| 157 | +Update the `.env` file with the following settings: |
| 158 | + |
| 159 | + ```bash |
| 160 | + VITE_API_URL_CLIENT=http://localhost:8000 |
| 161 | + VITE_API_URL_SERVER=http://localhost:8000 |
| 162 | + VITE_FRONTEND_URL=http://localhost:5678 |
| 163 | + VITE_STRIPE_PUBLISHABLE_KEY=pk_test_XXXXXXXX |
| 164 | + ``` |
| 165 | + |
| 166 | +#### 3. **Install Dependencies:** |
| 167 | + |
| 168 | +Install the frontend dependencies: |
| 169 | + |
| 170 | + ```bash |
| 171 | + yarn install |
| 172 | + ``` |
| 173 | + |
| 174 | +#### 4. **Set Environment Variables:** |
| 175 | + |
| 176 | +Set the environment variables before starting the frontend app. |
| 177 | + |
| 178 | +- **Windows:** |
| 179 | + |
| 180 | + ```bash |
| 181 | + $env:VITE_API_URL_CLIENT="http://localhost:8000" |
| 182 | + $env:VITE_API_URL_SERVER="http://localhost:8000" |
| 183 | + $env:VITE_FRONTEND_URL="http://localhost:5678" |
| 184 | + $env:VITE_STRIPE_PUBLISHABLE_KEY="pk_test_XXXXXXXX" |
| 185 | + ``` |
| 186 | + |
| 187 | +- **Linux/Mac:** |
| 188 | + |
| 189 | + ```bash |
| 190 | + export VITE_API_URL_CLIENT="http://localhost:8000" |
| 191 | + export VITE_API_URL_SERVER="http://localhost:8000" |
| 192 | + export VITE_FRONTEND_URL="http://localhost:5678" |
| 193 | + export VITE_STRIPE_PUBLISHABLE_KEY="pk_test_XXXXXXXX" |
| 194 | + ``` |
| 195 | + |
| 196 | +#### 5. **Build and Start the Frontend:** |
| 197 | + |
| 198 | +Run the following commands to build and start the frontend application: |
| 199 | + |
| 200 | + ```bash |
| 201 | + yarn build |
| 202 | + yarn start |
| 203 | + ``` |
| 204 | + |
| 205 | +Visit `http://localhost:5678` to view the frontend. |
| 206 | + |
| 207 | +## Troubleshooting |
| 208 | + |
| 209 | +1. **Composer Install Errors:** |
| 210 | + Ensure the required PHP extensions are installed. Check by running: |
| 211 | + |
| 212 | + ```bash |
| 213 | + php -m |
| 214 | + ``` |
| 215 | + |
| 216 | +2. **Database Connection Issues:** |
| 217 | + Verify the database credentials in the `.env` file and ensure the PostgreSQL service is running. |
| 218 | + |
| 219 | +3. **Mail Server Errors:** |
| 220 | + Ensure that your mail server credentials (e.g., Mailtrap) are correct or use the `log` driver for local email logging. |
| 221 | + |
| 222 | +4. **Frontend not connecting to the backend:** |
| 223 | + Ensure the API URLs are set correctly in both the frontend `.env` file and the backend `.env` file. Also, verify that environment variables are properly exported in the terminal. |
0 commit comments