構建支援 55 種語言及各語言專屬網址的自架 Laravel CMS:RJ Nexus 的經驗
What we learned building a self-hosted Laravel CMS with 55 languages and per-language URLs
RJ Nexus 是基於 Laravel 12 的開源自架 CMS,支援 55 種語言及各語言專屬網址,並提供支援 80+ 個小工具的視覺化頁面編輯器。它內置無需 API key 的免費 AI 引擎,另可選用 OpenRouter,支援進階 SEO、內容撰寫及保留 HTML 的批量翻譯。項目亦採用兩層快取,並設有免用終端機的瀏覽器安裝程式。
I have been building RJ Nexus, a modern, self-hosted CMS on top of Laravel 12. You install it on your own hosting, keep full ownership of your data, and extend it with isolated plugins and themes.
It started small. Today it supports 55 languages with per-language URLs, ships with a visual page builder with 80+ widgets, and has a free AI engine that needs no API key.
This post is about the interesting problems along the way, and an invitation: the project is open source and I would love your help.
The problem: a CMS that treats every language as a first-class citizen
Many CMS setups bolt multilingual support on later. I wanted it built in from the start, which meant solving a few things properly.
Per-language slugs
A page should not have one URL with a language prefix glued on. It should have a real, SEO-friendly URL in each language:
/en/about
/az/haqqimizda
That sounds simple until you handle it everywhere: routing, the editor, the page builder, translations, and quick edits from the posts list.
A bug that taught me something
One of the nastiest bugs I hit was in validation. Laravel's validation was stripping translated slugs and content before they were saved, because the translated fields were not part of the validated data. Everything looked fine in the form, then silently vanished on save.
The lesson: when you build nested or dynamic fields (like translations[az][slug]), make sure your validation rules actually cover them, because validated data only contains what you validated.
Right-to-left languages
Arabic and Kurdish need right-to-left layouts. I handle this at the language level, so adding a new RTL language is mostly a matter of registering it, not rewriting templates.
Scaling the language list
Going from 17 to 38 and then to 55 languages exposed performance problems in places I did not expect. For example, the installer's language selection screen has a 3D planet animation. With 38 languages it stuttered, so the animation now calculates planet density, size, and stagger speed dynamically based on how many languages are available.
The page builder: RJBuilder
RJBuilder is a drag-and-drop builder with 80+ widgets, responsive controls, and dynamic tags. Each widget is two files:
- a PHP class that describes the widget (name, icon, category, settings schema) and prepares data in
render() - a Blade view with the markup, scoped CSS, and JavaScript
A few rules I follow for every widget:
- Every setting has a safe default, so a widget looks good the moment you drop it on a page.
-
Settings are sanitized in
render(): select values are whitelisted, colors are validated with a strict hex check, and list sizes are capped. - Everything is scoped to a unique instance ID, so several copies of the same widget can live on one page without clashing.
-
Accessibility is built in: real
<button>elements, ARIA attributes, keyboard navigation, andprefers-reduced-motionsupport.
The accordion widget is a good reference if you want to build your own.
A free AI engine
RJ Nexus has two AI modes:
-
Free AI: keyless, works out of the box. It powers the dashboard and global search (
Ctrl+K). - OpenRouter: optional, for advanced SEO, content writing, and bulk translation that preserves HTML.
Keeping a free, no-setup option mattered to me. Many people never configure an API key, and a feature nobody sets up is a feature nobody uses.
Performance on cheap hosting
Many CMS users run on shared hosting, so speed cannot depend on expensive infrastructure. RJ Nexus has a two-layer caching system:
| Layer | Package | Works on |
|---|---|---|
| Response Cache | spatie/laravel-responsecache |
Any PHP hosting |
| LiteSpeed LSCache | litespeed/lscache-laravel |
LiteSpeed / OpenLiteSpeed |
Response Cache is the universal baseline. On LiteSpeed hosts, pages can be served from the web server before PHP even starts.
Small things that make a big difference
A few features came from simply using the admin panel every day:
- Quick Edit: change a post's title, slug, and status straight from the list, without opening the editor.
- Marketing Post Generator: pick a post and design a social media graphic (PNG, JPG, or WebP, in every common social format) without leaving the admin panel.
-
A browser-based installer: upload the files, open
/install.php, and follow the steps. No terminal needed, which matters on shared hosting.
Try it
You can try the live demo here: rj-nexus.onrender.com (add /admin for the admin panel; demo credentials are in the README). The demo may not run the latest version.
- Website: rjnexus.org
- Documentation: rjnexus.org/en/docs
- Source code: github.com/rj-nexus/rj-nexus
How you can help
This is an open source project, and there are ways to contribute that do not require deep knowledge of the codebase:
- 🌍 Translations: add your language or improve an existing one.
- 📚 Documentation: pick a missing topic and write a guide.
- 🎨 Widgets: build new blocks for RJBuilder.
- 🤖 AI ideas: help us find useful places for the free AI in the dashboard.
Every contribution is recognized. Contributors are listed by name in the SUPPORTERS.md file and on the website, and earn supporter titles named after stars: Proxima, Vega, Sirius, and Polaris.
Open issues are here: github.com/rj-nexus/rj-nexus/issues
If you have built something multilingual before, I would love to hear how you handled per-language URLs. What would you do differently? Let me know in the comments. And if you find the project useful, a ⭐ on GitHub helps more than you might think.
來源:DEV Community · dev.to