Skip to content

A production-grade React implementation built from scratch with Fiber, hooks, and concurrent features

License

Notifications You must be signed in to change notification settings

Kathalysth/spider-react

Repository files navigation

🕷️ Spider React

A production-grade React implementation built from scratch with modern features including Fiber architecture, concurrent rendering, hooks, and server-side rendering capabilities.

Build Status Coverage Status npm version License: MIT

🎯 Project Overview

Spider is a complete React library implementation following best practice coding standards. This project aims to provide:

  • Fiber Architecture: Modern reconciliation with time-slicing
  • Concurrent Features: useTransition, Suspense, and priority-based rendering
  • Complete Hooks System: All React hooks with custom hooks support
  • Server-Side Rendering: Streaming SSR with selective hydration
  • TypeScript First: Fully typed with strict mode
  • Production Ready: Comprehensive testing and performance optimization

🚀 Features

✅ Completed

  • Project setup and tooling configuration
  • Core element and component system
  • Basic reconciliation algorithm
  • DOM renderer implementation
  • Hooks system (useState, useEffect, etc.)
  • Fiber architecture
  • Concurrent rendering
  • Suspense and error boundaries
  • Server-side rendering
  • Developer tools integration

🔄 In Progress

  • Setting up core types and interfaces

📋 Planned

📦 Packages

Spider is organized as a monorepo with two main packages:

  • spider: Core React implementation
  • spider-dom: DOM renderer for browser environments

🛠️ Installation

# Install both packages
npm install spider spider-dom

# Or with yarn
yarn add spider spider-dom

📖 Quick Start

import { createElement, useState } from 'spider';
import { createRoot } from 'spider-dom';

function App() {
  const [count, setCount] = useState(0);

  return createElement('div', {}, [
    createElement('h1', {}, 'Hello Spider!'),
    createElement('p', {}, `Count: ${count}`),
    createElement(
      'button',
      {
        onClick: () => setCount(count + 1),
      },
      'Increment'
    ),
  ]);
}

const root = createRoot(document.getElementById('root')!);
root.render(createElement(App));

🏗️ Development

Prerequisites

Node.js 18.0.0 or higher npm 8.0.0 or higher

Setup

# Clone the repository
git clone https://github.com/kathalysth/spider-react.git
cd spider-react

# Install dependencies
npm install

# Build all packages
npm run build

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Start development mode
npm run dev

Project Structure

spider-react/
├── packages/
│ ├── spider/ # Core React implementation
│ └── spider-dom/ # DOM renderer
├── examples/ # Example applications
├── docs/ # Documentation
└── tools/ # Build and development tools

🧪 Testing

We maintain >95% test coverage across all packages:

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Generate coverage report
npm run test:coverage

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Process

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes with tests
  4. Ensure all tests pass (npm test)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Inspired by React and its excellent architecture
  • Built with modern tooling and best practices
  • Thanks to the React team for the incredible work

📊 Project Status

This is an active development project. See our roadmap for current progress and upcoming features.

Note: This is an educational and experimental implementation. For production applications, please use the official React library.

About

A production-grade React implementation built from scratch with Fiber, hooks, and concurrent features

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published