Installation
Get started with COSMOS RSC by setting up your development environment and installing the necessary dependencies.Prerequisites
Before you begin, ensure you have the following installed:- Node.js LTS - COSMOS RSC requires Node.js Long Term Support version
Install dependencies
After cloning or downloading the COSMOS RSC template, navigate to the project directory and install the required dependencies:- React 19 (Canary) - The latest React with Server Components support
- Webpack - Module bundler for building client and server bundles
- Tailwind CSS - Utility-first CSS framework
- Express - Web server framework
- React Server DOM Webpack - React Server Components runtime
COSMOS RSC uses React 19 canary releases to access the latest Server Components features. These are stable for production use in the Server Components context.
Project structure
Once installed, your project will have the following structure:Key directories
app/pages/- Create your pages here. The file structure maps directly to routes (e.g.,pages/about.js→/about)app/components/- Shared components used across your applicationapp/actions/- Server actions for handling forms and mutationsapp/root-layout.js- Root layout that wraps all pagescore/- Framework internals (you typically won’t need to modify these)
Development server
Start the development server to begin building your application:- Build your application with webpack
- Start the Express server
- Serve your application with hot module reloading
http://localhost:3000 (or the configured port).
The
npm start script runs both npm run build and npm run server sequentially. For faster iteration during development, you can run them separately in different terminals.Production build
To build your application for production:Next steps
Quick start
Learn how to create your first page with React Server Components