CORE CONCEPTS

Defining Routes

In Rasengan.js, each page is defined as a PageComponent. A page consists of a function returning a JSX element and includes metadata such as title, description, and keywords to improve SEO and page accessibility.

Define a Page

To define a page, create a new .page.tsx or .page.jsx file inside the app folder. Then, specify the page’s path and metadata.

Let's assume you are creating an About page accessible at /about. Below is how you can define it:

TypeScript
JavaScript
src/app/about.page.tsx
tsximport { PageComponent } from "rasengan"; const About: PageComponent = () => { return ( <div>About us</div> ); }; About.path = "/about"; About.metadata = { title: "About Us", description: "Learn more about our company", }; export default About;

Attach to a router

To attach a page to a router, import the page and attach it to the router.

src/app/app.router.tsx
tsximport { RouterComponent, defineRouter } from "rasengan"; import About from "@/app/about.page"; class AppRouter extends RouterComponent {} export default defineRouter({ pages: [About], //... })(AppRouter);

Now when you visit /about, you will see the About page.

Understanding Metadata

Metadata helps search engines and social media platforms understand your page content.

PropertyTypeDescription
titlestringThe title of the page
descriptionstringA short description of the page
Learn more about metadata
Details
Router
Layouts

Subscribe to the Newsletter

Stay informed to the news about rasengan.js including new releases, events, etc...

© 2025 Rasengan Labs, All rights reserved.