{"id":22549222,"url":"https://github.com/asier-ortiz/euskoplan-api","last_synced_at":"2026-04-12T05:35:44.852Z","repository":{"id":220591376,"uuid":"752048198","full_name":"asier-ortiz/euskoplan-api","owner":"asier-ortiz","description":"Rest API made with Laravel","archived":false,"fork":false,"pushed_at":"2024-09-16T17:54:09.000Z","size":10121,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T07:44:02.885Z","etag":null,"topics":["docker-compose","laravel","mysql","php","redis","rest-api"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asier-ortiz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-02T22:31:47.000Z","updated_at":"2024-09-19T10:09:01.000Z","dependencies_parsed_at":"2024-09-15T02:37:00.395Z","dependency_job_id":null,"html_url":"https://github.com/asier-ortiz/euskoplan-api","commit_stats":null,"previous_names":["asier-ortiz/euskoplan-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asier-ortiz%2Feuskoplan-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asier-ortiz%2Feuskoplan-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asier-ortiz%2Feuskoplan-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asier-ortiz%2Feuskoplan-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asier-ortiz","download_url":"https://codeload.github.com/asier-ortiz/euskoplan-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246000819,"owners_count":20707804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-compose","laravel","mysql","php","redis","rest-api"],"created_at":"2024-12-07T16:08:17.130Z","updated_at":"2025-12-30T23:20:20.704Z","avatar_url":"https://github.com/asier-ortiz.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# 🚧 Under Development 🚧\n\n# Euskoplan API\n\nA REST API backend built in Laravel for the [Euskoplan Client](https://github.com/asier-ortiz/euskoplan-client) project.\n\nIt allows users to create and manage tourism plans using various catalogs from [Open Data Euskadi](https://opendata.euskadi.eus/inicio/) and generate personalized itineraries.\n\nUsers can either manually create their own itineraries or automatically generate them using AI via the OpenAI API.\n\nThe information is sourced from XML files, which are parsed and automatically updated in the database every Monday between 00:00 and 06:00 (Europe/Madrid) using a Cron job. Additionally, you can manually trigger a database update if necessary.\n\nThe API also integrates with Mapbox for route calculation and manages authentication and authorization with [Laravel Sanctum](https://laravel.com/docs/10.x/sanctum) and [Laravel Gates](https://laravel.com/docs/10.x/authorization#gates).\n\n# Instructions\n\nBefore starting, make sure you have Docker installed.\n\n- [Docker](https://www.docker.com/)\n\n## 1. Laravel .env Configuration File\n\n- Navigate to the Laravel project directory\n\n```shell\ncd euskoplan-api\n```\n\n- Copy `.env.example` to `.env`\n\nOn Windows\n\n```shell\ncopy .env.example .env\n```\n\nOn macOS / Linux\n\n```shell\ncp .env.example .env\n```\n\n- Modify the application name in the `.env` file\n\n```text\nAPP_NAME=Euskoplan\n```\n\n- Modify the database credentials in the `.env` file\n\n```text\nDB_CONNECTION=mysql\nDB_HOST=db\nDB_PORT=3306\nDB_DATABASE=api\nDB_USERNAME=user\nDB_PASSWORD=password\n```\n\n- Modify Redis settings in the `.env` file\n\n```text\nREDIS_HOST=redis\nREDIS_PORT=6379\nREDIS_PASSWORD=password\n```\n\n- Modify the email server settings in the `.env` file\n\n```text\nMAIL_MAILER=smtp\nMAIL_HOST=mailhog\nMAIL_PORT=1025\nMAIL_USERNAME=null\nMAIL_PASSWORD=null\nMAIL_ENCRYPTION=null\nMAIL_FROM_ADDRESS=euskoplan@test.com\nMAIL_FROM_NAME=\"${APP_NAME}\"\n```\n\n- Add Mapbox and OpenAI tokens in the `.env` file\n\n```text\nMAP_BOX_TOKEN=\"\u003cYOUR_KEY\u003e\"\nOPENAI_API_KEY=\"\u003cYOUR_KEY\u003e\"\n```\n\n## 2. Start Docker and Launch the Containers\n\n- From the root directory of the project, run the following command and wait for it to finish:\n\n```shell\ndocker compose up -d\n```\n\n## 3. Vendor Directory and Encryption Key Generation\n\n\u003e :warning: This step is only necessary the first time.\n\n- From the root directory of the project, run the following command and wait for the installation to complete:\n\n```shell\ndocker compose exec php composer install\n```\n\n- If you see a warning about the lock file being out of date, run the following command to synchronize it:\n\n```shell\ndocker compose exec php composer update\n```\n\n\u003e :warning: Running `composer update` will update the lock file to match the composer.json, ensuring dependencies are up to date.\n\n- From the root directory of the project, run the following command:\n\n```shell\ndocker compose exec php php artisan key:generate\n```\n\n## 4. Migrations\n\n- To generate the tables, from the root directory of the project, run:\n\n```bash\ndocker compose exec php php artisan migrate\n```\n\n## 5. Seeders\n\n- To load the data into the database, from the root directory of the project, run:\n\n```bash\ndocker compose exec php php artisan db:seed\n```\n\n## 6. Queue Workers\n\n- **Queues** are used in the application to handle background jobs like sending emails and processing collections. To ensure that emails and other background jobs are processed, you need to run queue workers for each type of job.\n\n### 6.1 Running Queue Workers for Email Jobs\n\nTo start processing email-related jobs, run the following command:\n\n```bash\ndocker compose exec php php artisan queue:work --queue=emails\n```\n\n### 6.2 Running Queue Workers for Collection Processing Jobs\n\nTo start processing jobs related to updating collections, run the following command:\n\n```bash\ndocker compose exec php php artisan queue:work --queue=collections\n```\n\n\u003e :warning: These workers should be running at all times to process queued jobs for sending emails and updating collections.\n\n## 7. Access the Services\n\nOnce the Docker containers are running, you can access various services provided by the application. Below are the details on how to access each service:\n\n- **phpMyAdmin**: A web interface to manage your MySQL database.\n    - URL: [http://localhost:8081](http://localhost:8081)\n    - Connection Details:\n        - **Server**: `db`\n        - **Username**: `user`\n        - **Password**: `password`\n\n- **RedisInsight**: A web tool for managing and monitoring Redis databases.\n    - URL: [http://localhost:5540](http://localhost:5540)\n    - Connection Details:\n        - **Host**: `redis`\n        - **Port**: `6379`\n        - **Username**: (leave blank)\n        - **Password**: `password`\n        - **Database Index**: `1`\n\n- **MailHog**: A web interface to view emails sent by the application (for local development only).\n    - URL: [http://localhost:8025](http://localhost:8025)\n\n- **Postman**: Use Postman to test the API endpoints. You can download and import a pre-configured Postman file:\n    - Download the file [here](https://drive.google.com/file/d/1KtY4w0z94aVRbSv4h-5wdPcGCgjUzA68/view?usp=sharing) and import it into Postman.\n\n## 8. Shell Access to the Application Container\n\n```shell\ndocker compose exec php /bin/bash\n```\n\n## 9. Stop the Containers\n\n```shell\ndocker compose stop\n```\n\n## 10. Database Updates\n\n#### Automatic Updates\n- The database is automatically updated via a scheduled **Cron Job**, which runs every Monday between **00:00 and 06:00 (Europe/Madrid)**. During this time, the system will fetch the latest data from [Open Data Euskadi](https://opendata.euskadi.eus/inicio/) and update the database.\n\n#### Manual Updates\n- If you need to manually force an update (for example, during testing or debugging), you can do so by running the following command:\n\n```bash\ndocker compose exec php php artisan collections:cron\n```\n\n\u003e :warning: Depending on the amount of data, the update process can take some time.\n\n## Other\n\n- There is a test user to access the web application with the following credentials:\n    - Username: test\n    - Email: test@test.com\n    - Password: password\n\n## Screenshots\n\n\u003cimg src=\"screenshots/screenshot-1.png\" width=\"300\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasier-ortiz%2Feuskoplan-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasier-ortiz%2Feuskoplan-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasier-ortiz%2Feuskoplan-api/lists"}