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

base-stack

> 前端框架
开源

开始使用 react-router v7 项目的最佳方法

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

工具介绍

开始使用 react-router v7 项目的最佳方法

Welcome to Forge 42 base-stack

This is a base-stack for Forge 42 projects. This stack is a starting point for all Forge 42 stacks with more advanced features. This is an ESM Vite stack with Remix.run / React Router v7.

It includes a basic setup for a project with react-router v7 framework mode and:

  • React 19 & react-compiler
  • TypeScript
  • TailwindCSS
  • Vite
  • Vitest (unit tests)
  • Scripting
  • Biome (linter & formatter)
  • i18n support (client and server)
  • Icons spritesheet generator
  • lefthook hooks
  • CI checks for quality control
  • react-router-devtools
  • Hono server
  • .env var handling for server and client
  • SEO robots.txt, sitemap-index and sitemap built in.

Internationalization

This stack uses i18next for internationalization. It supports both client and server side translations. Features included out of the box:

  • Support for multiple languages
  • Typesafe resources
  • client side translations are fetched only when needed
  • language switcher
  • language detector (uses the request to detect the language, falls back to your fallback language)

Hono server

This stack uses Hono for the server. More information about Hono can be found here. Another important thing to note is that we use a dependency called react-router-hono-server which is a wrapper for Hono that allows us to use Hono in our React Router application.

The server comes preconfigured with:

  • i18next middleware
  • caching middleware for assets
  • easily extendable global application context
  • .env injection into context

In order to add your own middleware, extend the context, or anything along those lines, all you have to do is edit the server inside the entry.server.tsx file.

.env handling

This stack parses your .env file and injects it into the server context. For the client side, in the root.tsx file, we use the useLoaderData hook to get the clientEnv from the server and set it as a global variable on the window called env. If you need to access the env variables in both environments, you can create a polyEnv helper like this:

typescript
// app/utils/env.ts
// This will return the process.env on the server and window.env on the client
export const polyEnv = typeof process !== "undefined" ? process.env : window.env;

The server will fail at runtime if you don't set your .env file properly.

Getting started

  1. Fork the repository

  2. Install the dependencies:

bash
pnpm install
  1. Read through the README.md files in the project to understand our decisions.

  2. Run the cleanup script:

bash
pnpm cleanup

This will remove everything in the project related to the base-stack like README.md etc. This is the first thing you should run after initializing the project. After it is run it will remove itself from the package.json.

  1. Start the development server:
bash
pnpm run dev
  1. Happy coding!

Issues· 0 开放

查看全部 Issues在 GitHub 打开

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

> 标签

TypeScriptbiomejshonoi18nextlefthook

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

> 工具信息

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

> 相关工具

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