Skip to main content

Project Structure

A DataSQRL project is structured as follows where {name} is the project name.

โ”œโ”€โ”€ {name}.sqrl                         # Contains the main data processing logic
โ”œโ”€โ”€ {name}-[run/test/prod]-package.json # Configuration files for running locally, testing, and deploying the project
โ”œโ”€โ”€ {name}-connectors/ # Contains source and sink table definitions, shared connector logic, schemas, and data files
โ”‚ โ””โ”€โ”€ sources-[run/test/prod].sqrl # Contains the source table definitions, split by variant or environment
โ”œโ”€โ”€ snapshots/ # Contains the snapshot data for tests
โ”‚ โ””โ”€โ”€ {name}/ # One directory per project
โ”œโ”€โ”€ {name}-api/ # Contains the API schema and operation definitions for the project
โ”‚ โ”œโ”€โ”€ schema.v1.graphqls # GraphQL schema definition
โ”‚ โ”œโ”€โ”€ tests/ # Contains GraphQL test queries as .graphql files
โ”‚ โ””โ”€โ”€ operations-v1/ # Contains any operation definitions as .graphql files
โ””โ”€โ”€ README.md # Explain the project(s) and structure

A project has one or more package.json configuration files to configure the compiled pipeline for different environments: running locally, testing, and one or more deployment environments. The targeted environment is used in the name, e.g. run, test, qa, prod, etc.

The package.json file is the authoritative source that defines the main SQRL script and (optional) GraphQL schema and operations. It also configures snapshot and test directories. Always consult the package.json files for the relative file paths to the project source files.

For advanced project or when multiple projects share one directory, the structure may include:

โ”œโ”€โ”€ [shared/authentication]-package.json # Config file that is shared across projects
โ”œโ”€โ”€ tests/ # Folder that contains test code to separate it from the main logic
โ”‚ โ””โ”€โ”€ {test-name}.sqrl # This file is included inline in the main script
โ”œโ”€โ”€ functions/ # User defined functions
โ””โ”€โ”€ shared.sqrl # SQRL script that's shared across projects