This application allows users to:
- Fetch a random quote.
- Save their favorite quotes.
- Manage their saved quotes collection.
- React – JavaScript library for building user interfaces.
- Redux Toolkit – For state management and handling asynchronous actions.
- Axios – For making HTTP requests to the backend.
- CSS – For styling.
- PHP Laravel – A PHP framework for building the backend API.
- Sanctum – For API authentication using tokens.
- MySQL – For database storage.
- POST /api/register: Register new user account.
- POST /api/verify-email: Verify user email account.
- POST /api/login: Login an account.
- POST /api/logout: Logout an account.
- GET /api/quotes/random: Fetches a random quote.
- POST /api/quotes: Saves a new quote to the user's collection (requires authentication).
- GET /api/quotes: Retrieves the user's saved quotes (requires authentication).
- DELETE /api/quotes/{id}: Deletes a saved quote by ID (requires authentication).
Follow the steps below to run the application locally.
-
Navigate into the frontend directory:
cd Quote-Manager/client -
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Navigate into the backend directory:
cd Quote-Manager/server -
Install dependencies using Composer:
composer install
-
Set up the environment variables in the
.envfile:- Database credentials (
DB_HOST,DB_DATABASE,DB_USERNAME,DB_PASSWORD).
- Database credentials (
-
Generate the Sanctum keys:
php artisan key:generate php artisan migrate php artisan sanctum:install
-
Start the backend server:
php artisan serve
Ensure the backend API URL is properly set in the frontend .env file (or directly in the Axios requests) for CORS to work correctly with your Laravel server.
Once both the frontend and backend are running, the frontend will be available at http://localhost:3000 (default React port). You can interact with the application by generating and saving quotes.
Ensure that the backend is running on a different port (default for Laravel is http://localhost:8000).