Top Related Projects
The React Framework
Build Better Websites. Create modern, resilient user experiences with web fundamentals.
web development, streamlined
The Intuitive Vue Framework.
The best React-based framework with performance, scalability and security built in.
Next generation frontend tooling. It's fast!
Quick Overview
Aleph.js is a full-stack framework for building modern web applications, inspired by Next.js and Deno. It leverages the power of Deno, a secure runtime for JavaScript and TypeScript, to provide a fast and efficient development experience with built-in TypeScript support, server-side rendering, and more.
Pros
- Built on Deno, offering enhanced security and modern JavaScript features
- Zero-config setup with built-in TypeScript support
- Server-side rendering and static site generation capabilities
- Fast development experience with hot module replacement
Cons
- Smaller ecosystem compared to more established frameworks like Next.js
- Limited to Deno runtime, which may not be as widely adopted as Node.js
- Learning curve for developers unfamiliar with Deno
- Some features and integrations may not be as mature as in other frameworks
Code Examples
- Creating a basic page component:
import React from 'react'
export default function HomePage() {
return (
<div>
<h1>Welcome to Aleph.js!</h1>
<p>This is a basic page component.</p>
</div>
)
}
- Using the
useDeno
hook for server-side data fetching:
import React from 'react'
import { useDeno } from 'aleph/react'
export default function DataFetchingPage() {
const data = useDeno(async () => {
const response = await fetch('https://api.example.com/data')
return response.json()
})
return (
<div>
<h1>Data Fetching Example</h1>
<pre>{JSON.stringify(data, null, 2)}</pre>
</div>
)
}
- Creating an API route:
import type { APIHandler } from 'aleph/types.ts'
export const handler: APIHandler = ({ response }) => {
response.json({ message: 'Hello from Aleph.js API!' })
}
Getting Started
To get started with Aleph.js, follow these steps:
- Install Deno: https://deno.land/#installation
- Install Aleph.js CLI:
deno install -A -f -n aleph https://deno.land/x/aleph@v0.3.0-beta.19/cli.ts
- Create a new Aleph.js project:
aleph init my-aleph-app cd my-aleph-app
- Start the development server:
aleph dev
Your Aleph.js application is now running at http://localhost:8080
.
Competitor Comparisons
The React Framework
Pros of Next.js
- Larger ecosystem and community support
- More extensive documentation and learning resources
- Better integration with Vercel's deployment platform
Cons of Next.js
- Larger bundle size and potentially slower performance
- More complex configuration and setup process
- Less flexibility in routing and file structure
Code Comparison
Next.js:
// pages/index.js
export default function Home() {
return <h1>Welcome to Next.js!</h1>
}
Aleph.js:
// pages/index.tsx
export default function Home() {
return <h1>Welcome to Aleph.js!</h1>
}
Key Differences
- Aleph.js is built on Deno, while Next.js uses Node.js
- Aleph.js focuses on performance and simplicity, while Next.js offers more features and integrations
- Aleph.js has a smaller learning curve but fewer advanced features compared to Next.js
Use Cases
- Next.js: Large-scale applications, complex server-side rendering needs, and projects requiring extensive third-party integrations
- Aleph.js: Lightweight applications, projects prioritizing performance, and developers familiar with Deno
Community and Support
Next.js has a larger and more active community, resulting in more frequent updates, plugins, and third-party tools. Aleph.js, being newer, has a smaller but growing community with potential for rapid development and innovation.
Build Better Websites. Create modern, resilient user experiences with web fundamentals.
Pros of Remix
- More mature and widely adopted framework with a larger community
- Built-in support for server-side rendering and data loading
- Extensive documentation and learning resources
Cons of Remix
- Steeper learning curve for developers new to server-side rendering
- Requires more setup and configuration compared to simpler frameworks
Code Comparison
Remix route file:
export async function loader({ params }) {
const user = await getUser(params.id);
return json({ user });
}
export default function UserProfile() {
const { user } = useLoaderData();
return <h1>{user.name}</h1>;
}
Aleph.js page file:
export async function getData({ params }) {
const user = await getUser(params.id);
return { user };
}
export default function UserProfile({ data }) {
return <h1>{data.user.name}</h1>;
}
Both frameworks offer similar approaches to data fetching and rendering, with Remix using a loader function and Aleph.js using a getData function. Remix's useLoaderData hook provides a more integrated way to access server-side data, while Aleph.js passes data directly as props to the component.
web development, streamlined
Pros of SvelteKit
- Larger community and ecosystem, with more resources and third-party integrations
- Built-in support for server-side rendering (SSR) and static site generation (SSG)
- More mature and stable, with a longer development history
Cons of SvelteKit
- Steeper learning curve, especially for developers new to Svelte
- Larger bundle size compared to Aleph.js, which may impact initial load times
- Less focus on modern web APIs and standards like ES modules
Code Comparison
Aleph.js routing:
export default function Home() {
return <h1>Welcome to Aleph.js!</h1>
}
SvelteKit routing:
<script>
export let name = 'world';
</script>
<h1>Hello {name}!</h1>
Key Differences
- Aleph.js is built on top of Deno, while SvelteKit uses Node.js
- Aleph.js focuses on simplicity and modern web standards, while SvelteKit offers more features out of the box
- Aleph.js uses React-like JSX syntax, whereas SvelteKit uses its own template syntax
Conclusion
Both Aleph.js and SvelteKit are powerful frameworks for building web applications. Aleph.js excels in simplicity and modern web standards, while SvelteKit offers a more comprehensive feature set and larger ecosystem. The choice between the two depends on project requirements, team expertise, and personal preferences.
The Intuitive Vue Framework.
Pros of Nuxt
- Larger ecosystem and community support
- More comprehensive documentation and learning resources
- Better integration with Vue.js ecosystem and plugins
Cons of Nuxt
- Heavier bundle size and potentially slower performance
- More complex configuration and setup process
- Steeper learning curve for beginners
Code Comparison
Nuxt.js routing:
// pages/index.vue
export default {
asyncData({ params }) {
// Fetch data here
}
}
Aleph.js routing:
// pages/index.tsx
export default function Index() {
return <div>Hello World</div>
}
Nuxt focuses on a file-based routing system with Vue components, while Aleph.js uses React components and a more explicit routing approach. Nuxt provides built-in async data fetching, whereas Aleph.js relies on React hooks for similar functionality.
Nuxt offers a more opinionated structure and extensive features out of the box, making it suitable for large-scale applications. Aleph.js, being lighter and faster, is ideal for smaller projects or those requiring high performance.
Both frameworks aim to simplify server-side rendering and static site generation, but Nuxt has a more mature ecosystem and wider adoption in the Vue.js community. Aleph.js, leveraging Deno, provides a modern development experience with built-in TypeScript support and no need for configuration files.
The best React-based framework with performance, scalability and security built in.
Pros of Gatsby
- Mature ecosystem with extensive plugin library
- Strong community support and documentation
- Excellent performance optimization features
Cons of Gatsby
- Steeper learning curve, especially for GraphQL
- Slower build times for large sites
- Higher resource consumption
Code Comparison
Gatsby:
import React from "react"
import { graphql } from "gatsby"
export default function Home({ data }) {
return <div>{data.site.siteMetadata.title}</div>
}
export const query = graphql`
query HomePageQuery {
site {
siteMetadata {
title
}
}
}
`
Aleph.js:
import React from 'react'
export default function Home() {
return <div>Hello Aleph.js!</div>
}
Aleph.js offers a simpler setup without GraphQL, while Gatsby requires GraphQL for data querying. Gatsby's approach provides more flexibility for complex data structures but may be overkill for simpler projects. Aleph.js aims for a more straightforward development experience, potentially leading to faster development cycles for certain types of applications.
Next generation frontend tooling. It's fast!
Pros of Vite
- Broader ecosystem support and plugin availability
- Faster build times for larger projects
- More flexible configuration options
Cons of Vite
- Steeper learning curve for beginners
- Less opinionated, requiring more setup for complex projects
Code Comparison
Vite configuration:
// vite.config.js
export default {
plugins: [react()],
build: {
rollupOptions: {
// Custom rollup options
}
}
}
Aleph.js configuration:
// aleph.config.js
export default {
plugins: ['react'],
build: {
// Aleph.js specific build options
}
}
Summary
Vite offers a more flexible and powerful build tool suitable for various project types, with extensive plugin support and faster build times for larger projects. However, it may require more setup and configuration.
Aleph.js provides a more opinionated and streamlined approach, making it easier for beginners to get started, especially with Deno-based projects. It offers a simpler configuration but may have limitations for complex use cases.
Both tools aim to improve development experience and build performance, with Vite having a broader adoption across different frameworks and Aleph.js focusing on Deno and React applications.
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
â ï¸ Not yet 1.0. Many things are subject to change. Documentation is lacking in many places. Try it out and give us feedback!
Some demo apps deployed to Deno Deploy with the new architecture:
- React App: https://aleph-hello.deno.dev/
- REST API: https://aleph-api.deno.dev/
- React 18 Suspense SSR: https://aleph-suspense-ssr.deno.dev/
- UnoCSS(tailwind): https://aleph-unocss.deno.dev/
- Monaco Editor: https://aleph-monaco-editor.deno.dev/
- Yew SSR: https://aleph-yew.deno.dev/
- Github OAuth Middleware: https://aleph-github-oauth.deno.dev/
Source code: https://github.com/alephjs/aleph.js/tree/main/examples
Real-world Apps
- Deno Deploy: https://dash.deno.com
- Meet Me: https://meet-me.deno.dev (source)
Get started
Initialize a new project, you can pick a start template with --template
flag, available templates:
[react, react-mdx, api, yew]
deno run -A -r https://alephjs.org/init.ts
after init
, you can run the app with deno tasks:
# go to the app root created by the `init`
cd APPDIR
# run the app in devlopment mode
deno task dev
# run the app in production mode
deno task start
Documentation
The new docs site is working in progress: https://aleph.deno.dev (PR). You can join the Aleph.js Discord to get helps.
Top Related Projects
The React Framework
Build Better Websites. Create modern, resilient user experiences with web fundamentals.
web development, streamlined
The Intuitive Vue Framework.
The best React-based framework with performance, scalability and security built in.
Next generation frontend tooling. It's fast!
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