This project is a full-stack URL shortener application built with Symfony (backend) and Vue.js (frontend).
It features Backend Unit and Integration Testing, along with Frontend Unit, Integration and B2B Testing. Data is persisted in a MySQL Database.
- Node.js and npm
- PHP and Composer
- Symfony CLI
- MySQL
-
Navigate to the backend directory:
cd backend
-
Copy the example environment file and edit the configuration:
cp .env.example .env
-
Install the dependencies:
composer install
-
Create the database and run migrations:
php bin/console doctrine:database:create php bin/console doctrine:migrations:migrate
-
Create the database and run migrations for the test environment:
php bin/console doctrine:database:create --env=test --if-not-exists php bin/console doctrine:migrations:migrate --env=test
-
Start the Symfony server on a specified port (e.g., 43000):
symfony serve --port=43000
-
Navigate to the frontend directory:
cd frontend
-
Copy the example environment file and edit the configuration (Ensure it contains the correct API URL (matching the Symfony server URL):
cp .env.example .env
-
Install the dependencies:
npm install
-
Start the Vue.js development server:
npm run serve
To run backend tests:
cd backend
php bin/phpunit
To run frontend tests:
cd frontend
npm run test:unit
npm run test:integration
npm run test:e2e
###Usage
Once both the Symfony backend and Vue.js frontend servers are running, open your browser and navigate to:
You can now use the My Awesome URL shortener application.
The application uses a single table to store the shortened URLs. Here is the structure of the table:
- id: An auto-incrementing integer that serves as the primary key.
- original_url: A
LONGTEXT
field that stores the original URL. - short_code: A
VARCHAR(255)
field that stores the generated short code. - created_at: A
DATETIME
field that stores the creation timestamp. - updated_at: A
DATETIME
field that stores the timestamp of the last update (optional).
The table is created and managed using Doctrine migrations. The migration script ensures the table is created if it doesn't exist and handles any necessary schema updates.