Contributing to Restura
This guide covers everything you need to set up your local development environment and start contributing to Restura.
Prerequisites
Section titled “Prerequisites”Before you begin, ensure you have the following installed:
- Node.js 18+
- pnpm 8+
- Docker Compose (required for PostgreSQL and running tests)
- PostgreSQL client (
psql) for database setup
Quick Start
Section titled “Quick Start”Clone the repository:
git clone https://github.com/redsky-engineering/restura.gitgit clone git@github.com:redsky-engineering/restura.gitNavigate to the restura-ui directory and run the following command to start the Restura UI:
cd resturacd apps/restura-uinpm installcd resturacd apps/restura-uipnpm installcd resturacd apps/restura-uiyarn installcd resturacd apps/restura-uibun installRepository Structure
Section titled “Repository Structure”Directorypackages
Directorycore # @restura/core - Restura Engine
Directorysrc
- …
- package.json
- tsconfig.json
Directoryinternal # @restura/internal - Shared utilities
Directorysrc
- …
- package.json
- tsconfig.json
Directoryapps
Directoryrestura-express # Test application that loads the Restura Engine
Directorymigrations
- schema.sql # SQL schema file needed for tests
- data.sql # SQL data file needed for tests
Directorysrc
- …
- docker-compose.local.yaml
- package.json
- tsconfig.json
Directoryrestura-ui # Visual editor
Directorysrc
- …
- package.json
- tsconfig.json
Directorydocs # Documentation website
Directorysrc
- …
- package.json
- tsconfig.json
Database Setup
Section titled “Database Setup”The example Express app uses a PostgreSQL database running in Docker on port 5488.
1. Start the PostgreSQL Container
Section titled “1. Start the PostgreSQL Container”# From the project rootcd apps/restura-express
# Start the database containerpnpm run startDevDockerDbThis starts a PostgreSQL 16.1 container with:
- Port:
5488(mapped to container’s5432) - User:
postgres - Password:
postgres
2. Create the Database Schema
Section titled “2. Create the Database Schema”Apply the schema migration to set up all tables, indexes, and triggers:
# From apps/restura-express directorypsql -h localhost -p 5488 -U postgres -f ./migrations/schema.sqlWhen prompted, enter the password: postgres
3. Load Initial Data
Section titled “3. Load Initial Data”Populate the database with sample data for development:
psql -h localhost -p 5488 -U postgres -f ./migrations/data.sqlRunning the Express App
Section titled “Running the Express App”Once the database is set up, you can run the example Express application:
# From the project rootpnpm express:devThis command:
- Rebuilds all workspace packages
- Compiles the Express app TypeScript
- Starts the development server
Alternatively, use tsx for faster iteration (skips compilation):
cd apps/restura-expresspnpm run devTsxDevelopment Workflow
Section titled “Development Workflow”Editing Restura Core
Section titled “Editing Restura Core”When contributing to @restura/core (packages/core/):
-
Make your changes in
packages/core/src/ -
Restart the Express app to test your changes:
Terminal window pnpm express:dev
Editing the UI
Section titled “Editing the UI”To work on the visual editor (apps/restura-ui/):
# Start the Vite dev serverpnpm ui:startRunning Tests
Section titled “Running Tests”Run All Tests
Section titled “Run All Tests”pnpm testRun Tests for a Specific Package
Section titled “Run Tests for a Specific Package”# Core package testscd packages/corepnpm testRun Linting
Section titled “Run Linting”# Lint all packagespnpm lint
# Lint a specific packagecd packages/corepnpm lintAdding Tests
Section titled “Adding Tests”When adding new features or fixing bugs, please include tests.
Core Package Tests
Section titled “Core Package Tests”Tests in @restura/core use Mocha and Chai:
// packages/core/src/yourModule.test.tsimport { expect } from 'chai';import { yourFunction } from './yourModule.js';
describe('yourFunction', () => { it('should do something', () => { const result = yourFunction('input'); expect(result).to.equal('expected output'); });});Run tests with:
cd packages/corepnpm testCode Style
Section titled “Code Style”This project uses:
- ESLint for code linting
- Prettier for code formatting
- Husky with lint-staged for pre-commit hooks
Prettier runs automatically on staged files when you commit. To manually format:
pnpm exec prettier --write .Pull Request Guidelines
Section titled “Pull Request Guidelines”- Fork the repository and create a feature branch
- Write tests for new functionality
- Ensure all tests pass:
pnpm test - Lint your code:
pnpm lint - Submit a PR with a clear description of changes