remix
Build Better Websites. Create modern, resilient user experiences with web fundamentals.
Top Related Projects
The React Framework
web development, streamlined
The Intuitive Vue Framework.
The best React-based framework with performance, scalability and security built in.
The web framework for content-driven websites. ⭐️ Star to support our work!
SolidStart, the Solid app framework
Quick Overview
Remix is a full-stack web framework built on React that focuses on web standards and modern web app UX. It provides a seamless way to build better websites by leveraging distributed systems and native browser features, offering a robust solution for server-side rendering, routing, and data loading.
Pros
- Excellent performance due to server-side rendering and intelligent code splitting
- Built-in error handling and progressive enhancement
- Seamless integration with existing web infrastructure and CDNs
- Strong focus on web standards and accessibility
Cons
- Steeper learning curve compared to some other React-based frameworks
- Relatively new framework, so the ecosystem is still growing
- Opinionated structure might not suit all project types
- Limited support for static site generation compared to some competitors
Code Examples
- Basic route component:
import { useLoaderData } from "@remix-run/react";
export async function loader() {
return { message: "Hello from the loader!" };
}
export default function Index() {
const data = useLoaderData();
return <h1>{data.message}</h1>;
}
- Form handling with action:
import { Form, useActionData } from "@remix-run/react";
export async function action({ request }) {
const formData = await request.formData();
const name = formData.get("name");
return { message: `Hello, ${name}!` };
}
export default function Greeting() {
const actionData = useActionData();
return (
<div>
<Form method="post">
<input type="text" name="name" />
<button type="submit">Greet</button>
</Form>
{actionData?.message && <p>{actionData.message}</p>}
</div>
);
}
- Error boundary:
export function ErrorBoundary({ error }) {
return (
<div>
<h1>Error</h1>
<p>{error.message}</p>
</div>
);
}
export default function Component() {
return <div>Normal component content</div>;
}
Getting Started
To create a new Remix project, run:
npx create-remix@latest my-remix-app
cd my-remix-app
npm run dev
This will set up a new Remix project and start the development server. You can then begin creating routes in the app/routes
directory and adding components to build your application.
Competitor Comparisons
The React Framework
Pros of Next.js
- Larger ecosystem and community support
- Built-in image optimization and internationalization
- Seamless integration with Vercel's hosting platform
Cons of Next.js
- More complex routing system
- Less flexible data loading and mutation
- Steeper learning curve for advanced features
Code Comparison
Next.js:
// pages/index.js
export async function getServerSideProps() {
const res = await fetch('https://api.example.com/data')
const data = await res.json()
return { props: { data } }
}
export default function Home({ data }) {
return <div>{data.title}</div>
}
Remix:
// app/routes/index.jsx
export async function loader() {
const res = await fetch('https://api.example.com/data')
return res.json()
}
export default function Index() {
const data = useLoaderData()
return <div>{data.title}</div>
}
The code comparison shows how data fetching is handled in both frameworks. Next.js uses getServerSideProps for server-side rendering, while Remix uses a loader function. Remix's approach is more straightforward and integrates better with React's component model.
Both frameworks are powerful tools for building modern web applications, but they have different philosophies and approaches to solving common problems. The choice between them often depends on specific project requirements and developer preferences.
web development, streamlined
Pros of SvelteKit
- Smaller bundle sizes and faster initial load times due to Svelte's compilation approach
- More intuitive and less boilerplate code for reactive components
- Built-in support for static site generation (SSG) out of the box
Cons of SvelteKit
- Smaller ecosystem and community compared to React-based frameworks
- Less mature and potentially fewer enterprise-level features
- Steeper learning curve for developers coming from traditional frameworks
Code Comparison
Remix component:
export default function Index() {
return (
<div>
<h1>Welcome to Remix</h1>
<ul>
<li><a href="/about">About</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
</div>
);
}
SvelteKit component:
<script>
let title = 'Welcome to SvelteKit';
</script>
<h1>{title}</h1>
<ul>
<li><a href="/about">About</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
Both frameworks offer server-side rendering and routing capabilities, but SvelteKit's syntax is more concise and reactive out of the box. Remix, being React-based, follows JSX conventions and may be more familiar to React developers.
The Intuitive Vue Framework.
Pros of Nuxt
- Built on Vue.js, offering a gentler learning curve for Vue developers
- Automatic code splitting and server-side rendering out of the box
- Strong ecosystem with a wide range of modules and plugins
Cons of Nuxt
- Potentially slower performance compared to Remix's data loading approach
- Less flexibility in routing and data fetching strategies
- More opinionated structure, which may limit customization options
Code Comparison
Nuxt route definition:
// pages/users/[id].vue
export default {
async asyncData({ params }) {
const user = await fetchUser(params.id)
return { user }
}
}
Remix route definition:
// app/routes/users/$userId.jsx
export async function loader({ params }) {
return await fetchUser(params.userId)
}
export default function User() {
const user = useLoaderData()
return <UserDetails user={user} />
}
Both frameworks offer server-side rendering and data fetching, but Remix's approach separates concerns more clearly and provides more granular control over data loading and component rendering.
The best React-based framework with performance, scalability and security built in.
Pros of Gatsby
- Extensive plugin ecosystem for easy integration of various features and data sources
- Strong focus on static site generation, resulting in excellent performance for content-heavy websites
- GraphQL-based data layer for efficient querying and management of content
Cons of Gatsby
- Steeper learning curve, especially for developers new to GraphQL
- Slower build times for large sites, which can impact development workflow
- Less flexibility for dynamic content and server-side rendering compared to Remix
Code Comparison
Gatsby (data fetching):
export const query = graphql`
query {
allMarkdownRemark {
edges {
node {
frontmatter {
title
}
}
}
}
}
`
Remix (data loading):
export async function loader({ params }) {
const posts = await getPosts();
return json({ posts });
}
Gatsby focuses on GraphQL queries for data fetching, while Remix uses more traditional JavaScript functions for loading data. This difference reflects their underlying architectures and approaches to data management.
Gatsby excels in static site generation and has a rich plugin ecosystem, making it ideal for content-heavy websites. However, it can be more complex to learn and slower to build large sites. Remix offers more flexibility for dynamic content and server-side rendering, with a simpler data loading approach, but may require more manual configuration for certain features that come built-in with Gatsby.
The web framework for content-driven websites. ⭐️ Star to support our work!
Pros of Astro
- Static site generation (SSG) with partial hydration, allowing for faster initial page loads
- Built-in support for multiple frontend frameworks within the same project
- Simpler learning curve for developers familiar with HTML and JavaScript
Cons of Astro
- Less suitable for highly dynamic applications requiring frequent client-side updates
- Limited built-in routing capabilities compared to Remix's file-based routing
- Smaller ecosystem and community support
Code Comparison
Astro component:
---
const { title } = Astro.props;
---
<h1>{title}</h1>
<slot />
Remix component:
import { useLoaderData } from "@remix-run/react";
export default function Component() {
const { title } = useLoaderData();
return <h1>{title}</h1>;
}
Key Differences
- Astro focuses on static site generation with optional client-side hydration
- Remix emphasizes server-side rendering and full-stack JavaScript applications
- Astro supports multiple frameworks in one project, while Remix is React-centric
- Remix offers more robust data loading and form handling capabilities
- Astro provides better performance for static content-heavy sites
Both frameworks have their strengths, with Astro excelling in static site generation and Remix shining in dynamic, data-driven applications. The choice between them depends on the specific project requirements and developer preferences.
SolidStart, the Solid app framework
Pros of Solid Start
- Leverages SolidJS's fine-grained reactivity for better performance
- Smaller bundle size due to SolidJS's compilation approach
- More flexible routing system with file-based and programmatic options
Cons of Solid Start
- Smaller ecosystem and community compared to Remix
- Less mature and fewer production-ready features
- Steeper learning curve for developers new to SolidJS
Code Comparison
Solid Start route example:
export default function Home() {
return <h1>Welcome to Solid Start</h1>;
}
Remix route example:
export default function Index() {
return <h1>Welcome to Remix</h1>;
}
Both frameworks use a similar file-based routing approach, but Solid Start offers more flexibility in route definition. Remix provides a more opinionated structure with built-in data loading and error handling.
Solid Start focuses on leveraging SolidJS's reactivity system for efficient updates, while Remix emphasizes server-side rendering and progressive enhancement. Remix has a larger ecosystem and more production-ready features, making it suitable for complex applications. Solid Start, being newer, offers potential performance benefits but may require more custom solutions for advanced use cases.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Welcome to Remix 3!
This is the source repository for Remix 3. It is under active development.
We published a blog post earlier this year with some of our thoughts around Remix 3. It explains our philosophy for web development and why we think the time is right for something new. When working on Remix 3, we follow these principles:
- Model-First Development. AI fundamentally shifts the human-computer interaction model for both user experience and developer workflows. Optimize the source code, documentation, tooling, and abstractions for LLMs. Additionally, develop abstractions for applications to use models in the product itself, not just as a tool to develop it.
- Build on Web APIs. Sharing abstractions across the stack greatly reduces the amount of context switching, both for humans and machines. Build on the foundation of Web APIs and JavaScript because it is the only full stack ecosystem.
- Religiously Runtime. Designing for bundlers/compilers/typegen (and any pre-runtime static analysis) leads to poor API design that eventually pollutes the entire system. All packages must be designed with no expectation of static analysis and all tests must run without bundling. Because browsers are involved,
--import
loaders for simple transformations like TypeScript and JSX are permissible. - Avoid Dependencies. Dependencies lock you into somebody else's roadmap. Choose them wisely, wrap them completely, and expect to replace most of them with our own package eventually. The goal is zero.
- Demand Composition. Abstractions should be single-purpose and replaceable. A composable abstraction is easy to add and remove from an existing program. Every package must be useful and documented independent of any other context. New features should first be attempted as a new package. If impossible, attempt to break up the existing package to make it more composable. However, tightly coupled modules that almost always change together in both directions should be moved to the same package.
- Distribute Cohesively. Extremely composable ecosystems are difficult to learn and use. Remix will be distributed as a single
remix
package for both distribution and documentation.
Goals
Although we recommend the remix
package for ease of use, all packages that make up Remix should be usable standalone as well. This forces us to consider package boundaries and helps us define public interfaces that are portable and interopable.
Each package in Remix:
- Has a single responsibility
- Prioritizes web standards to ensure maximum interoperability and portability across JavaScript runtimes
- Augments standards unobtrusively where they are missing or incomplete, minimizing incompatibility risks
This means Remix code is portable by default. Remix packages work seamlessly across Node.js, Bun, Deno, Cloudflare Workers, and other environments.
We leverage server-side web APIs when they are available:
- The Web Streams API instead of
node:stream
Uint8Array
instead of Node.jsBuffer
s- The Web Crypto API instead of
node:crypto
Blob
andFile
instead of some bespoke runtime-specific API
The benefit is code that's not just reusable, but future-proof.
Packages
We currently publish the following packages:
- fetch-proxy: Seamlessly construct HTTP proxies with the familiar
fetch()
API - file-storage: Robust key/value storage tailored for JavaScript
File
objects, simplifying file management - form-data-parser: An enhanced
request.formData()
wrapper enabling efficient, streaming file uploads - headers: A comprehensive toolkit for effortlessly managing HTTP headers
- lazy-file: Optimize performance with lazy-loaded, streaming
Blob
s andFile
s for JavaScript - multipart-parser: High-performance, streaming parser for multipart messages, perfect for handling complex form data
- node-fetch-server: Build Node.js HTTP servers using the web-standard
fetch()
API, promoting code consistency - route-pattern: A powerful and flexible URL pattern matching library
- tar-parser: A fast, streaming parser for tar archives, designed for efficient data extraction
Contributing
We welcome contributions! If you'd like to contribute, please feel free to open an issue or submit a pull request. See CONTRIBUTING for more information.
License
See LICENSE
Top Related Projects
The React Framework
web development, streamlined
The Intuitive Vue Framework.
The best React-based framework with performance, scalability and security built in.
The web framework for content-driven websites. ⭐️ Star to support our work!
SolidStart, the Solid app framework
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot