百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

faster_react

> 前端框架
开源

一个小巧的全栈 React 框架。避免过度优化。自动路由、重载和组件捆绑。它使用自己的 RSC 引擎,将 SSR 和 CSR 相结合。100% D

99 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一个小巧的全栈 React 框架。避免过度优化。自动路由、重载和组件捆绑。它使用自己的 RSC 引擎,将 SSR 和 CSR 相结合。100% D

faster_react

[!IMPORTANT]
Please give a star! ⭐

⚠️ Please note: Serverless functionality is temporarily unavailable due to recent changes to the Deno.bundle API. This will be fixed as soon as the Deno API allows it. ⚠️


Introduction

faster_react is a tiny Full-Stack React framework. He avoids Overengineering. This framework uses its own RSC engine, combining SSR and CSR, and automatically generates routes for React components. To utilize this, you must use the routes helper provided by the framework (React Router). The framework's configuration file is located at options.json.

What Does faster_react Do for You?

Focus solely on development! This framework handles:

  • ️ Automatic route generation for React components.
  • Automatic inclusion of new React components when framework => "dev": true.
  • Automatic frontend bundling when framework => "dev": true.
  • ♻️ Automatic browser reload when framework => "dev": true.
  • ️ Automatic frontend minification when framework => "dev": false.
  • Automatic backend reload when changes are detected and framework => "dev": true.
  • Automatic detection of Deno Deploy environment. Test in other serverless environments by setting framework => "serverless": true.

Note: The project includes a simple application example demonstrating each functionality. The example uses Tailwind CSS, but this is optional. You can use whatever CSS framework you want.


⚡ About Faster

This framework uses a middleware library called Faster. Faster is an optimized middleware server with an incredibly small codebase (~300 lines), built on top of native HTTP APIs with no dependencies. It includes a collection of useful middlewares:

  • Log file
  • ️ Serve static
  • CORS
  • Session
  • ⏱️ Rate limit
  • ️ Token
  • Body parsers
  • Redirect
  • Proxy
  • Handle upload

Fully compatible with Deno Deploy and other enviroments. Examples of all resources are available in the README. Faster's ideology is simple: all you need is an optimized middleware manager; all other functionality is middleware.


Contents

  • ⚡ Benchmarks
  • ️ Architecture
  • App Structure
    • Get Deno Kv and Deno Kv Fs
    • Backend API
    • Backend Components
    • Backend Files
    • ️ Frontend Components
    • Frontend CSS
    • Frontend Files
    • Frontend Translations
    • ️ Static
  • React Router
  • Packages Included
  • ️ Creating a Project
  • Running a Project
  • Deploy
  • References
  • ‍ About

⚡ Benchmarks

faster_react has only 0.9% of the code quantity of Deno Fresh.

Benchmark Command:

bash
# Deno Fresh
git clone https://github.com/denoland/fresh.git
cd fresh
git ls-files | xargs wc -l
# Output: 104132 (version 1.7.3)

# faster_react
git clone https://github.com/hviana/faster_react.git
cd faster_react
git ls-files | xargs wc -l
# Output: 1037 (version 20.1)

️ Architecture

This framework utilizes Headless Architecture [1] to build the application, combined with the Middleware Design Pattern [2] for defining API routes in the backend.

  • Headless Architecture provides complete freedom to the developer, reducing the learning curve. Despite this freedom, there is an explicit separation between backend and frontend, which aids in development.
  • The Middleware Design Pattern offers a practical and straightforward method for defining API routes.

App Structure

All application folders are inside the app folder.

Get Deno Kv and Deno Kv Fs

On the backend, if a Deno KV instance is available, access instances via Server.kv and Server.kvFs:

typescript
import { Server } from "faster";

See Deno KV settings in options.json.

  • Deno KV File System (Server.kvFs): Compatible with Deno Deploy. Saves files in 64KB chunks. Organize files into directories, control the KB/s rate for saving and reading files, impose rate limits, set user space limits, and limit concurrent operations—useful for controlling uploads/downloads. Utilizes the Web Streams API.

More details: deno_kv_fs


Backend API

  • Imports: Import your backend libraries here.
  • Organization: Files can be organized into subdirectories.
  • File Extension: Use .ts files.
  • Structure: Flexible file and folder structure that doesn't influence anything.
  • Routing: Define routes using any pattern you prefer.
  • Exports: Must have a default export with a function (can be asynchronous).
  • Function Input: Receives an instance of Server from faster.
  • Usage: Perform backend manipulations here (e.g., fetching data from a database), including asynchronous calls.
  • Routes: Define your custom API routes. For help, see: faster

Backend Components

  • Optionality: A backend component is optional for a frontend component.

  • Imports: Import your backend libraries here.

  • Organization: Organize files into subdirectories.

  • File Extension: Use .ts files.

  • Correspondence: Each file should have the same folder structure and name as the corresponding frontend component but with a .ts extension.

    • Example:
      • Frontend: frontend/components/checkout/cart.tsx
      • Backend: backend/components/checkout/cart.ts
  • Exports: Must have a default export with an object of type BackendComponent:

    typescript
    import { type BackendComponent } from "@helpers/backend/types.ts";
  • Usage: Intercept a frontend component request:

    • Before Processing (before?: RouteFn[]): List of middleware functions (see: faster). Use to check headers (ctx.req.headers) or search params (ctx.url.searchParams), like tokens, impose rate limits etc.

      Note: To cancel page processing, do not call await next() at the end of a middleware function.

      Important: If you want the page to be processed, do not consume the body of ctx.req, or it will cause an error in the framework.

    • After Processing (after?: (props: JSONObject) => void | Promise): Function receives the props that will be passed to the component. Add backend data to these props, such as data from a database. Can be asynchronous.

      Note: Only use props data in JSON-like representation, or hydration will fail.


Backend Files

  • Imports: Import your backend libraries here.
  • Organization: Organize files into subdirectories.
  • File Extension: Use .ts files.
  • Usage: Free to make exports or calls (including asynchronous).
  • Purpose: Group common functions/objects for backend/api, backend/components, and other backend/files, such as user validations.

️ Frontend Components

  • Imports: Use only frontend libraries.
  • Organization: Organize files into subdirectories.
  • File Extension: Use .tsx files.
  • Rendering: Rendered on the server and hydrated on the client.
  • Routes Generated: Two routes per file (e.g., frontend/components/checkout/cart.tsx):
    • Page Route: For rendering as a page, e.g., /pages/checkout/cart.
    • Component Route: For rendering as a component, e.g., /components/checkout/cart.
  • Initial Route (/): Points to frontend/components/index.tsx.
  • Exports: Must have a default export with the React Function/Component.
  • Props Passed to Component:
    • Form-submitted data (or JSON POST).
    • URL search parameters (e.g., /pages/myPage?a=1&b=2 results in {a:1, b:2}).
    • Manipulations from backend/components.

Frontend CSS

Application CSS style files.

  • Multiple Files: Automatically compiled.
  • Organization: Organize files into subdirectories.

Frontend Files

  • Imports: Use only frontend libraries.
  • Organization: Organize files into subdirectories.
  • File Extensions: Use .ts and .js files.
  • Usage: Free to make exports or calls (including asynchronous).
  • Difference from Components: Scripts are not automatically delivered to the client. They need to be imported by the frontend/components.
  • Purpose: Group common functions/objects for React Functions/Components, like form field validations. Can have frontend/files common to other frontend/files.

Frontend Translations

  • File Extensions: Use .json files.

  • Correspondence: Each file should have the same folder structure and name as the corresponding frontend component but with a .json extension.

    • Example:
      • Frontend: frontend/components/checkout/cart.tsx
      • Backend: frontend/translations/en/checkout/cart.json

      Note: Change en to your language.

  • Usage:

In frontend/components/index.tsx:

javascript
import {
  detectedLang,
  useTranslation,
} from "@helpers/frontend/translations.ts";
const Home = () => {
  const t = useTranslation();
  //Any .init parameter of i18next (minus ns) is valid in useTranslation.
  //Ex: useTranslation({ lng: ["es"], fallbackLng: "en" }) etc.
  //On the client side, the language is automatically detected (if you don't specify).
  //On the server, the language is "en" (if you don't specify).
  //The "en" is also the default fallbackLng.
  return (
    

  );
};
export default Home;

In frontend/translations/en/index.json:

json
{
  "appName": "My SaaS App {{endExample}}"
}

The framework translation is just a wrapper over i18next. See the i18next documentation if you have questions.


️ Static

Files served statically. Routes are generated based on the folder and file structure.

  • Example: localhost:8080/static/favicon.ico matches static/favicon.ico.

React Router

Since the framework has its own routing system, a third-party routing library is unnecessary. Use the framework helper:

Note: Direct form submissions for page routes path also work.

typescript
import { getJSON, route } from "@helpers/frontend/route.ts";

Interface Parameters:

…

Examples

Navigating to a Page with Search Params:

javascript
// URL search params passed as properties to the page. Props receive `{a:1}`

  Go to Test Page
;

Passing Additional Parameters:

javascript
// Props receive `{a:1, example:"exampleStr"}`

  Go to Test Page with Extra Data
;

Using Asynchronous Content:

javascript
// Props receive `{a:1, ...JSONResponse}`
 {
      return await getJSON({
        path: "/example/json",
        content: {
          test: "testData",
        },
      });
    },
  })}
>
  Go to Test Page with Async Data
;

Programmatic Routing:

typescript
(async () => {
  if (user.loggedIn) {
    await route({
      path: "/pages/dash",
      content: { userId: user.id, token: token },
    })();
  } else {
    await route({ path: "/pages/users/login" })();
  }
})();

Loading a Component:

javascript

  Load Counter Component
;

Making an API Call:

javascript
 {
    const res = await getJSON({
      path: "/example/json",
      content: {
        test: "testData",
      },
    });
    console.log(res);
    alert(JSON.stringify(res));
  }

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptdenofull-stack-web-developmentreactrsc

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架