LunarX

raw JSON →
0.3.2 verified Fri May 01 auth: no javascript

LunarX is a lightweight SSR framework for React that emphasizes simplicity and flexibility, positioning itself as an alternative to Next.js and Remix. The current stable version is 0.3.2. It features file-based routing with minimal configuration, aiming for a simplified developer experience. Released under the MIT license, LunarX targets Node.js 16.8.0+. As an early-stage project (pre-1.0), it may undergo breaking changes. Key differentiators include a focus on being lightweight and less opinionated than established frameworks, though it lacks the ecosystem and maturity of Next.js or Remix.

error Error: Cannot find module 'lunarx/config'
cause Missing or incorrect import path for configuration utilities.
fix
Use 'import { defineConfig } from 'lunarx/config'' after installing the package.
error TypeError: LunarX.createApp is not a function
cause Default import used instead of named import.
fix
Change to 'import { LunarX } from 'lunarx''.
error Error: ENOENT: no such file or directory, open 'pages/index.jsx'
cause Missing pages directory or incorrect filename.
fix
Create a 'pages' directory with an index.jsx or index.tsx file.
gotcha File-based routing expects pages in a 'pages' directory by default; cannot be changed easily.
fix Ensure your project has a 'pages' folder at root or configure with 'routes' option.
deprecated The 'engine' option in createApp is deprecated in favor of 'server' since v0.3.0.
fix Use { server: { port: 3000 } } instead of { engine: { port: 3000 } }.
gotcha LunarX is in early development (pre-1.0); breaking changes may occur without major version bumps.
fix Pin exact version and test upgrades carefully.
npm install lunarx
yarn add lunarx
pnpm add lunarx

Creates a LunarX app with file-based routing from a 'pages' directory and starts the server on port 3000.

import { LunarX } from 'lunarx';

const app = LunarX.createApp({
  routes: 'pages',
  engine: {
    port: 3000,
  },
});

// pages/index.tsx
export default function Home() {
  return <h1>Hello LunarX!</h1>;
}

app.start().then(() => {
  console.log('Server running on http://localhost:3000');
});