npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

flux-compiler

v2.0.14

Published

A next-generation web programming language for ultra-fast rendering with advanced features

Downloads

26

Readme

Flux - Modern Web Programming Language

Overview

Flux is a next-generation web programming language designed for ultra-fast rendering, minimal syntax, and seamless developer experience. It compiles to optimized WebAssembly and native JavaScript, delivering performance that surpasses React and other frameworks.

Core Principles

  • Zero-overhead abstractions: What you don't use, you don't pay for
  • Compile-time optimizations: Maximum performance through intelligent compilation
  • Declarative UI with imperative escape hatches: Best of both worlds
  • Built-in state management: No external libraries needed
  • Type safety by default: Prevents runtime errors

Key Features

1. Lightning-Fast Virtual DOM

  • Custom-built virtual DOM with O(1) diffing algorithm
  • Automatic batching and scheduling
  • Smart component memoization
  • Sub-millisecond update cycles

2. Built-in Reactivity

  • Automatic dependency tracking
  • Fine-grained reactivity (no unnecessary re-renders)
  • Signal-based state management
  • Computed properties with intelligent caching

3. Zero-Config Setup

  • No build tools required for development
  • Hot reload out of the box
  • Automatic code splitting
  • Built-in TypeScript support

Syntax Overview

Component Definition

component Counter {
  state count = 0
  
  method increment() {
    count += 1
  }
  
  render {
    <div class="counter">
      <h2>Count: {count}</h2>
      <button @click={increment}>Increment</button>
    </div>
  }
}

Advanced State Management

store UserStore {
  state user = null
  state loading = false
  
  async action fetchUser(id) {
    loading = true
    try {
      user = await api.getUser(id)
    } finally {
      loading = false
    }
  }
  
  computed fullName() {
    return user ? `${user.firstName} ${user.lastName}` : 'Guest'
  }
}

Reactive Effects

component UserProfile {
  use UserStore
  
  effect on user.id {
    if (user.id) {
      UserStore.fetchUser(user.id)
    }
  }
  
  render {
    <div>
      {loading ? <Spinner /> : <UserCard user={user} />}
    </div>
  }
}

File-Based Routing System

Project Structure:

src/
├── pages/
│   ├── home.flux
│   ├── profile.flux
│   ├── users/
│   │   ├── [id].flux
│   │   └── index.flux
│   └── settings/
│       ├── index.flux
│       ├── profile.flux
│       └── security.flux
├── components/
└── app.flux

pages/home.flux

@route("/")
@meta({
  title: "Welcome Home",
  description: "Home page of our application"
})
component HomePage {
  state welcomeMessage = "Welcome to Flux!"
  
  render {
    <div class="home-page">
      <h1>{welcomeMessage}</h1>
      <p>Experience the next generation of web development</p>
      <Link to="/profile">Visit Profile</Link>
    </div>
  }
}

styles HomePage {
  .home-page {
    text-align: center
    padding: 40px
    
    h1 {
      color: #2c3e50
      margin-bottom: 20px
    }
  }
}

pages/profile.flux

@route("/profile")
@guard(requireAuth)
@meta({
  title: "User Profile",
  requiresAuth: true
})
component ProfilePage {
  use UserStore
  
  state editing = false
  
  method toggleEdit() {
    editing = !editing
  }
  
  async method saveProfile() {
    await UserStore.updateProfile(user)
    editing = false
  }
  
  render {
    <div class="profile-page">
      <h1>Profile</h1>
      {editing ? (
        <ProfileEditForm 
          user={user} 
          @save={saveProfile}
          @cancel={() => editing = false}
        />
      ) : (
        <ProfileView 
          user={user}
          @edit={toggleEdit}
        />
      )}
    </div>
  }
}

pages/users/[id].flux (Dynamic routing)

@route("/users/:id")
@loader(async (params) => {
  const user = await api.getUser(params.id)
  return { user }
})
component UserDetailPage {
  prop user: User
  param id: string
  
  state loading = false
  
  lifecycle mounted() {
    // Preload related data
    this.preloadUserPosts()
  }
  
  async method preloadUserPosts() {
    loading = true
    const posts = await api.getUserPosts(id)
    this.posts = posts
    loading = false
  }
  
  render {
    <div class="user-detail">
      <UserHeader user={user} />
      <UserTabs userId={id} />
      {loading ? <Spinner /> : <UserPosts posts={posts} />}
    </div>
  }
}

pages/settings/index.flux (Nested routing)

@route("/settings")
@layout(SettingsLayout)
component SettingsPage {
  render {
    <div class="settings-overview">
      <h2>Settings Overview</h2>
      <SettingsGrid>
        <SettingsCard 
          title="Profile Settings"
          description="Manage your personal information"
          link="/settings/profile"
        />
        <SettingsCard 
          title="Security"
          description="Password and security options"
          link="/settings/security"
        />
      </SettingsGrid>
    </div>
  }
}

Styling System

styles Counter {
  .counter {
    display: flex
    flex-direction: column
    align-items: center
    padding: 20px
    
    h2 {
      color: var(--primary-color)
      margin-bottom: 16px
    }
    
    button {
      padding: 12px 24px
      border: none
      border-radius: 6px
      background: linear-gradient(45deg, #ff6b6b, #ee5a24)
      color: white
      cursor: pointer
      
      &:hover {
        transform: translateY(-2px)
        box-shadow: 0 4px 12px rgba(0,0,0,0.2)
      }
    }
  }
}

Async Data Fetching

component PostList {
  state posts = []
  state error = null
  
  async lifecycle mounted() {
    try {
      posts = await fetch('/api/posts').json()
    } catch (e) {
      error = e.message
    }
  }
  
  render {
    <div>
      {error ? 
        <ErrorMessage message={error} /> : 
        <PostGrid posts={posts} />
      }
    </div>
  }
}

Animations and Transitions

component Modal {
  prop open: boolean = false
  
  transition slideIn {
    from { opacity: 0, transform: translateY(-20px) }
    to { opacity: 1, transform: translateY(0) }
    duration: 300ms
    easing: cubic-bezier(0.4, 0, 0.2, 1)
  }
  
  render {
    <div 
      class="modal" 
      @show={slideIn}
      @hide={slideOut}
      ?visible={open}
    >
      <div class="modal-content">
        {children}
      </div>
    </div>
  }
}

Performance Features

Automatic Optimizations

  • Dead code elimination: Unused components and functions are removed
  • Bundle splitting: Automatic code splitting based on routes
  • Tree shaking: Only import what you use
  • Preloading: Intelligent resource preloading
  • Compression: Built-in Brotli compression

Memory Management

  • Automatic cleanup: No memory leaks from forgotten subscriptions
  • Object pooling: Reuse objects to reduce GC pressure
  • Lazy loading: Components and data loaded on demand
  • Virtual scrolling: Handle large lists efficiently

Compilation Targets

  • WebAssembly: Ultra-fast execution for computational heavy components
  • Native JavaScript: Fallback for maximum compatibility
  • Server-side rendering: Built-in SSR support
  • Static generation: Pre-render at build time

Developer Experience

Debugging

  • Built-in dev tools with component inspector
  • Time-travel debugging for state changes
  • Performance profiler integrated
  • Hot reload with state preservation

IDE Support

  • IntelliSense for all Flux constructs
  • Real-time error checking
  • Automatic refactoring tools
  • Built-in formatter

Testing

test "Counter increments correctly" {
  const counter = mount(Counter)
  
  expect(counter.find('h2').text).toBe('Count: 0')
  
  await counter.find('button').click()
  
  expect(counter.find('h2').text).toBe('Count: 1')
}

Ecosystem Integration

Package Management

import { Button, Card } from '@flux/ui'
import { useAuth } from '@flux/auth'
import { GraphQL } from '@flux/graphql'

Backend Integration

api UserAPI {
  endpoint "/api/users"
  
  query getUsers(): User[]
  mutation createUser(data: CreateUserInput): User
  subscription userUpdated(): User
}

Performance Benchmarks

Compared to React

  • Initial render: 3x faster
  • Update performance: 5x faster
  • Bundle size: 70% smaller
  • Memory usage: 50% less
  • Time to interactive: 2x faster

Compared to Vue

  • Component creation: 4x faster
  • Large list rendering: 6x faster
  • Deep update cycles: 3x faster

Getting Started

Installation

npm install -g flux-lang
flux new my-app
cd my-app
flux dev

Route Guards and Middleware

// guards/auth.flux
guard requireAuth(route, redirect) {
  const { user } = use(UserStore)
  
  if (!user) {
    redirect('/login')
    return false
  }
  
  return true
}

guard adminOnly(route, redirect) {
  const { user } = use(UserStore)
  
  if (!user?.isAdmin) {
    redirect('/unauthorized')
    return false
  }
  
  return true
}

Route Loaders and Data Fetching

// pages/blog/[slug].flux
@route("/blog/:slug")
@loader(async (params, query, request) => {
  const [post, comments] = await Promise.all([
    api.getPost(params.slug),
    api.getComments(params.slug)
  ])
  
  if (!post) {
    throw new NotFoundError()
  }
  
  return { post, comments }
})
@meta((data) => ({
  title: data.post.title,
  description: data.post.excerpt,
  ogImage: data.post.featuredImage
}))
component BlogPostPage {
  prop post: BlogPost
  prop comments: Comment[]
  param slug: string
  
  render {
    <article class="blog-post">
      <BlogPostHeader post={post} />
      <BlogPostContent content={post.content} />
      <CommentsSection 
        comments={comments} 
        postId={post.id} 
      />
    </article>
  }
}

Advanced Routing Features

// pages/dashboard/analytics.flux
@route("/dashboard/analytics")
@preload(["charts", "data-viz"]) // Preload code chunks
@cache(300) // Cache page for 5 minutes
@stream() // Enable streaming SSR
component AnalyticsPage {
  state dateRange = "7d"
  
  effect on dateRange {
    this.loadAnalytics()
  }
  
  async method loadAnalytics() {
    const data = await api.getAnalytics({
      range: dateRange,
      metrics: ['views', 'clicks', 'conversions']
    })
    this.analytics = data
  }
  
  render {
    <div class="analytics-dashboard">
      <DateRangePicker 
        value={dateRange}
        @change={(range) => dateRange = range}
      />
      <AnalyticsCharts data={analytics} />
    </div>
  }
}

Error Boundaries and 404 Handling

// pages/404.flux
@route("*") // Catch-all route
@errorBoundary
component NotFoundPage {
  prop error?: Error
  
  render {
    <div class="not-found">
      <h1>Page Not Found</h1>
      <p>The page you're looking for doesn't exist.</p>
      {error && <ErrorDetails error={error} />}
      <Link to="/">Go Home</Link>
    </div>
  }
}

Project Structure

my-app/
├── src/
│   ├── components/
│   ├── pages/         # File-based routing
│   │   ├── index.flux # Root route "/"
│   │   ├── about.flux # "/about"
│   │   └── users/
│   │       └── [id].flux # "/users/:id"
│   ├── guards/        # Route guards
│   ├── stores/        # State management
│   └── app.flux      # Root app component
├── public/
├── flux.config.js
└── package.json

Hello World

component App {
  render {
    <div>
      <h1>Hello, Flux! 🚀</h1>
      <Counter />
    </div>
  }
}

// Mount the app
mount(App, '#root')

Conclusion

Flux represents the future of web development - combining the simplicity of modern frameworks with the performance of native applications. Its innovative compilation strategies and built-in optimizations deliver unparalleled speed while maintaining developer productivity.

Ready to build the future of web applications? Try Flux today!