Skip to content

azurajs/azura

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

121 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


NPM Version NPM Downloads License TypeScript Bundle Size Discord

AzuraJS - means sky blue 🌌 in many languages - is a minimal, decorator-based web framework built for TypeScript. It works on any JavaScript runtime: Node.js, Bun, Deno, Cloudflare Workers, Vercel Edge, and AWS Lambda.

Elegant, type-safe, and blazing fast.

import { AzuraClient } from "azurajs";
import { applyDecorators, Controller, Get } from "azurajs/decorators";

@Controller()
class AppController {
  @Get("/")
  home() {
    return { message: "Hello AzuraJS! 🚀" };
  }
}

const app = new AzuraClient();
app.applyDecorators([AppController]);

export default app;

Quick Start

npm install azurajs

Features

  • Zero Dependencies 📦 - No external dependencies. Lightweight and efficient.
  • Decorator-Based 🎯 - Clean, intuitive routing with TypeScript decorators.
  • Type-Safe 🛡️ - Full TypeScript support with complete type inference.
  • JavaScript Support 📝 - Works seamlessly with plain JavaScript too.
  • Multi-Runtime 🌍 - Works on Node.js, Bun, Deno, Cloudflare Workers, Vercel Edge, and more.
  • High Performance ⚡ - Built for speed with minimal overhead and optimized routing.
  • Modular Imports 🔧 - Tree-shakeable imports for optimal bundle size (70% smaller).
  • Built-in Features 🔋 - CORS, Rate Limiting, Cookie handling, Cluster mode, and more.
  • Developer Experience 😊 - Intuitive APIs with excellent IntelliSense support.

Documentation

The documentation is available on azura.js.org.

Example

TypeScript with Decorators

import { AzuraClient } from "azurajs";
import { applyDecorators, Controller, Get, Post, Body, Param, Res } from "azurajs/decorators";
import { HttpError } from "azurajs/http-error";
import type { ResponseServer } from "azurajs";

@Controller("/api/users")
class UserController {
  @Get()
  getAll(@Res() res: ResponseServer) {
    res.json({ users: [] });
  }

  @Get("/:id")
  getOne(@Param("id") id: string, @Res() res: ResponseServer) {
    if (id === "0") throw new HttpError(404, "User not found");
    res.json({ id, name: `User ${id}` });
  }

  @Post()
  create(@Body() body: any, @Res() res: ResponseServer) {
    res.status(201).json({ id: Date.now(), ...body });
  }
}

const app = new AzuraClient();
applyDecorators(app, [UserController]);

await app.listen(3000);

JavaScript (Functional Style)

import { AzuraClient } from "azurajs";
import { createLoggingMiddleware } from "azurajs/middleware";

const app = new AzuraClient();
const logger = createLoggingMiddleware(app.getConfig());
app.use(logger);

// Define routes
app.get("/api/users", (req, res) => {
  res.json({ users: [] });
});

app.get("/api/users/:id", (req, res) => {
  const { id } = req.params;
  res.json({ id: Number(id), name: `User ${id}` });
});

app.post("/api/users", (req, res) => {
  const body = req.body;
  res.status(201).json({ id: Date.now(), ...body });
});

await app.listen(3000);

Universal Runtime Support

AzuraJS works seamlessly across all JavaScript runtimes using the Web Standard Fetch API:

// Bun
Bun.serve({ fetch: app.fetch.bind(app), port: 3000 });

// Deno
Deno.serve({ port: 3000 }, app.fetch.bind(app));

// Cloudflare Workers
export default { fetch: app.fetch.bind(app) };

Why AzuraJS?

  • Decorator-First Design - Express-style routing with modern TypeScript decorators
  • Zero Boilerplate - Write less code, ship faster
  • Universal - One codebase, runs everywhere
  • Production Ready - Built-in cluster mode, CORS, rate limiting, and more
  • Tree-Shakeable - Modular imports reduce bundle size by up to 70%

Community

Contributing

Contributions are welcome! You can contribute in the following ways:

  • Create an Issue - Propose a new feature or report a bug
  • Pull Request - Fix a bug, add a feature, or improve documentation
  • Share - Share your thoughts and projects built with AzuraJS
  • Spread the word - Star the repo and share with others

For more details, see CONTRIBUTING.md.

Contributors

Thanks to all contributors who help make AzuraJS better!

Author

Created by 0xviny https://github.com/0xviny

License

Distributed under the MIT License. See LICENSE for more information.


Built with ❤️ by the 0xviny & AzuraJS team

About

✨ Azura is a TypeScript framework designed to build APIs faster, with simplicity and performance in mind.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors