alepha
v0.14.4
Published
Easy-to-use modern TypeScript framework for building many kind of applications.
Downloads
1,901
Maintainers
Readme
[!WARNING] Early Development — Alepha is under active development. The API is stabilizing but may change. First stable release planned for early 2026. Follow the repo to stay updated.
What is this?
Build API endpoints (Docker or Serverless), React applications (SSR, CSR or SSG), and more!
Relies only on very few runtime dependencies. Alepha is a "one decision" framework, meaning you don't have to choose between dozens of libraries and tools.
All-in-one tool that takes care of configuration, development, build, deployment, testing, etc. Convention over configuration.
All features are based on a DSL with strong typing and runtime validation which makes development safe, productive, and AI friendly.
For more information, please visit the documentation.
Examples
Requirements
- Node.js v22 or higher
API endpoint
Write API endpoints with automatic OpenAPI documentation.
# Add required config files in the current folder
$ npx alepha initCreate a new file src/main.ts:
import { run, t, Alepha } from "alepha";
import { $action } from "alepha/server";
import { $swagger } from "alepha/server/swagger";
class Api {
// Functions starting with $ are "primitives".
// Like React hooks, they must be called inside Alepha context.
docs = $swagger();
sayHello = $action({
path: "/hello/:name",
// Every feature inside Alepha is strongly typed with runtime validation.
// Schema is based on TypeBox library.
schema: {
params: t.object({
// Alepha provides many built-in types.
// For example `t.text()` = `t.string()` + specific maxLength, auto-trim, etc.
name: t.text()
}),
response: t.object({
message: t.text(),
})
},
handler: async ({ params }) => {
return { message: `Hello ${params.name} !` };
}
});
}
// Creating Alepha instance is like creating a new context.
const alepha = Alepha.create();
// And you add features by registering classes.
alepha.with(Api);
// `run` will take care of Alepha lifecycle (startup, graceful shutdown, etc.)
run(alepha);Run the development server:
$ npx alepha devCommand alepha dev comes with hot-reload and full TypeScript support but you can also run:
$ node ./src/main.ts
$ bun ./src/main.tsThen, open your browser at http://localhost:3000/docs/ and enjoy your automatically generated documentation.
Production build
Once you are done, build the application for production:
$ npx alepha buildApplication will be built in the dist/ folder, ready to be deployed on any platform (Docker, Serverless, etc.).
Bonus, no need to "npm install" on the server, Alepha bundles everything together.
React Application
Build full-stack React applications, with server-side rendering.
$ npx alepha init --reactCreate a file src/main.tsx:
import { Alepha, run, t } from "alepha";
import { $page } from "@alepha/react/router";
import { useState } from "react";
const Hello = (props: { count: number }) => {
const [ count, setCount ] = useState(props.count);
return <button onClick={() => setCount(count + 1)}>Clicked: {count}</button>
}
class AppRouter {
index = $page({
schema: {
query: t.object({
start: t.number({ default: 0 }),
})
},
component: Hello,
loader: (req) => {
return { count: req.query.start };
},
});
}
const alepha = Alepha.create();
alepha.with(AppRouter);
run(alepha);Run the development server:
$ npx alepha devOpen your browser at http://localhost:5173/ and see your React application in action.
What's next?
- Dive into the full docs for more advanced stuff
- Browse the GitHub repo for examples and source code
- Check out the individual packages to see what else you can build
