Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

westacks/vortex

Repository files navigation

Vortex

npm version License: MIT

Server-based routing for SPAs with framework-agnostic design

Vortex is a powerful, lightweight library that provides server-driven routing for single-page applications. Built with a philosophy that you should own all your code, it offers a flexible core with official adapters for React, Vue, Svelte, and SolidJS.

✨ Features

  • πŸš€ Framework Agnostic - Works with any frontend framework
  • πŸ“‘ Server-Driven Routing - Navigate without client-side routing
  • πŸ”„ Inertia.js Compatible - Works seamlessly with Inertia.js servers
  • ⚑ Performance Optimized - Built-in prefetching, polling, and caching
  • 🎯 SSR Ready - Server-side rendering support out of the box
  • πŸ”§ Extensible - Plugin system for custom functionality
  • πŸ“¦ All-in-One - Adapters and extensions included in core package

πŸš€ Quick Start

Installation

npm install @westacks/vortex

Basic Setup

import { createVortex } from '@westacks/vortex';
import inertia from '@westacks/vortex/inertia';
createVortex(async (target, page, install, ssr) => {
 // Install Inertia.js compatibility layer
 install(inertia(page.get()));
 
 // Your app setup here
 const app = document.createElement('div');
 app.textContent = 'Hello Vortex!';
 target.appendChild(app);
});

Framework Adapters

Vortex includes all framework adapters in the core package:

import { createVortex } from '@westacks/vortex';
import { createRoot } from 'react-dom/client';
createVortex(async (target, page, install, ssr) => {
 // React setup
 const root = createRoot(target);
 root.render(<App />);
});

πŸ“š Documentation

🎯 Core Concepts

Server-Driven Navigation

import { axios } from '@westacks/vortex';
// Navigate to a new page
axios.get('/dashboard');
// Submit a form
axios.post('/users', { name: 'John', email: 'john@example.com' });
// Update data
axios.patch('/users/1', { name: 'Jane' });

Form Handling

import { useForm } from '@westacks/vortex';
const form = useForm({
 name: '',
 email: ''
});
// Form is automatically reactive
form.name = 'John';
form.email = 'john@example.com';
// Submit with automatic error handling
form.post('/users');

Internal State Management

Vortex uses signals internally to manage page state and reactivity. You don't need to create signals yourself - Vortex handles this automatically.

πŸ”Œ Extensions

Vortex comes with two official built-in extensions:

  • Inertia.js Compatibility - Works seamlessly with Inertia.js servers
  • BProgress - Progress bar integration

Note: While Vortex works seamlessly with Inertia.js servers, the frontend API differs from the standard Inertia.js client.

🀝 Contributing

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

πŸ“„ License

MIT License - see LICENSE for details.

πŸ”— Links

About

Server-based routing for SPAs

Topics

Resources

License

Stars

Watchers

Forks

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /