Skip to content

sonalan/filact

Repository files navigation

Filact

A powerful React admin panel framework inspired by FilamentPHP - Build beautiful admin interfaces with minimal code.

License: MIT TypeScript React

Filact is a modern, type-safe React framework for building admin panels and back-office applications. Inspired by Laravel's FilamentPHP, it provides a declarative API to create complete CRUD interfaces with minimal boilerplate.

✨ Features

  • πŸš€ Rapid Development - Build complete admin panels in minutes, not days
  • πŸ“Š Complete CRUD - Full create, read, update, delete operations out of the box
  • 🎨 Type-Safe - Built with TypeScript for excellent IntelliSense and type safety
  • πŸ”„ Flexible Data Layer - REST and GraphQL providers with custom adapter support
  • πŸ“ Declarative Forms - Build complex forms with simple schema definitions
  • πŸ“‹ Powerful Tables - Sortable, filterable, paginated tables with search
  • 🎯 Actions System - Page, row, and bulk actions with confirmation dialogs
  • πŸ” Authorization - Built-in policy-based permission system
  • πŸͺ Lifecycle Hooks - React to data operations (beforeCreate, afterUpdate, etc.)
  • ⚑ Optimized Performance - TanStack Query for caching and optimistic updates
  • 🧩 React Hook Form - Performant form state management
  • βœ… Validation - Zod integration for runtime type checking
  • β™Ώ Accessible - WCAG 2.1 Level AA compliant components
  • 🎨 Beautiful UI - Modern interface with shadcn/ui components
  • πŸ“± Responsive - Mobile-first design that works on all devices
  • πŸ§ͺ Well Tested - 123+ tests covering unit, integration, E2E, and accessibility

πŸ“¦ Packages

Filact is a monorepo containing multiple packages:

  • @filact/core - Core library with data management, forms, tables, and hooks
  • @filact/ui - UI components built with shadcn/ui (coming soon)
  • @filact/cli - CLI tools for scaffolding (coming soon)

πŸš€ Quick Start

Installation

npm install @filact/core react react-dom
# or
pnpm add @filact/core react react-dom

Basic Example

import { createResource, createRestDataProvider, useResourceList } from '@filact/core'
import { z } from 'zod'

// 1. Define your model
interface User {
  id: number
  name: string
  email: string
  role: 'admin' | 'user'
}

// 2. Create data provider
const dataProvider = createRestDataProvider({
  baseURL: 'https://api.example.com',
})

// 3. Build resource
const userResource = createResource<User>(
  {
    name: 'User',
    pluralName: 'Users',
    endpoint: 'users',
    primaryKey: 'id',
  },
  dataProvider
)
  .form({
    fields: [
      { name: 'name', label: 'Name', type: 'text', required: true },
      { name: 'email', label: 'Email', type: 'email', required: true },
      { name: 'role', label: 'Role', type: 'select', options: [
        { value: 'admin', label: 'Admin' },
        { value: 'user', label: 'User' },
      ]},
    ],
    validation: z.object({
      name: z.string().min(1),
      email: z.string().email(),
      role: z.enum(['admin', 'user']),
    }),
  })
  .table({
    columns: [
      { key: 'id', label: 'ID', sortable: true },
      { key: 'name', label: 'Name', sortable: true, searchable: true },
      { key: 'email', label: 'Email', sortable: true },
      { key: 'role', label: 'Role', sortable: true },
    ],
  })
  .build()

// 4. Use in components
function UsersList() {
  const { data, isLoading } = useResourceList(userResource, {
    pagination: { page: 1, perPage: 10 },
  })

  if (isLoading) return <div>Loading...</div>

  return (
    <table>
      <thead>
        <tr>
          {userResource.table?.columns.map(col => (
            <th key={String(col.key)}>{col.label}</th>
          ))}
        </tr>
      </thead>
      <tbody>
        {data?.data.map(user => (
          <tr key={user.id}>
            <td>{user.id}</td>
            <td>{user.name}</td>
            <td>{user.email}</td>
            <td>{user.role}</td>
          </tr>
        ))}
      </tbody>
    </table>
  )
}

πŸ“š Documentation

πŸ—οΈ Architecture

Filact follows a layered architecture:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Your Application            β”‚
β”‚    (React Components, Pages)        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Filact Resources            β”‚
β”‚  (Forms, Tables, Actions, Hooks)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       Data Provider Layer           β”‚
β”‚    (REST, GraphQL, Custom)          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          Your Backend API           β”‚
β”‚   (REST API, GraphQL, etc.)         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Concepts

  1. Resources - Central configuration for CRUD operations on a model
  2. Data Providers - Abstract backend communication (REST, GraphQL, custom)
  3. Forms - Declarative form schemas with validation
  4. Tables - Sortable, filterable, paginated data tables
  5. Actions - Reusable operations at page, row, or bulk level
  6. Hooks - React hooks for data fetching and mutations
  7. Policies - Authorization rules for resources

🎯 Use Cases

Filact is perfect for:

  • πŸ“Š Admin Panels - Manage application data
  • 🏒 Back-office Applications - Internal business tools
  • πŸ“ˆ Dashboards - Data visualization and analytics
  • πŸ› οΈ CMS Systems - Content management interfaces
  • πŸ”§ API Clients - Visual interfaces for APIs

πŸ› οΈ Development

This is a pnpm monorepo using Turborepo.

Prerequisites

  • Node.js 18+
  • pnpm 8+

Setup

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Run tests
pnpm test

# Run tests in watch mode
pnpm test:watch

# Run E2E tests
pnpm test:e2e

# Run linter
pnpm lint

# Type check
pnpm typecheck

Package Development

# Work on core package
cd packages/core

# Watch mode for development
pnpm dev

# Run tests with coverage
pnpm test:coverage

# Run tests with UI
pnpm test:ui

πŸ§ͺ Testing

Filact has comprehensive test coverage:

  • Unit Tests - Component and hook testing with Vitest
  • Integration Tests - Full data flow testing with MSW
  • E2E Tests - Complete user journeys with Playwright
  • Accessibility Tests - WCAG compliance with axe-core

Total: 123+ tests ensuring reliability and quality.

🀝 Contributing

Contributions are welcome! Please read our Contributing Guide for details on:

  • Code of Conduct
  • Development process
  • How to submit pull requests
  • Coding standards

πŸ“ Changelog

See CHANGELOG.md for a list of changes.

πŸ—ΊοΈ Roadmap

Current Status (v0.1.0)

  • βœ… Core data management system
  • βœ… REST and GraphQL data providers
  • βœ… Resource builder with fluent API
  • βœ… Form builder with validation
  • βœ… Table builder with sorting/filtering
  • βœ… Actions system (page, row, bulk)
  • βœ… React hooks for CRUD operations
  • βœ… Lifecycle hooks
  • βœ… Authorization policies
  • βœ… Comprehensive test suite

Coming Soon (v0.2.0)

  • πŸ”œ UI component library (@filact/ui)
  • πŸ”œ CLI tools for scaffolding
  • πŸ”œ Documentation website
  • πŸ”œ Example applications
  • πŸ”œ Advanced features:
    • Real-time updates
    • File uploads
    • Export/Import
    • Internationalization (i18n)
    • Multi-tenancy
    • Charts and widgets

πŸ“„ License

MIT Β© Filact

See LICENSE for details.

πŸ’¬ Community & Support

πŸ™ Acknowledgments

Filact is inspired by:

  • FilamentPHP - The Laravel admin panel that inspired this project
  • React Admin - Pioneer in React admin frameworks
  • shadcn/ui - Beautiful, accessible component system

Built with amazing open source libraries:

⭐ Star History

If you find Filact useful, please consider giving it a star! ⭐


Made with ❀️ by the Filact team

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages