Effect Start Framework

0.36.0 · active · verified Tue Apr 21

effect-start is a framework for building declarative full-stack applications by deeply integrating with the Effect ecosystem. Currently at version 0.36.0, the project is in its early stages of development, implying a rapid release cadence with potential for frequent, significant updates. It offers features such as automatic file-based routing, supporting frontend pages, backend API endpoints, and composable Route Layers for middleware. A key architectural design is a unified `server.ts` entrypoint for both development and production environments, aiming to eliminate configuration divergence. The framework also includes a lightweight Tailwind CSS plugin with minimal configuration, primarily demonstrated within the Bun runtime environment. Its declarative approach and reliance on Effect distinguish it from more imperative or traditional full-stack solutions, catering to developers already familiar with or interested in the Effect paradigm.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates the `server.ts` entrypoint, showing how to configure `effect-start` with file-based routing and serve the application.

import { FileRouter, Start } from "effect-start";

// This layer applies configuration and changes the behavior of the server.
// It expects a FileRouter.layer, which automatically loads routes.
export default Start.layer(
  FileRouter.layer({
    // Specifies how to dynamically load the generated routes file.
    // `routes.gen.ts` is typically created by a build step or dev server.
    load: () => import("./routes/routes.gen.ts"),
    // Provides a path hint for the router, useful for `import.meta.resolve`
    path: import.meta.resolve("./routes/routes.gen.ts"),
  })
);

// This block ensures the server is only started when the file is run directly
// (e.g., `bun run server.ts`), not when imported as a module.
if (import.meta.main) {
  // `Start.serve` takes a function that returns the main application layer,
  // typically the default export of this `server.ts` file.
  Start.serve(() => import("./server.ts"));
}

view raw JSON →