AdonisJS ETL skaffold commands package - Generate ETL (Extract, Transform, Load) components for your AdonisJS applications.
- π Interactive CLI - Guided command to create ETL components
- π¦ Component Generation - Generate Source, Transform, and Destination classes
- π― Smart Naming - Automatic class naming based on your ETL process
- π§ TypeScript Ready - Full TypeScript support with proper interfaces
- π Organized Structure - Files are created in proper directories (
app/etl/)
node ace add @jrmc/adonis-etlYou can customize the directory where ETL files are generated by adding a directories configuration to your adonisrc.ts:
// adonisrc.ts
export default defineConfig({
directories: {
etl: 'etl', // Custom path for ETL files
},
// ... other configurations
})If not specified, files will be generated in the default app/etl/ directory.
Run the interactive command to create your ETL components:
node ace make:etl my-processThe command will guide you through:
-
Selecting components - Choose which ETL components to create:
- Source (data extraction)
- Transform (data transformation)
- Destination (data loading)
-
Defining source type - Specify your data source (e.g.,
database,api,file) -
Defining destination type - Specify your data destination (e.g.,
database,api,file)
$ node ace make:etl import-product
? Which ETL components do you want to create? βΊ
β―β Source
β Transform
β Destination
? What is the source type? (e.g., database, api, file) βΊ csv
? What is the destination type? (e.g., database, api, file) βΊ db
β
ETL files created successfully for: import-productThis will create (with default configuration):
app/etl/sources/import_product_csv_source.tsapp/etl/transforms/import_product_csv_to_db_transform.tsapp/etl/destinations/import_product_db_destination.ts
Or with custom directory configuration (directories.etl: 'etl'):
etl/sources/import_product_csv_source.tsetl/transforms/import_product_csv_to_db_transform.tsetl/destinations/import_product_db_destination.ts
import { Source } from '@jrmc/adonis-etl'
export default class ImportProductCsvSource implements Source {
async *each() {
// Implement your data extraction logic here
}
}import { Transform } from '@jrmc/adonis-etl'
export default class ImportProductCsvToDbTransform implements Transform {
async process(row: unknown) {
// Implement your data transformation logic here
return row
}
}import { Destination } from '@jrmc/adonis-etl'
export default class ImportProductDbDestination implements Destination {
async write(row: unknown) {
// Implement your data loading logic here
}
}The sample/ folder contains two complete ETL implementation examples:
This example shows a simple ETL process without transformation:
Command: node ace import:books
Components:
- Source:
book_csv_source.ts- Reads a CSV file of books (5M records) with batch processing (500 items) - Destination:
book_db_destination.ts- Inserts data into database viadb.table().multiInsert()
Features:
- Batch processing for performance optimization
- CSV error handling (empty lines and errors ignored)
- Optimized buffer (128KB) for large files
This example shows a complete ETL process with data transformation:
Command: node ace import:products
Components:
- Source:
product_csv_source.ts- Reads a CSV file of products (500K records) - Transform:
product_csv_to_db_transform.ts- Transforms CSV data (French column names β English) - Destination:
product_db_destination.ts- Saves via Lucid modelProduct.create()
Features:
- Column name transformation (e.g.,
Nomβname,Prixβprice) - AdonisJS model usage for persistence
- Data processing logging
sample/
βββ commands/
β βββ import_books.ts # Books import command
β βββ import_products.ts # Products import command
βββ etl/
β βββ sources/
β β βββ book_csv_source.ts
β β βββ product_csv_source.ts
β βββ transforms/
β β βββ product_csv_to_db_transform.ts
β βββ destinations/
β β βββ book_db_destination.ts
β β βββ product_db_destination.ts
β βββ resources/
β βββ books.csv # Sample data
β βββ products.csv # Sample data
βββ app/models/
βββ book.ts # Book model
βββ product.ts # Product model
These examples demonstrate different possible approaches:
- Batch processing vs line-by-line processing
- Direct database insertion vs Lucid model usage
- With or without data transformation
This package ships an agent skill for AI coding assistants (Claude Code, Cursor, etc.). It teaches the agent how to scaffold components with the right naming conventions, wire pipelines in Ace commands, and follow AdonisJS-specific best practices.
Install it in your project with:
npx skills add batosai/adonis-etlFor core ETL concepts, the @jrmc/etl package provides its own etl-pipeline skill.
For large-scale ETL operations, consider integrating with a job queue system (like BullMQ, or AdonisJS Queue package) to run ETL processes asynchronously, distribute workload across multiple workers, and improve reliability with automatic retry mechanisms.
This package requires:
@jrmc/etl- The core ETL library- AdonisJS 6.x or 7.x
- Node.js 22.17.0+
Generated files are organized in the following structure:
Default structure:
app/
βββ etl/
βββ sources/
β βββ your_source_files.ts
βββ transforms/
β βββ your_transform_files.ts
βββ destinations/
βββ your_destination_files.ts
Custom structure (with directories.etl: 'src/module/etl'):
src/
βββ module/
βββ etl/
βββ sources/
β βββ your_source_files.ts
βββ transforms/
β βββ your_transform_files.ts
βββ destinations/
βββ your_destination_files.ts
The generated class names follow this pattern:
- Source:
{process_name}_{source_type}_source - Transform:
{process_name}_{source_type}_to_{destination_type}_transform - Destination:
{process_name}_{destination_type}_destination
All names are automatically converted to snake_case for file names and PascalCase for class names.
Example: For process import-product with source csv and destination db:
- File:
import_product_csv_source.tsβ Class:ImportProductCsvSource - File:
import_product_csv_to_db_transform.tsβ Class:ImportProductCsvToDbTransform - File:
import_product_db_destination.tsβ Class:ImportProductDbDestination
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Jeremy Chaufourier
- Email: jeremy@chaufourier.fr
- GitHub: @batosai
- Fix: Corrected naming convention for classes
- Initial release
- Interactive ETL component generation
- Support for Source, Transform, and Destination components
- TypeScript support
- Custom directory configuration support via
directories.etlin adonisrc.ts