Skip to content

Latest commit

 

History

History
152 lines (105 loc) · 3.3 KB

DEVELOPMENT.md

File metadata and controls

152 lines (105 loc) · 3.3 KB

Development Guide

This guide will help you set up your development environment for working with the CDK repository.

Prerequisites

Before you begin, ensure you have:

  • Git installed on your system
  • GitHub account
  • Basic familiarity with command line operations

Initial Setup

1. Fork and Clone the Repository

  1. Navigate to the CDK repository on GitHub
  2. Click the "Fork" button in the top-right corner
  3. Clone your forked repository:
git clone https://github.com/YOUR-USERNAME/cdk.git
cd cdk

2. Install Nix

CDK uses Nix for building, CI, and managing dev environment. Note: only Nix (the language & package manager) and not the NixOS (the Linux distribution) is needed. Nix can be installed on any Linux distribution and macOS.

While it is technically possible to not use Nix, it is highly recommended as it ensures consistent and reproducible environment for all developers.

Install Nix

You have 2 options to install nix:

Example:

> nix --version
nix (Nix) 2.9.1

The exact version might be different.

Enable nix flakes

If you installed Nix using the "determinate installer" you can skip this step. If you used the "official installer", edit either ~/.config/nix/nix.conf or /etc/nix/nix.conf and add:

experimental-features = nix-command flakes

If the Nix installation is in multi-user mode, don’t forget to restart the nix-daemon.

Use Nix Shell

  nix develop -c $SHELL  

Common Development Tasks

Building the Project

just build

Running Unit Tests

just test

Running Integration Tests

just itest REDB/SQLITE/MEMEORY

Running Format

just format

Running Clippy

just clippy

Running final check before commit

just final-check

Best Practices

  1. Branch Management

    • Create feature branches from main
    • Use descriptive branch names: feature/new-feature or fix/bug-description
  2. Commit Messages

    • Follow conventional commits format
    • Begin with type: feat:, fix:, docs:, chore:, etc.
    • Provide clear, concise descriptions
  3. Testing

    • Write tests for new features
    • Ensure all tests pass before submitting PR
    • Include integration tests where applicable

Troubleshooting

Common Issues

  1. Development Shell Issues
    • Clean Nix store: nix-collect-garbage -d
    • Remove and recreate development shell

Getting Help

  • Open an issue on GitHub
  • Check existing issues for similar problems
  • Include relevant error messages and system information
  • Reach out in Discord Invite link

Contributing

  1. Create a feature branch
  2. Make your changes
  3. Run tests and formatting
  4. Submit a pull request
  5. Wait for review and address feedback

Additional Resources

License

Refer to the LICENSE file in the repository for terms of use and distribution.