This project consists of two main parts:
- Frontend: Built with React.
- Backend: Built with PHP using Routify and Doctrine ORM.
- Node.js and npm installed.
- PHP 8.x or later.
- Composer installed.
- MySQL/MariaDB.
-
Create Database User and Schema:
- Create a MySQL user and schema.
- Example SQL:
CREATE DATABASE flow_order; CREATE USER 'flow_order'@'localhost' IDENTIFIED BY 'your_password'; GRANT SELECT, INSERT, UPDATE, DELETE, REFERENCES, CREATE, ALTER, INDEX, DROP ON flow_order.* TO 'flow_order'@'localhost'; FLUSH PRIVILEGES;
-
Environment File:
- Navigate to the
/backend/directory. - Create a
.envfile based on.env.example. - Example
.envcontent:DB_HOST="127.0.0.1" DB_USERNAME="flow_order" DB_PASSWORD="your_password" DB_SCHEMA="flow_order" ALLOWED_ORIGIN="the_frontend_origin" ROUTIFY_SERVER_HOST="127.0.0.1" ROUTIFY_SERVER_PORT=8080 ROUTIFY_SERVER_RATE_LIMIT=50 ROUTIFY_SERVER_RATE_LIMIT_TIME_FRAME=60
- Replace
your_passwordwith the database password. - Replace
the_frontend_originwith the frontend’s origin (e.g.,http://localhost:3000).
- Replace
- Navigate to the
-
Install Dependencies:
composer install
-
Run Database Migrations:
php vendor/bin/doctrine-migrations migrate
-
Start Development Server:
nodemon
-
Install Dependencies: Navigate to the
/frontend/directory and run:npm install
-
Update Configuration (If Necessary):
- Modify
/frontend/src/Constants/Endpoints.tsxto set the correctBASE_URLfor the Routify backend. Example:export const BASE_URL = "http://127.0.0.1:8080/api";
- Modify
-
Start Development Server:
npm run dev
- Ensure that the backend and frontend are running simultaneously during development.
- For production, configure environment variables and ensure proper deployment strategies for both frontend and backend.