Stric
  • Basic
    • Intro
    • Routing
    • Serving files
    • Sending HTML
    • Quick response
    • CORS
    • Server-sent events
    • Clustering
  • Advance
    • How it works?
    • More
Powered by GitBook
On this page
  • Features
  • Performance
  • Quick Start

Was this helpful?

  1. Basic

Intro

Welcome to Stric documentation

Last updated 1 year ago

Was this helpful?

Stric is a Bun-first framework for building high-performance, scalable web applications.

Features

  • Perfomance: Internally use Radx, an improved version of @medley/router with optimizations only for Bun. Stric also composes your final fetch handler to reduce unused code.

  • Scalability: Stric ensures high performance even under heavy workloads.

  • Minimal: The basic components like @stricjs/router and @stricjs/utils is under 50kB and use no external dependencies.

  • Customizable: Stric comes with a plugin system, dependencies injection and more optional optimizations for handling requests.

Performance

Stric is one of the fastest JS web frameworks. See the full benchmark .

Quick Start

You need to have Bun installed to run Stric.

For Windows users, you can use WSL or WSL2 to install Bun.

# Linux, MacOS and WSL 
curl -fsSL https://bun.sh/install | bash 

# NPM
npm install -g bun

# Homebrew
brew tap oven-sh/bun
brew install bun

# Docker
docker pull oven/bun
docker run --rm --init --ulimit memlock=-1:-1 oven/bun

# Proto
proto install bun

Create a new project and install the router component.

# Create an empty Bun project
bun init

# Install @stricjs/router
bun add @stricjs/router

Let's write a simple hello world server.

index.ts
import { Router } from '@stricjs/router';

export default new Router()
    .get('/', () => new Response('Hello world!')); 

Start the server using bun index.ts, open your browser and go to . You should see the server responds with Hi.

Just like that, you have created your first app with Stric .

🎉
localhost:3000
here
A benchmark of Bun, Node and Deno frameworks