@photostructure/sqlite
    Preparing search index...

    Development

    Information about the development of @photostructure/sqlite.

    This project demonstrates modern software development practices with AI assistance:

    • 900+ lines of C++ - Core SQLite binding implementation
    • 17,000+ lines of TypeScript tests - Comprehensive test coverage
    • 400+ tests with full API compliance running in both ESM and CJS modes
    • Multi-platform CI/CD with dedicated ARM64 and x64 build jobs across all platforms
    • Security scanning and memory leak detection
    • Automated sync from Node.js and SQLite upstream
    • Robust benchmarking suite including all popular Node.js SQLite libraries

    This project was built with substantial assistance from Claude Code, an AI coding assistant.

    • API usage: ~$1400 in Claude API tokens
    • Actual cost: $200/month MAX 20x plan subscription
    • Time saved: At least a month of setup, analysis, porting and testing
    1. Initial Analysis: Claude analyzed the Node.js SQLite source code and architecture
    2. Shim Layer Design: Developed compatibility layer for Node.js internals
    3. Implementation: Ported C++ code with N-API adaptations
    4. Testing: Created comprehensive test suite with 400+ tests
    5. Documentation: Generated user and API documentation
    6. CI/CD: Set up multi-platform build and release pipeline

    While AI significantly accelerated development, all code underwent:

    • Human review before merging
    • Comprehensive automated testing
    • Memory leak detection (Valgrind, ASAN)
    • Security scanning (npm audit, OSV, CodeQL)
    • Performance benchmarking

    This approach demonstrates how AI-assisted development can accelerate complex system programming while maintaining high code quality through comprehensive testing and human oversight.

    • Node.js 20+
    • Python 3.8+
    • C++ compiler:
      • Linux: GCC 10+ or Clang 10+
      • macOS: Xcode Command Line Tools
      • Windows: Visual Studio 2019+
    # Install dependencies
    npm install

    # Build native module
    npm run build:native

    # Run tests
    npm test

    # Run benchmarks
    npm run benchmark
    # Watch mode for TypeScript
    npm run watch

    # Lint code
    npm run lint

    # Format code
    npm run fmt

    # Run specific test file
    npm test -- working-with-data.test.ts

    See Architecture Documentation for details on:

    • Shim layer design
    • Node.js compatibility approach
    • Memory management strategy
    • Threading model
    1. Fork the repository
    2. Create a feature branch
    3. Make your changes
    4. Add tests for new functionality
    5. Ensure all tests pass
    6. Submit a pull request
    • TypeScript/JavaScript: Prettier with project config
    • C++: clang-format with project style
    • Commit messages: Conventional Commits format
    • New features must include tests
    • Tests must pass on all platforms
    • Memory leak tests for native code
    • Benchmark comparisons for performance changes

    See Release Process for detailed release instructions.

    The project maintains synchronization with:

    • Node.js SQLite implementation
    • SQLite amalgamation source

    To avoid rate limiting when syncing from GitHub (60 requests/hour for unauthenticated requests), set up authentication:

    # Set your GitHub personal access token
    export GITHUB_TOKEN=your_personal_access_token

    # Now sync commands will use authentication (5000 requests/hour)
    npm run sync:node
    npm run sync:sqlite

    You can create a personal access token at: https://github.com/settings/tokens

    The token only needs public repository read access.

    # Sync from Node.js
    npm run sync:node

    # Update SQLite version
    npm run sync:sqlite