Skip to main content
Deno 2 is finally here 🎉️
Learn more

Cav

TODO: This is a placeholder readme until I’m done writing docs

Cav is an experimental TypeScript web framework built on Deno. It provides a declarative and functional approach for writing full-stack web applications.

A quick demo of the framework in action can be seen at cav.bar. The demo runs on Deno Deploy. It’ll be replaced by the docs website soon.

Cav is inspired by many modern web development patterns, techniques, and modules. Here’s a few of those modules:

Usage

Features

  • Zero third-party dependencies
  • Built-in bundling of TypeScript assets
    • Also thanks to Deno. Note that this feature requires the --unstable flag
  • Compatibility with any frontend framework/module (e.g. Preact and React)
  • Compatibility with Zod-style data parsers
  • End-to-end type safety (inspired by trpc)
  • “Any-body” data serialization 1
  • Declarative routing (stack.ts)
  • Declarative endpoint definitions (rpc.ts)
  • Unopinionated project structures
  • Opinionated HTTP procedures
  • Carefully chosen defaults
  • Easy-to-use web sockets
  • Zero-config
  • Signed and unsigned cookies
  • Custom context support

JavaScript data types into JSON and back again while maintaining references. Cav does this and also adds support for Files and Blobs, meaning the client can send arbitrary JavaScript objects that contain Files and Blobs anywhere on the object, and the sent object will still come out on the other end in the same shape, with the same data.

It works by separating the Files and Blobs from the JSON-only data during serialization and then packing the files and the JSON into a multipart form with a unique shape. When the form is received, it’ll be deserialized back into the original object, with the attached files being placed into their original locations on the output object. See pack.ts for more info; look at the packBody and unpackBody functions to see where Files and Blobs come into play.

Status

Pre-alpha. Documentation and tests are in the works.

Dedication

Cav is dedicated to the bar it was named after.

Footnotes

  1. This is like superjson and similar libraries that let you serialize most