Thank you for your interest in contributing to SQLPage! This document will guide you through the contribution process.
- Install Rust and Cargo (latest stable version): https://www.rust-lang.org/tools/install
- If you contribute to the frontend, install Node.js too for frontend tooling: https://nodejs.org/en/download/
- Clone the repository
git clone https://github.com/sqlpage/sqlpage
cd sqlpageThe first time you build the project, dependencies will be downloaded, so you will need internet access, and the build may take a while.
Run the following command from the root of the repository to build the project in development mode:
cargo buildThe resulting executable will be in target/debug/sqlpage.
To build the project in release mode:
cargo build --releaseThe resulting executable will be in target/release/sqlpage.
SQLPage can either be built with an integrated odbc driver manager (static linking), or depend on having one already installed on the system where it is running (dynamic linking).
- Dynamic ODBC (default):
cargo build - Static ODBC (Linux and MacOS only):
cargo build --features odbc-static
Windows comes with ODBC pre-installed; SQLPage cannot statically link to the unixODBC driver manager on windows.
- Use
cargo fmt --allto format your Rust code - Run
cargo clippyto catch common mistakes and improve code quality - All code must pass the following checks:
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warningsWe use Biome for linting and formatting of the frontend code, and TypeScript to typecheck it.
npm install # once
npm run format # apply formatting
npm test # the check CI runs: biome, typecheck, and the frontend unit testsnpm test checks the entire frontend codebase (html, css, js, ts).
Run the backend tests:
cargo testBy default, the tests are run against an SQLite in-memory database.
If you want to run them against another database,
start a database server with docker compose up database_name (mssql, mysql, mariadb, or postgres)
and run the tests with the DATABASE_URL environment variable pointing to the database:
docker compose up mssql # or mysql, mariadb, postgres
export DATABASE_URL=mssql://root:Password123!@localhost/sqlpage
cargo testWe use Playwright for end-to-end testing of dynamic frontend features.
Tests are located in tests/end-to-end/. Key areas covered include:
Component tests use deterministic SQL applications under tests/end-to-end/fixtures/<suite>/.
Each suite contains an index.sql page and a test.ts file. Import test and expect from
../../fixture; the shared fixture opens the matching SQL page before every test and waits for
all SQLPage components to initialize. Prefer role, label, and text locators over CSS selectors
when the assertion does not specifically concern generated markup.
Keep official-site smoke and integration tests in root-level *.spec.ts files. Component behavior
tests should render real components through their SQL fixture; do not inject component markup or
invoke SQLPage's JavaScript initialization functions directly. Parameterized fixtures may accept
request variables when several tests need the same component with different data.
cd examples/official-site
cargo runIn a separate terminal, run the tests:
npm install
cd tests/end-to-end
npx playwright install chromium
npm run testPlaywright starts the component fixture server on port 8081 automatically. The official-site server on port 8080 must still be started separately as shown above.
When adding new components, comprehensive documentation is required. Example from a component documentation:
INSERT INTO component(name, icon, description, introduced_in_version) VALUES
('component_name', 'icon_name', 'Description of the component', 'version');
-- Document all parameters
INSERT INTO parameter(component, name, description, type, top_level, optional)
VALUES ('component_name', 'param_name', 'param_description', 'TEXT|BOOLEAN|INTEGER|JSON|ICON|COLOR|HTML|REAL|TIMESTAMP|URL', false, true);
-- Use description_md instead of description when the text contains markdown
INSERT INTO parameter(component, name, description_md, type, top_level, optional)
VALUES ('component_name', 'other_param', 'Set to `true` to see [the docs](/documentation.sql).', 'BOOLEAN', true, true);
-- Include usage examples
INSERT INTO example(component, description, properties) VALUES
('component_name', 'Example description in markdown', JSON('[
{"component": "new_component_name", "top_level_property_1": "value1", "top_level_property_2": "value2"},
{"row_level_property_1": "value1", "row_level_property_2": "value2"}
]'));Component documentation is stored in ./examples/official-site/sqlpage/migrations/.
If you are editing an existing component, edit the existing sql documentation file directly. If you are adding a new component, add a new sql file in the folder, and add the appropriate insert statements above.
When adding new SQLPage functions, document them using a SQL migrations. Example structure:
-- Function Definition
INSERT INTO sqlpage_functions (
"name",
"introduced_in_version",
"icon",
"description_md"
)
VALUES (
'your_function_name',
'1.0.0',
'function-icon-name',
'Description of what the function does.
### Example
select ''text'' as component, sqlpage.your_function_name(''parameter'') as result;
Additional markdown documentation, usage notes, and examples go here.
');
-- Function Parameters
INSERT INTO sqlpage_function_parameters (
"function",
"index",
"name",
"description_md",
"type"
)
VALUES (
'your_function_name',
1,
'parameter_name',
'Description of what this parameter does and how to use it.',
'TEXT|BOOLEAN|INTEGER|JSON'
);Key elements to include in function documentation:
- Clear description of the function's purpose
- Version number where the function was introduced
- Appropriate icon
- Markdown-formatted documentation with examples
- All parameters documented with clear descriptions and types
- Security considerations if applicable
- Example usage scenarios
- Create a new branch for your feature/fix:
git checkout -b feature/your-feature-name- Make your changes, ensuring:
- All tests pass
- Code is properly formatted
- New features are documented
- tests cover new functionality
CHANGELOG.mdhas an entry for any user-visible change
-
Push your changes and create a Pull Request
-
CI Checks Our CI pipeline will automatically:
- Run Rust formatting and clippy checks
- Execute all tests across multiple platforms (Linux, Windows)
- Build Docker images for multiple architectures
- Run frontend linting, typechecking and unit tests (
npm test) - Test against multiple databases (SQLite, PostgreSQL, MySQL, MSSQL, Oracle, and ODBC)
Releases are automated when pushing tags that match the pattern v* (e.g., v1.0.0). The CI pipeline will:
- Build and test the code
- Create Docker images for multiple architectures
- Push images to Docker Hub
- Create GitHub releases
If you have any questions, feel free to open an issue or discussion on GitHub.