Run the following command to create a new project.
bashnpx create-rasengan@latest
GETTING STARTED
Rasengan.js takes care of all the complex parts of web development —routing, rendering, optimization, and performance— so you don’t have to. It scans your React components, automatically applies best practices, and generates the most efficient output for your project.
With Rasengan.js, you can focus on building your app, while it handles the difficult technical details behind the scenes. It’s —fast, flexible, and reliable— with minimal setup and zero hassle. 🚀
The best way to start a new Rasengan.js project is with create-rasengan CLI, which sets everything up for you automatically.
Just follow the following steps to get started:
Run the following command to create a new project.
bashnpx create-rasengan@latest
On the installation process, you will see the following prompts:
bash- What would you like to name your project? - Which language would you like to use for your project? - Which template would you like to use?
After the prompts, create-rasengan
will create a folder with your project name. Move yourself inside and install the required dependencies.
bashcd my-app npm install
Run the following command to start the development server.
bashnpm run dev
The following steps will guide you through setting up a new Rasengan.js project manually using TypeScript
.
Create a new folder first and move yourself inside.
Then generate a new package.json
file and install the required dependencies.
bashmkdir my-app cd my-app npm init -y npm install rasengan@latest @rasenganjs/serve@latest react@latest react-dom@latest npm install --save-dev cross-env vite@latest @types/react @types/react-dom @types/node typescript
Open the package.json
file and add the following scripts.
json"scripts": { "dev": "rasengan dev", "build": "rasengan build", "serve": "rasengan-serve ./dist" }
First, create the necessary directories at the root of your project.
public
: Contains static assets like icons and images.src
: Contains your application’s source code.Then, create the rasengan.config.js
configuration file.
bashmkdir public src touch rasengan.config.js
Open the rasengan.config.js
file and add the following configuration.
javascriptimport { defineConfig } from "rasengan"; export default defineConfig({});
Inside the src
directory, create an app
folder to store your application's pages.
Then create a home.page.tsx
and app.router.ts
files inside the app
directory.
Finally create a main.tsx
, template.tsx
and index.ts
files inside the src
directory.
bashmkdir src/app touch src/app/home.page.tsx src/app/app.router.ts touch src/main.tsx src/template.tsx src/index.ts
Open the home.page.tsx
file and add the following code to create a simple page.
jsximport { type PageComponent } from "rasengan"; const Home: PageComponent = () => { return ( <main>Home Page</main> ) } Home.path = "/"; Home.metadata = { title: "Home", description: "Home page", } export default Home;
Open the app.router.ts
file and add the following code to create a router.
javascriptimport { RouterComponent, defineRouter } from "rasengan"; import Home from "@/app/home.page"; class AppRouter extends RouterComponent {} export default defineRouter({ pages: [Home] })(AppRouter);
Open the main.tsx
file and add the following code to define the main component.
jsximport { type AppProps } from "rasengan"; import AppRouter from "@/app/app.router"; export default function App({ Component, children }: AppProps) { return <Component router={AppRouter}>{children}</Component>; }
Open the template.tsx
file and add the following code to define the template HTML.
jsximport { type TemplateProps } from "rasengan"; export default function Template({ Head, Body, Script }: TemplateProps) { return ( <html lang="en"> <Head> <meta charSet="UTF-8" /> <link rel="icon" type="image/svg+xml" href="/rasengan.svg" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> </Head> <Body> <Script /> </Body> </html> ); }
Open the index.ts
file and add the following code to define the entry point.
jsximport { renderApp } from 'rasengan/client'; import App from './main'; renderApp(App, { reactStrictMode: true });
Create new files called tsconfig.json
and rasengan-env.d.ts
at the root of your project.
bashtouch tsconfig.json rasengan-env.d.ts
Open the tsconfig.json
and rasengan-env.d.ts
files and add the following configuration.
json{ "compilerOptions": { "baseUrl": ".", "target": "ES2020", /* Bundler mode */ "moduleResolution": "bundler", "module": "ESNext", "jsx": "react-jsx", /* Aliases for intellisence */ "paths": { "@/*": ["src/*"] } }, "include": ["src", "rasengan-env.d.ts"], "extends": "./node_modules/rasengan/tsconfig.base.json" }
typescript/// <reference types="rasengan/types/client" />
Run the following command to start the development server.
bashnpm run dev