Skip to content

Contributing to Restura

This guide covers everything you need to set up your local development environment and start contributing to Restura.

Before you begin, ensure you have the following installed:

Clone the repository:

Terminal window
git clone https://github.com/redsky-engineering/restura.git

Navigate to the restura-ui directory and run the following command to start the Restura UI:

Terminal window
cd restura
cd apps/restura-ui
npm install
  • 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

The example Express app uses a PostgreSQL database running in Docker on port 5488.

Terminal window
# From the project root
cd apps/restura-express
# Start the database container
pnpm run startDevDockerDb

This starts a PostgreSQL 16.1 container with:

  • Port: 5488 (mapped to container’s 5432)
  • User: postgres
  • Password: postgres

Apply the schema migration to set up all tables, indexes, and triggers:

Terminal window
# From apps/restura-express directory
psql -h localhost -p 5488 -U postgres -f ./migrations/schema.sql

When prompted, enter the password: postgres

Populate the database with sample data for development:

Terminal window
psql -h localhost -p 5488 -U postgres -f ./migrations/data.sql

Once the database is set up, you can run the example Express application:

Terminal window
# From the project root
pnpm express:dev

This command:

  1. Rebuilds all workspace packages
  2. Compiles the Express app TypeScript
  3. Starts the development server

Alternatively, use tsx for faster iteration (skips compilation):

Terminal window
cd apps/restura-express
pnpm run devTsx

When contributing to @restura/core (packages/core/):

  1. Make your changes in packages/core/src/

  2. Restart the Express app to test your changes:

    Terminal window
    pnpm express:dev

To work on the visual editor (apps/restura-ui/):

Terminal window
# Start the Vite dev server
pnpm ui:start
Terminal window
pnpm test
Terminal window
# Core package tests
cd packages/core
pnpm test
Terminal window
# Lint all packages
pnpm lint
# Lint a specific package
cd packages/core
pnpm lint

When adding new features or fixing bugs, please include tests.

Tests in @restura/core use Mocha and Chai:

// packages/core/src/yourModule.test.ts
import { 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:

Terminal window
cd packages/core
pnpm test

This project uses:

Prettier runs automatically on staged files when you commit. To manually format:

Terminal window
pnpm exec prettier --write .
  1. Fork the repository and create a feature branch
  2. Write tests for new functionality
  3. Ensure all tests pass: pnpm test
  4. Lint your code: pnpm lint
  5. Submit a PR with a clear description of changes