Lyn is:
- Fast
- Type-safe
- Secure with built-in authentication
- Runs everywhere
Lyn isn't here to replace existing frameworks. It was born from the need for a simple way to build things faster, with the best quality and developer experience.
Most frameworks serve as a foundation for your products. However, I often need something simpler with authentication and security built-in by default.
That's why Lyn focuses on being the easiest tool for POCs, solopreneurs, and agencies.
Lyn leverages Bun and the best JavaScript libraries for the job.
Code:
new Lyn()
.get("/text", () => {
return "Hello World";
})
.get("/json", () => {
return {
message: "Hello World",
};
})
.get(
"/:name",
({ params }) => {
return {
message: "Hello " + params.name,
};
},
{
params: z.object({
name: z.string(),
}),
}
)
.get(
"/test",
({ query }) => {
return {
message: `Hello ${query.name} ${
query.isAdmin ? "is admin" : "is not admin"
} and you are ${query.age} years old`,
};
},
{
query: z.object({
name: z.string(),
isAdmin: z.boolean(),
age: z.number(),
}),
}
)
.post("/", ({ set }) => {
set.status = 201;
return {
message: "Hello World",
};
})
.post(
"/users",
({ body, set }) => {
set.status = 201;
return {
message: "Hello " + body.name,
};
},
{
body: z.object({
name: z.string(),
}),
}
)
.listen(3000);Run it (Bun >= 1.3.6, NODE_ENV is required):
bun install
NODE_ENV=development bun run dev- Getting started
- Routing
- Validation
- Responses & errors
- Configuration — env variables, logging
- Testing
Contributing with an AI agent? See CLAUDE.md (also available as AGENTS.md).
- Register Routes
- Request lifecycle
- Body validation
- Params validation
- Query validation
- Add a logger
- Environment variables
- Example Project
- Auth
- Documentation
- Publish
- Do a Security Checklist
MIT
