Skip to main content

Welcome Contributors

Thank you for your interest in contributing to the Accord Project Template Playground! This guide will help you understand our contribution process and standards.

Code of Conduct

The Template Playground follows the Accord Project Contribution Guidelines. We expect all contributors to:
  • Be respectful and inclusive
  • Welcome newcomers and help them learn
  • Focus on what is best for the community
  • Show empathy towards other community members

Getting Help

If you need assistance:

How to Contribute

Types of Contributions

We welcome various types of contributions:

Bug Fixes

Fix issues reported by users or found during development

New Features

Implement new functionality for the playground

Documentation

Improve guides, tutorials, and API documentation

Tests

Add or improve unit and E2E tests

Learning Modules

Create interactive learning experiences

UI/UX Improvements

Enhance the user interface and experience

Contribution Workflow

1

Find or Create an Issue

  • Check existing issues for something to work on
  • For new features or significant changes, create an issue first to discuss
  • Comment on the issue to let others know you’re working on it
2

Fork and Branch

# Fork the repository on GitHub, then clone your fork
git clone https://github.com/<YOUR_USERNAME>/template-playground.git
cd template-playground

# Add upstream remote
git remote add upstream https://github.com/accordproject/template-playground.git

# Create a feature branch
git checkout -b feature/your-feature-name
# or for bug fixes
git checkout -b fix/issue-number-description
3

Make Your Changes

  • Write clean, readable code following our style guide
  • Add tests for new functionality
  • Update documentation as needed
  • Ensure all tests pass: npm test
  • Run linting: npm run lint
4

Commit Your Changes

Write clear, descriptive commit messages:
git add .
git commit -m "feat: add template export functionality"
Follow Conventional Commits:
  • feat: New feature
  • fix: Bug fix
  • docs: Documentation changes
  • style: Code style changes (formatting, etc.)
  • refactor: Code refactoring
  • test: Adding or updating tests
  • chore: Maintenance tasks
5

Push and Create Pull Request

# Push to your fork
git push origin feature/your-feature-name
Then create a Pull Request on GitHub:
  • Use a clear title describing the change
  • Reference related issues (e.g., “Fixes #123”)
  • Describe what changed and why
  • Add screenshots for UI changes
6

Address Review Feedback

  • Respond to reviewer comments
  • Make requested changes
  • Push additional commits to your branch
  • Re-request review when ready

Code Standards

TypeScript Guidelines

Use strict TypeScript typing:
// Good - explicit types
interface Template {
  name: string;
  content: string;
  model: string;
}

function loadTemplate(template: Template): void {
  // ...
}

// Bad - using any
function loadTemplate(template: any) {
  // ...
}
Prefer async/await over promises:
// Good
async function rebuild() {
  const result = await generateTemplate();
  return result;
}

// Avoid
function rebuild() {
  return generateTemplate().then(result => {
    return result;
  });
}
Always handle errors appropriately:
try {
  const result = await rebuild(template, model, data);
  set({ agreementHtml: result, error: undefined });
} catch (error: unknown) {
  set({ 
    error: formatError(error), 
    isProblemPanelVisible: true 
  });
}

React Best Practices

Use functional components with hooks:
// Good
function EditorPanel() {
  const [value, setValue] = useState('');
  return <div>{value}</div>;
}

// Avoid class components unless necessary
Extract reusable logic into custom hooks:
function useDebounce<T>(value: T, delay: number): T {
  const [debouncedValue, setDebouncedValue] = useState(value);
  
  useEffect(() => {
    const handler = setTimeout(() => {
      setDebouncedValue(value);
    }, delay);
    
    return () => clearTimeout(handler);
  }, [value, delay]);
  
  return debouncedValue;
}
Use React.memo, useMemo, and useCallback for performance:
const MemoizedEditor = React.memo(Editor);

const handleChange = useCallback((value: string) => {
  setTemplateMarkdown(value);
}, [setTemplateMarkdown]);

const processedData = useMemo(() => {
  return complexProcessing(data);
}, [data]);

Code Style

We use ESLint for code quality. Key rules:
  • Indentation: 2 spaces
  • Semicolons: Required
  • Quotes: Single quotes for strings
  • Line length: 100 characters (soft limit)
  • Naming:
    • camelCase for variables and functions
    • PascalCase for components and types
    • UPPER_CASE for constants
# Check code style
npm run lint

# Many issues can be auto-fixed
npm run lint -- --fix

Testing Requirements

Test Coverage

All new code should include tests:
  • New features: Unit tests + E2E test for main flow
  • Bug fixes: Test that reproduces the bug + fix verification
  • Refactoring: Ensure existing tests still pass

Running Tests Before Submitting

# Run all tests
npm test
npm run test:e2e

# Ensure linting passes
npm run lint

# Check build succeeds
npm run build

Pull Request Guidelines

PR Title and Description

Good PR title:
feat: add PDF export functionality for templates
Good PR description:
## Summary
Adds the ability to export generated agreements as PDF files.

## Changes
- Add PDF export button to toolbar
- Integrate html2pdf.js library
- Add export options modal (page size, margins)
- Add unit tests for export logic
- Add E2E test for export workflow

## Related Issues
Closes #145

## Screenshots
[Screenshot of export button and modal]

## Testing
- [ ] Unit tests pass
- [ ] E2E tests pass
- [ ] Manual testing completed
- [ ] Tested in Chrome, Firefox, Safari

PR Checklist

Before submitting:
  • Code follows style guidelines
  • Self-review completed
  • Comments added for complex logic
  • Documentation updated
  • Tests added/updated
  • All tests pass
  • No console errors or warnings
  • Build succeeds
  • Git history is clean (squash if needed)

Review Process

What to Expect

  1. Initial Review: A maintainer will review within 1-3 business days
  2. Feedback: You may receive requests for changes
  3. Iteration: Address feedback and update the PR
  4. Approval: Once approved, a maintainer will merge

Review Criteria

Reviewers will check:
  • Code quality and style adherence
  • Test coverage and quality
  • Documentation completeness
  • Performance implications
  • Security considerations
  • Backward compatibility

Special Contribution Areas

Adding New Template Samples

To add a new sample:
  1. Create a new file in src/samples/ (e.g., mytemplate.ts)
  2. Export NAME, TEMPLATE, MODEL, and DATA:
export const NAME = "My Template";

export const TEMPLATE = `
Your TemplateMark content here
`;

export const MODEL = `
namespace org.example

concept MyData {
  o String field
}
`;

export const DATA = {
  "$class": "org.example.MyData",
  "field": "value"
};
  1. Add to src/samples/index.ts:
import * as mytemplate from './mytemplate';

export const SAMPLES = [
  // ... existing samples
  mytemplate,
];

Adding Learning Pathway Steps

Create interactive tutorials in src/constants/learningSteps/steps.ts using the Shepherd.js format.

AI Assistant Improvements

Contributions to src/ai-assistant/ should:
  • Support multiple LLM providers
  • Include proper error handling
  • Respect rate limits
  • Protect API keys

License

By contributing, you agree that your contributions will be licensed under the Apache License 2.0. All source code files should include:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 */

Recognition

All contributors are recognized in:
  • GitHub contributors list
  • Release notes for significant contributions
  • Project README (for major features)

Questions?

Don’t hesitate to ask:
  • Discord: Accord Project Community
  • GitHub: Comment on issues or discussions
  • Email: Reach out to the Accord Project team
Thank you for contributing to the Template Playground!

Next Steps

Development Setup

Get your environment ready

Project Architecture

Understand the codebase

Testing Guide

Learn our testing practices

Build docs developers (and LLMs) love