Skip to content

Conversation

@erseco
Copy link

@erseco erseco commented Nov 16, 2025

This commit migrates the console commands from Symfony to NestJS using the NestCommander library. The migration includes:

New Files

CLI Infrastructure

  • src/cli.ts: CLI entry point using CommandFactory
  • src/commands/command.module.ts: Main command module with TypeORM integration

JWT Commands

  • src/commands/jwt/generate-jwt.command.ts: Generate JWT tokens with custom claims
  • src/commands/jwt/validate-jwt.command.ts: Validate and decode JWT tokens

User Management Commands

  • src/commands/user/create-user.command.ts: Create new users in the database
  • src/commands/user/user-role.command.ts: Manage user roles (add/remove/list)
  • src/commands/user/generate-api-key.command.ts: Generate API keys for users

Maintenance Commands

  • src/commands/maintenance/database-test.command.ts: Test database connectivity
  • src/commands/maintenance/validate-providers.command.ts: Validate provider configuration (stub)

Documentation

  • CLI_COMMANDS.md: Comprehensive documentation for all CLI commands with usage examples

Modified Files

Dependencies

  • package.json: Added nest-commander, jsonwebtoken, and related type definitions
  • package.json: Added npm scripts for CLI execution (cli, cli:prod)

Commands Migrated (7/18)

✅ Migrated Commands:

  • app:jwt:generate
  • app:jwt:validate
  • app:create-user (alias: app:add-user)
  • app:user:role (aliases: app:user:promote, app:user:demote)
  • app:generate-api-key
  • app:database-test
  • app:validate-providers (stub - requires ProviderConfigurationService migration)

⏳ Pending Migration (11 commands):

  • Export commands (8): elp:convert, elp:export, elp:export-{elp,html5,html5-sp,ims,scorm12,scorm2004,epub3}
  • app:translations:extract
  • app:tmp-files:cleanup
  • elp:convert

Technical Details

  • All commands use NestCommander decorators (@command, @option)
  • Proper dependency injection with TypeORM repositories
  • Consistent error handling with appropriate exit codes
  • Support for all original command options and arguments
  • Commands follow NestJS module structure for better maintainability

Breaking Changes

None - Symfony commands remain available in symfony_legacy/ directory

Future Work

The export commands require migration of the following services first:

  • OdeService and OdeExportService
  • FileHelper and file management services
  • Format-specific exporters (HTML5, SCORM, IMS, EPUB)

See CLI_COMMANDS.md for complete usage documentation.

erseco and others added 30 commits October 6, 2025 12:43
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [peter-evans/dockerhub-description](https://github.com/peter-evans/dockerhub-description) from 4 to 5.
- [Release notes](https://github.com/peter-evans/dockerhub-description/releases)
- [Commits](peter-evans/dockerhub-description@v4...v5)

---
updated-dependencies:
- dependency-name: peter-evans/dockerhub-description
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [api-platform/core](https://github.com/api-platform/core) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/api-platform/core/releases)
- [Changelog](https://github.com/api-platform/core/blob/v4.2.1/CHANGELOG.md)
- [Commits](api-platform/core@v4.2.0...v4.2.1)

---
updated-dependencies:
- dependency-name: api-platform/core
  dependency-version: 4.2.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [brianium/paratest](https://github.com/paratestphp/paratest) from 7.13.0 to 7.14.1.
- [Release notes](https://github.com/paratestphp/paratest/releases)
- [Commits](paratestphp/paratest@v7.13.0...v7.14.1)

---
updated-dependencies:
- dependency-name: brianium/paratest
  dependency-version: 7.14.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](actions/upload-pages-artifact@v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-pages-artifact
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Setup apt/rpm repository, improved documentation and autogeneration. Fix ubuntu tests

* Fix translations

* Added sleep to the nsis installer to finish

* Fixed links in README.md

* Publish Windows installer in Chocolatey and WinGet on release

* Specifiy user for fork

* Improved documentation, avoid build documentation and sign installers on forks

* Improved documentation, avoid build documentation and sign installers on forks

* Avoid deploy pages in forks

* Remove VirusTotal as choco is already uploading the installer to virustotal. Fix exelearning#340
Bumps [symfony/translation](https://github.com/symfony/translation) from 7.3.3 to 7.3.4.
- [Release notes](https://github.com/symfony/translation/releases)
- [Changelog](https://github.com/symfony/translation/blob/7.3/CHANGELOG.md)
- [Commits](symfony/translation@v7.3.3...v7.3.4)

---
updated-dependencies:
- dependency-name: symfony/translation
  dependency-version: 7.3.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ernesto Serrano
Co-authored-by: Ignacio Gros
Bumps [symfony/framework-bundle](https://github.com/symfony/framework-bundle) from 7.3.3 to 7.3.4.
- [Release notes](https://github.com/symfony/framework-bundle/releases)
- [Changelog](https://github.com/symfony/framework-bundle/blob/7.3/CHANGELOG.md)
- [Commits](symfony/framework-bundle@v7.3.3...v7.3.4)

---
updated-dependencies:
- dependency-name: symfony/framework-bundle
  dependency-version: 7.3.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ernesto Serrano
Co-authored-by: Ignacio Gros
…a loss on PUT requests (exelearning#362)

* Revert "Bump symfony/serializer from 7.3.3 to 7.3.4 (exelearning#333)"

This reverts commit d7ed55a.

* Refactor DefaultApiController to use SerializerInterface and upgrade Symfony serializer
Bumps [symfony/twig-bundle](https://github.com/symfony/twig-bundle) from 7.3.2 to 7.3.4.
- [Release notes](https://github.com/symfony/twig-bundle/releases)
- [Changelog](https://github.com/symfony/twig-bundle/blob/7.3/CHANGELOG.md)
- [Commits](symfony/twig-bundle@v7.3.2...v7.3.4)

---
updated-dependencies:
- dependency-name: symfony/twig-bundle
  dependency-version: 7.3.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ernesto Serrano
Co-authored-by: Ignacio Gros
* Adjust variables

* Added vars to sign mac installer
* Added some options to improve performance on sqlite

* Fix some cascading errors
* Fix: Handle legacy provider format in extractProviderId method

* Fix: Normalize provider ID by removing '_legacy' suffix in isValidProvider method

* Fix: Improve error handling in platformPetitionSet method to include user-friendly error message

* refactor code
…rning#373)

* Fixed ?q=/workarea parameter, so now CAS works with BASE_PATH, improved documentation, add a hotfix for avoid src/var files

* Fixed tests

* Cherrypicked tests/Integration/Api/TreeValidationTest.php to avoid errors

* Removed fix in Dockerfile because updted erseco/alpine-php-webserver image

* Updated docs
* new iDevices style

* base.css should only include CSS required for exported contents.

* CSS structure to SCSS.

---------

Co-authored-by: ignaciogros
* Update logo image source in README.md

* Update README.md
* Revert "Bump symfony/serializer from 7.3.3 to 7.3.4 (exelearning#333)"

* Fix prama sqlite settings for tests

* Remove foreign keys PRAGMA setting for SQLite

* Removed the PRAGMA foreign_keys setting to allow default behavior. There are many errors on Symfony when using them

* Remove foreign keys assertion and concurrent writers test

* Removed assertions for foreign keys and deleted a test for concurrent writers.
dependabot bot and others added 28 commits November 11, 2025 09:34
Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.88.2 to 3.89.2.
- [Release notes](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases)
- [Changelog](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/CHANGELOG.md)
- [Commits](PHP-CS-Fixer/PHP-CS-Fixer@v3.88.2...v3.89.2)

---
updated-dependencies:
- dependency-name: friendsofphp/php-cs-fixer
  dependency-version: 3.89.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [symfony/validator](https://github.com/symfony/validator) from 7.3.4 to 7.3.6.
- [Release notes](https://github.com/symfony/validator/releases)
- [Changelog](https://github.com/symfony/validator/blob/7.3/CHANGELOG.md)
- [Commits](symfony/validator@v7.3.4...v7.3.6)

---
updated-dependencies:
- dependency-name: symfony/validator
  dependency-version: 7.3.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [symfony/intl](https://github.com/symfony/intl) from 7.3.4 to 7.3.5.
- [Release notes](https://github.com/symfony/intl/releases)
- [Changelog](https://github.com/symfony/intl/blob/7.3/CHANGELOG.md)
- [Commits](symfony/intl@v7.3.4...v7.3.5)

---
updated-dependencies:
- dependency-name: symfony/intl
  dependency-version: 7.3.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [doctrine/orm](https://github.com/doctrine/orm) from 3.5.2 to 3.5.3.
- [Release notes](https://github.com/doctrine/orm/releases)
- [Commits](doctrine/orm@3.5.2...3.5.3)

---
updated-dependencies:
- dependency-name: doctrine/orm
  dependency-version: 3.5.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Mermaid diagrams rendering support via TinyMCE plugin, by @lrlopez.

* TinyMCE Mermaid plugin and licenses revision.

* Mermaid contents presentation revision.
…ng#659)

* Adding default values to work as OFFLINE by default

* Fix lint issues

* Add volume

* Set online as default
…exelearning#662)

Bumps the composer group with 1 update in the / directory: [symfony/http-foundation](https://github.com/symfony/http-foundation).


Updates `symfony/http-foundation` from 7.3.5 to 7.3.7
- [Release notes](https://github.com/symfony/http-foundation/releases)
- [Changelog](https://github.com/symfony/http-foundation/blob/7.3/CHANGELOG.md)
- [Commits](symfony/http-foundation@v7.3.5...v7.3.7)

---
updated-dependencies:
- dependency-name: symfony/http-foundation
  dependency-version: 7.3.7
  dependency-type: indirect
  dependency-group: composer
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
… exported in EPUB when searching for content
…packages exported in EPUB when searching for content"

This reverts commit 19ab907.
* Preparing ChangeLog file.

* Available languages in alphabetical order.

* Fix TinyMCE fullscreen mode z-index problem (you can't select the last line).

* Progress bar presentation revision (colors).

* Package subtitle presentation.

* Missing package subtitle in the single page export.

* Partial styles revision.

* Temporally hide "New from template...".

* Renamed CSS class for highlighted links in the navigation menu.

* Stronger CSS definitions for the effects.

* Login page presentation revision.
- Complete analysis of current Symfony 7.3 architecture
- Equivalence mapping between Symfony and NestJS components
- 10-phase migration strategy (6-9 months timeline)
- Detailed architecture design for NestJS backend
- Risk assessment and mitigation strategies
- Resource planning and cost estimation
- Special focus on OdeService.php migration (123K lines)
- Coexistence strategy for gradual rollout
MAJOR CHANGES:
- Discovered eXeLearning is Electron app (NOT web app)
- Only 1 Twig template to migrate (workarea.html.twig → workarea.njk)
- Frontend is JavaScript vanilla (NO React/Vue) - NO CHANGES needed
- 69 legacy API controllers to migrate (NOT /api/v2 - doesn't exist)
- Recommend Nunjucks for templates (NOT TSX - incompatible)
- Replace Mercure with Socket.io for WebSockets
- Better Electron + Node.js integration (vs PHP embedded)

KEY FINDINGS:
- Architecture: Electron + Symfony (PHP) + JavaScript vanilla
- Single SSR: Twig renders /workarea ONCE, then JS takes over
- All operations via REST API after initial render
- 123K lines OdeService.php needs split into multiple services
- Timeline: 5-9 months (23-38 weeks)

SIMPLIFIED MIGRATION:
✅ Fewer templates (1 vs many)
✅ Frontend unchanged (JavaScript vanilla compatible)
✅ Clear API boundaries (69 controllers)
✅ Better stack unification (JS/TS everywhere)
This prompt defines all requirements for eXeLearning 4.0 architecture:

SCOPE:
- Complete migration from Symfony + PHP to NestJS + Vite
- Single unified interface (online/offline modes)
- SQLite only (simplified from multi-DB support)
- Makefile-based project management
- PR preview deployments

STACK:
- Backend: NestJS + TypeORM + SQLite
- Frontend: Vite + React/Vue (to be decided)
- Desktop: Electron
- CLI: Commander.js with shared core
- MCP: AI resource generation server

KEY REQUIREMENTS:
- 20 detailed sections covering all aspects
- Monorepo structure with shared code
- Comprehensive testing strategy
- GitHub Actions for CI/CD + PR previews
- Export system for SCORM/HTML5/EPUB3
- Real-time collaboration with Socket.io
- Embeddable in LMS (Moodle, WordPress)

DELIVERABLES REQUESTED:
1. Complete architecture document
2. Project structure definition
3. Database schema with TypeORM
4. API specifications
5. Configuration files
6. Package.json templates
7. GitHub Actions workflows
8. Type definitions
9. Testing strategy
10. Developer guide

This prompt will be used by an AI agent to generate the complete
architecture blueprint for the migration project.
This commit migrates the console commands from Symfony to NestJS using the
NestCommander library. The migration includes:

## New Files

### CLI Infrastructure
- src/cli.ts: CLI entry point using CommandFactory
- src/commands/command.module.ts: Main command module with TypeORM integration

### JWT Commands
- src/commands/jwt/generate-jwt.command.ts: Generate JWT tokens with custom claims
- src/commands/jwt/validate-jwt.command.ts: Validate and decode JWT tokens

### User Management Commands
- src/commands/user/create-user.command.ts: Create new users in the database
- src/commands/user/user-role.command.ts: Manage user roles (add/remove/list)
- src/commands/user/generate-api-key.command.ts: Generate API keys for users

### Maintenance Commands
- src/commands/maintenance/database-test.command.ts: Test database connectivity
- src/commands/maintenance/validate-providers.command.ts: Validate provider configuration (stub)

### Documentation
- CLI_COMMANDS.md: Comprehensive documentation for all CLI commands with usage examples

## Modified Files

### Dependencies
- package.json: Added nest-commander, jsonwebtoken, and related type definitions
- package.json: Added npm scripts for CLI execution (cli, cli:prod)

## Commands Migrated (7/18)

✅ Migrated Commands:
- app:jwt:generate
- app:jwt:validate
- app:create-user (alias: app:add-user)
- app:user:role (aliases: app:user:promote, app:user:demote)
- app:generate-api-key
- app:database-test
- app:validate-providers (stub - requires ProviderConfigurationService migration)

⏳ Pending Migration (11 commands):
- Export commands (8): elp:convert, elp:export, elp:export-{elp,html5,html5-sp,ims,scorm12,scorm2004,epub3}
- app:translations:extract
- app:tmp-files:cleanup
- elp:convert

## Technical Details

- All commands use NestCommander decorators (@command, @option)
- Proper dependency injection with TypeORM repositories
- Consistent error handling with appropriate exit codes
- Support for all original command options and arguments
- Commands follow NestJS module structure for better maintainability

## Breaking Changes

None - Symfony commands remain available in symfony_legacy/ directory

## Future Work

The export commands require migration of the following services first:
- OdeService and OdeExportService
- FileHelper and file management services
- Format-specific exporters (HTML5, SCORM, IMS, EPUB)

See CLI_COMMANDS.md for complete usage documentation.
erseco pushed a commit that referenced this pull request Nov 20, 2025
…mpose

Fix port 8080 in MERCURE_URL variable in docker-compose files
@erseco erseco force-pushed the epic/migrate-to-nestjs branch from a8fd96a to d47e25b Compare November 20, 2025 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.