Skip to main content

Announcing Vramework 0.2

· 4 min read

We are thrilled to announce the release of vramework 0.2!

For the past few years, vramework has been quietly powering bespoke projects as a submodule. With version 0.2, we're transforming it into a fully-fledged set of libraries designed to streamline your development experience.

What's New in Vramework 0.2?

Supported Frameworks (Currently in Testing)

  • Fastify
  • uWebSockets.js (uWS)
  • Next.js

Development Enhancements

  • Comprehensive Documentation: We've added detailed guides to help you get started quickly.
  • CLI Tool for Schema and Route Generation: Automate your workflow with our new command-line interface.
  • Configuration File (vramework.config.json): Easily customize vramework to suit your project's needs.
  • Robust Testing Suite: More tests for extra reliability.
  • Universal runRoutes Method: Call vramework from any framework seamlessly.
  • VrameworkRequest and VrameworkResponse Wrappers: Compatibility with most Node.js HTTP libraries.
  • TypeScript Improvements: Enjoy a smoother development experience with enhanced TypeScript support.
  • Starter Workspace: Check out our example workspace with everything set up.

What Is Vramework?

Vramework is a lightweight abstraction layer between HTTP requests and your code. It allows you to focus on the core logic without worrying about the underlying HTTP mechanics. Simply put, it's all about data in, data out, and error handling—nothing more.

Request Handling Workflow:

  1. Route Validation:
    Does the route exist?
    No? Return 404 Not Found.

  2. Data Validation:
    Is the input data valid?
    No? Return 400 Bad Request.

  3. Session Management:
    Is a session required and present?
    No? Return 401 Unauthorized.

  4. Permission Checks:
    Does the user have the necessary permissions?
    No? Return 403 Forbidden.

  5. Method Execution:
    Did the method execute successfully?
    No? Map the error to the appropriate HTTP status code.

  6. Response Delivery:
    Send the response back to the client.

Example Code:

import { route, type APIRoutes, APIFunction } from '../vramework-types';

export const createTodo: APIFunction<CreateTodo, JustTodoId> = async (
services, data, session
) => {
return await services.kysely
.insertInto('app.todo')
.values({
...data,
createdBy: session.userId,
})
.returning('todoId')
.executeTakeFirstOrThrow();
};

export const routes = [
route({
method: 'post',
route: '/todo',
schema: 'CreateTodo',
func: createTodo,
permissions: {
isUser,
},
}),
];

With vramework, you can effortlessly integrate with servers like Express, Fastify, or uWS, and even invoke functions directly within frameworks like Next.js or NestJS.

Why Choose Vramework Over NestJS, tRPC, or Encore?

Less Magic, More Control

Vramework avoids the "magic" often found in other frameworks, where hidden processes can make debugging challenging. By providing explicit and transparent code structures, you gain full control over your application's behavior.

Lightweight and Open Source

Written entirely in TypeScript and open-sourced under the MIT license, vramework is minimalistic yet powerful. Its lean codebase makes it accessible for debugging and community contributions.

Infrastructure Agnostic

Unlike frameworks that lock you into specific infrastructure providers, vramework is flexible. You can choose any services or databases you prefer, whether it's AWS, Google Cloud, Backblaze, or a database of your choice.

Plain TypeScript Usage

Embrace the simplicity of plain TypeScript. Define services as regular classes and functions that receive services, data, and user sessions—no decorators or special syntax required.

Flexible Deployment

Deploy vramework in a way that suits you:

  • Integrate with Express, Fastify, or uWS.
  • Use it directly within Next.js.
  • Plan for future support of gRPC and WebSocket protocols based on community interest.

Get Started Today!

Explore the example workspace to see vramework in action. We're excited to see how you leverage vramework 0.2 in your projects.


Note: Vramework 0.2 is still a work in progress. While it has been used in multiple production environments, the latest changes are undergoing thorough testing. We invite the community to try it out and share feedback!


About Me

I'm currently contracting remotely with a strong background in Node.js, React, Terraform, AWS, real-time technologies, CI/CD, and the broader JavaScript ecosystem. If you're looking for expertise on your next project, feel free to reach out at yasser.fadl@vlandor.com.