react-edge
v0.1.50
Published
React Edge is a modern, high-performance web framework designed for building server-side rendered (SSR) applications with React. It leverages Cloudflare Workers for edge computing capabilities and provides a robust set of tools for developing, testing, an
Downloads
1,917
Readme
React Edge Framework
React Edge is a modern, high-performance web framework designed for building server-side rendered (SSR) applications with React. It leverages Cloudflare Workers for edge computing capabilities and provides a robust set of tools for developing, testing, and deploying web applications.
Getting Started
Installation
npm install react-edge
Key Components
App
The App
namespace provides types and interfaces for defining your application structure, including routes and server-side props.
Router Groups
Router groups allow you to:
- Group related routes under a common path prefix.
- Share common logic or data fetching for all routes within the group.
- Organize your routes more efficiently, especially for larger applications.
Benefits of using router groups:
- Code Organization: Keep related routes together, making your routing structure more readable and maintainable.
- Nested Routing: Easily create nested route structures, which is particularly useful for complex applications.
Worker
The Worker
namespace contains classes and utilities for handling requests, authentication, caching, and more.
CLI Commands
X Framework provides a set of CLI commands to help you develop, build, and deploy your application. Here are the available commands and their options:
General Command
yarn edge --help
Commands:
edge build Builds project
edge dev Starts a development server
edge deploy Deploys the project
edge logs Shows logs for the project
edge lint Run prettier and eslint
edge test Runs tests
edge type-check Runs type checking
Options:
-h, --help Show help [boolean]
--vite-config-dir The directory where the Vite config file is located
[string] [default: ".vite"]
--ts-config-dir The directory where the tsconfig file is located
[string] [default: ".tsconfig"]
--version Show version number [boolean]
Development Server
yarn edge dev --help
Starts a development server
Options:
-h, --help Show help [boolean]
--vite-config-dir The directory where the Vite config file is located
[string] [default: ".vite"]
--ts-config-dir The directory where the tsconfig file is located
[string] [default: ".tsconfig"]
--version Show version number [boolean]
--app Run the development server for the app only [boolean]
--env The Cloudflare Workers environment to target [string]
--remote Run the development server remotely [boolean]
--worker Run the development server for the worker only[boolean]
Build
yarn edge build --help
Builds project
Options:
-h, --help Show help [boolean]
--vite-config-dir The directory where the Vite config file is located
[string] [default: ".vite"]
--ts-config-dir The directory where the tsconfig file is located
[string] [default: ".tsconfig"]
--version Show version number [boolean]
--app Build the app only [boolean]
--env The Cloudflare Workers environment to target [string]
--mode The mode to build the project in
[string] [choices: "development", "production"]
--worker Build the worker only [boolean]
These CLI commands provide a convenient way to manage your X Framework project throughout its lifecycle, from development to deployment.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.