Skip to main content
Thank you for your interest in contributing to Anchor! This guide will help you understand our development process and how to submit contributions.

Ways to Contribute

There are many ways to contribute to Anchor:
  • Report bugs - Found an issue? Let us know!
  • Suggest features - Have an idea? We’d love to hear it
  • Write code - Fix bugs or implement new features
  • Improve documentation - Help others understand Anchor better
  • Review pull requests - Share your expertise with the community
  • Answer questions - Help other users in discussions

Getting Started

1

Fork the repository

Click the “Fork” button on the Anchor GitHub repository to create your own copy.
2

Clone your fork

git clone https://github.com/YOUR_USERNAME/anchor.git
cd anchor
3

Set up your development environment

Follow the getting started guide to set up your local environment.
4

Create a feature branch

git checkout -b feature/your-feature-name
Use a descriptive branch name:
  • feature/add-note-templates
  • fix/sync-conflict-resolution
  • docs/update-api-reference

Development Workflow

Making Changes

1

Make your changes

Write your code following our coding standards (see below).
2

Test your changes

Ensure your changes work as expected:
cd server
pnpm test
pnpm build
3

Commit your changes

Write clear, descriptive commit messages:
git add .
git commit -m "Add note template feature"
Good commit messages:
  • “Fix sync conflict when editing same note offline”
  • “Add support for note templates”
  • “Update API documentation for tags endpoint”
Bad commit messages:
  • “fixed stuff”
  • “wip”
  • “changes”
4

Push to your fork

git push origin feature/your-feature-name

Submitting a Pull Request

1

Create a pull request

Go to the original Anchor repository and click “New Pull Request”. Select your fork and branch.
2

Fill out the PR template

Provide:
  • Description - What does this PR do?
  • Motivation - Why is this change needed?
  • Testing - How did you test this?
  • Screenshots - If applicable (UI changes)
3

Wait for review

A maintainer will review your PR. They may:
  • Approve and merge it
  • Request changes
  • Ask questions
Be patient and responsive to feedback!

Coding Standards

General Guidelines

  • Write clean, readable code
  • Follow the existing code style
  • Add comments for complex logic
  • Keep functions small and focused
  • Use meaningful variable names
  • Avoid unnecessary complexity

TypeScript/JavaScript (Server & Web)

// Descriptive names and clear logic
export async function createNote(
  userId: string,
  data: CreateNoteDto,
): Promise<Note> {
  const note = await this.prisma.note.create({
    data: {
      ...data,
      userId,
      createdAt: new Date(),
    },
  });
  
  return note;
}
TypeScript Best Practices:
  • Use TypeScript types, avoid any
  • Define interfaces for data structures
  • Use async/await over callbacks
  • Handle errors properly
  • Use ESLint and Prettier

Dart/Flutter (Mobile)

// Well-structured with proper naming
class NoteRepository {
  final Dio _dio;
  final NotesDao _notesDao;
  
  NoteRepository(this._dio, this._notesDao);
  
  Future<Note> createNote(CreateNoteDto dto) async {
    // Save locally first (offline-first)
    final localNote = await _notesDao.insertNote(dto);
    
    try {
      // Sync to server
      final response = await _dio.post('/api/notes', data: dto);
      return Note.fromJson(response.data);
    } catch (e) {
      // Return local note on error
      return localNote;
    }
  }
}
Flutter Best Practices:
  • Follow Effective Dart
  • Use Riverpod for state management
  • Keep widgets small and focused
  • Use const constructors where possible
  • Run dart format before committing

Database Migrations (Prisma)

When making schema changes:
cd server
pnpm exec prisma migrate dev --name descriptive_migration_name
Migration Naming Examples:
  • add_note_template_table
  • add_color_to_tags
  • rename_user_name_to_display_name

Testing Guidelines

Server Tests

Write unit tests for business logic:
describe('NotesService', () => {
  it('should create a note', async () => {
    const note = await service.createNote(userId, createNoteDto);
    expect(note.title).toBe(createNoteDto.title);
    expect(note.userId).toBe(userId);
  });
  
  it('should throw error when user not found', async () => {
    await expect(
      service.createNote('invalid-id', createNoteDto)
    ).rejects.toThrow();
  });
});

Web Tests

Test components and utilities:
import { render, screen } from '@testing-library/react';
import { NoteCard } from './NoteCard';

test('renders note title', () => {
  render(<NoteCard note={mockNote} />);
  expect(screen.getByText('My Note')).toBeInTheDocument();
});

Mobile Tests

Write widget and unit tests:
void main() {
  testWidgets('NoteCard displays title', (tester) async {
    await tester.pumpWidget(
      MaterialApp(home: NoteCard(note: mockNote)),
    );
    
    expect(find.text('My Note'), findsOneWidget);
  });
}

Documentation Standards

Code Documentation

/**
 * Creates a new note for the authenticated user.
 * 
 * @param userId - The ID of the user creating the note
 * @param data - The note data (title, content, tags)
 * @returns The created note with generated ID and timestamps
 * @throws UnauthorizedException if user is not authenticated
 */
export async function createNote(
  userId: string,
  data: CreateNoteDto,
): Promise<Note> {
  // Implementation
}

User Documentation

When adding features, update the relevant documentation:
  • Add examples to README files
  • Update API documentation
  • Add screenshots for UI changes
  • Update environment variable docs

Pull Request Checklist

Before submitting, ensure:
  • Code follows the style guidelines
  • All tests pass (pnpm test or flutter test)
  • Build succeeds (pnpm build or flutter build)
  • No linting errors (pnpm lint or dart analyze)
  • Documentation is updated
  • Commit messages are descriptive
  • Branch is up to date with main

Code Review Process

When your PR is submitted:
  1. Automated Checks - CI/CD runs tests and builds
  2. Maintainer Review - A maintainer reviews your code
  3. Feedback - You may receive comments or change requests
  4. Updates - Make requested changes and push updates
  5. Approval - Once approved, your PR will be merged
Review Timeline: Maintainers aim to review PRs within 3-5 business days. Please be patient and don’t spam with comments asking for updates.

Commit Message Format

We follow a simple commit message format:
<type>: <description>

[optional body]

[optional footer]
Types:
  • 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
Examples:
feat: add note template feature

fix: resolve sync conflict when editing same note offline

docs: update API documentation for tags endpoint

refactor: simplify note sharing logic

Branching Strategy

  • main - Stable release branch
  • develop - Integration branch (if used)
  • feature/* - Feature branches
  • fix/* - Bug fix branches
  • docs/* - Documentation branches
Always create PRs against main unless instructed otherwise.

Community Guidelines

Be Respectful

  • Treat everyone with respect and kindness
  • Welcome newcomers and help them learn
  • Assume good intentions
  • Provide constructive feedback

Be Professional

  • Keep discussions focused and on-topic
  • Avoid unnecessary debates
  • Accept feedback gracefully
  • Give credit where it’s due

Be Collaborative

  • Share knowledge and help others
  • Ask questions when unclear
  • Review others’ code thoughtfully
  • Celebrate community wins

Getting Help

If you need help:
  • Questions - Open a GitHub Discussion
  • Bugs - Create a GitHub Issue
  • Security - Email the maintainers privately
  • General Chat - Join community channels (if available)

Recognition

Contributors are recognized in:
  • GitHub contributors list
  • Release notes (for significant contributions)
  • Project README (for major features)
We appreciate every contribution, no matter how small!

License

By contributing to Anchor, you agree that your contributions will be licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). This ensures that:
  • Your contributions remain open source
  • Network users receive source code access
  • Derivative works must use the same license

Next Steps

Ready to contribute?
  1. Set up your development environment
  2. Review the architecture to understand the codebase
  3. Learn how to build the project
  4. Pick an issue or feature and start coding!
Thank you for contributing to Anchor! 🎉

Build docs developers (and LLMs) love