Skip to main content

Announcing Vramework 0.6: WebSockets, Scheduled Tasks, and a More Flexible, Typed Future

· 5 min read

Modern backend development can be messy. You might lock into a single runtime or server, and keeping frontend and backend types in sync is often painful. Vramework 0.6 aims to change that—offering a function-first, TypeScript-powered ecosystem that lets you build once and deploy anywhere with complete type safety.

Vramework isn’t just another Node.js server framework. Instead, it’s a lightweight abstraction layer that pairs seamlessly with servers like uWebSockets.js (uWS), Express, and Fastify. It runs on Node.js and will soon support Bun or Deno. Whether you deploy to Docker containers on VMs or use a serverless platform like AWS Lambda or Azure Functions, Vramework’s abstractions help you switch infrastructure without massive rewrites.

What’s New in Vramework 0.6

Scheduled Tasks

You can now define scheduled tasks right alongside your API functions—no separate cron setup or external schedulers needed. These tasks can run in both traditional servers and serverless runtimes. For example, deploy them on AWS Lambda with EventBridge or Azure Functions Timer Triggers. Just one function and a simple configuration:

import { addScheduledTask } from '@vramework/core/scheduler'

export const myScheduledTask: APIFunctionSessionless<void, void> = async (services) => {
// Your scheduled logic here
}

addScheduledTask({
name: 'myScheduledTask',
schedule: '*/1 * * * *', // every minute
func: myScheduledTask,
})

This makes recurring jobs (like daily data syncs or periodic cleanups) straightforward and fully integrated—no matter where you run them.


Channels (WebSockets and Beyond)

Real-time capabilities are now first-class citizens in Vramework. We’re introducing Channels, a unified interface for bi-directional communication. Inspired by AsyncAPI and influenced by tools like deepstream.io, Channels let you:

  • Manage WebSocket connections with type safety, session handling, and authentication.
  • Implement pub/sub patterns seamlessly with built-in subscription services.
  • Deploy to VMs, Docker containers, or serverless WebSocket environments without painful rewrites.

Example Channel Functions:

export const onConnect: ChannelConnection<'hello!'> = async (services, channel) => {
services.logger.info('New connection')
channel.send('hello!')
}

export const authenticate: ChannelMessage<{ token: string }, { authResult: boolean }> = async (services, channel, data) => {
const authResult = data.token === 'valid'
if (authResult) {
await channel.setSession({ userId: 'Bob' })
}
channel.send({ authResult })
}

Linking Functions into a Channel:

import { addChannel } from '@vramework/core/channel'
import { onConnect, onMessage, onDisconnect, subscribe, unsubscribe, emitMessage, authenticate } from './events.functions.js'

addChannel({
route: '/event',
// Called when a client connects to the channel
onConnect,
// Called when a client disconnects from the channel
onDisconnect,
// A global auth guard for all message routes (can be overridden)
auth: true,
// Default message handler if no route is matched
onMessage,
onMessageRoute: {
action: {
// Sets the user session, enabling authenticated routes
auth: {
func: authenticate,
auth: false,
},
// A route with nested function config for applying permissions
subscribe: {
func: subscribe,
permissions: {},
},
// Shorthand route definition
unsubscribe,
// A route that references another function
emit: emitMessage
}
}
})

This approach keeps your real-time code organized and modular. Switch between servers or move to a serverless WebSocket platform without touching your message-handling logic—just plug in the right adapter.

Using websocket client side:

We generate a really simple wrapper around WebSockets to provide typed methods. You can see how this works here.


Stronger Compile-Time Insights

Vramework’s CLI extracts type information at compile time. This approach lets you:

  • Automatically generate OpenAPI documentation from your TypeScript definitions.
  • Create typed clients that can be shared with frontends, ensuring zero-maintenance API contracts.
  • Reduce runtime overhead and catch schema errors before hitting production.

For example, define your inputs and outputs inline:

const updateBirthday: APIFunction<{ userId: string; birthday: number }, { success: boolean }> = async (services) => {
// Implementation
}

Vramework will automatically generate UpdateBirthdayInput and UpdateBirthdayOutput types—no decorators or repetitive schema definitions required.


Dropping the Dead Weight

To move faster and focus on what matters, we’ve made some clean breaks:

  • CommonJS Support: Removed in favor of ESM.
  • Next.js Pages: Temporarily dropped to maintain a cleaner separation of concerns.
  • Embedded Inline Functions: Streamlined out for now to simplify the code-generation process.

By shedding these complexities, Vramework stays lean, modern, and more maintainable going forward.


A Greener Future: Measuring Impact and Carbon Offsets

As infrastructure choices multiply, understanding their environmental impact becomes more important. Vramework’s flexibility makes it easier to experiment with different runtimes, servers, and deployment options—be it on VMs, containers, or serverless. By observing how these choices affect CPU cycles and memory consumption, you can get a clearer picture of the carbon footprint associated with your application’s workload.

We’re excited about the idea of using Vramework as a platform to help companies make environmentally informed decisions. Imagine comparing resource usage and emissions across deployments and automatically suggesting lower-impact configurations. While this is still in the concept stage, it’s a direction we’re exploring to align performance optimization with environmental responsibility.


Let’s Collaborate!

I’m always excited to take on new projects and challenges, whether they’re about optimizing infrastructure, improving developer experiences, building real-time applications, or exploring innovative backend solutions. If you have a problem to solve, a product to scale, or an idea to bring to life, let’s chat.

How I can help:

  • Consulting on serverless transformations, real-time systems, and cloud infrastructure.
  • Building robust and scalable backend systems, tailored to your needs.
  • Exploring sustainable tech solutions to align with your environmental goals.

Feel free to get in touch or connect on GitHub to discuss your ideas or projects.


Get Involved

Try Vramework 0.6 today. Set up a scheduled task on serverless infrastructure, implement a fully typed WebSocket channel, or leverage compile-time type extraction for your next project. Check out the docs, open an issue, or join the discussion on GitHub.

Get Started with Vramework 0.6

Read the in depth blog post

We’re excited to hear your feedback and see what you’ll build. Let’s shape the future of flexible, typed, and environmentally conscious backend development together.

Happy hacking!