{"id":26851,"library":"connect-cachify","title":"connect-cachify","description":"Connect/Express middleware for browser cache optimization via asset fingerprinting and concatenation. Current version 0.0.17 (unmaintained). Provides `cachify.setup` middleware and view helpers (`cachify_js`, `cachify_css`) that rewrite asset URLs to include a content hash, allowing far-future Expires headers and transparent fallback to individual scripts in development. Unlike connect-assets, it focuses solely on HTTP caching headers and URL rewriting without compilation. No release cadence; last published in 2013. Node.js >=0.4.7 required.","status":"deprecated","version":"0.0.17","language":"javascript","source_language":"en","source_url":"https://github.com/mozilla/connect-cachify","tags":["javascript","cache","HTTP","expires","asset","max-age","caching"],"install":[{"cmd":"npm install connect-cachify","lang":"bash","label":"npm"},{"cmd":"yarn add connect-cachify","lang":"bash","label":"yarn"},{"cmd":"pnpm add connect-cachify","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for Connect middleware compatibility (Express 2/3/4). Not listed as peer but used as middleware.","package":"connect","optional":true}],"imports":[{"note":"Package exports a single function that is also the `setup` method. ESM default import works in Node >=12.","wrong":"const { setup } = require('connect-cachify')","symbol":"default","correct":"import cachify from 'connect-cachify'"},{"note":"CommonJS destructuring works; no separate `/setup` module exists.","wrong":"import setup from 'connect-cachify/setup';","symbol":"setup","correct":"const { setup } = require('connect-cachify');"},{"note":"View helpers are not exported; they are added to the request/response by the middleware. Use `cachify.setup` to make them available in templates.","wrong":"import { cachify_js } from 'connect-cachify';","symbol":"cachify_js","correct":"app.locals.cachify_js = require('connect-cachify').cachify_js;"}],"quickstart":{"code":"const express = require('express');\nconst cachify = require('connect-cachify');\n\nconst app = express();\n\nconst assets = {\n  '/js/bundle.min.js': ['/js/a.js', '/js/b.js']\n};\n\napp.use(cachify.setup(assets, {\n  root: __dirname + '/public',\n  production: process.env.NODE_ENV === 'production'\n}));\n\napp.use(express.static(__dirname + '/public'));\n\napp.set('view engine', 'ejs');\n\napp.get('/', function(req, res) {\n  res.render('index', { cachify_js: req.cachify_js, cachify_css: req.cachify_css });\n});\n\napp.listen(3000);","lang":"javascript","description":"Shows Express app with cachify middleware, asset map, and view helper injection."},"warnings":[{"fix":"Migrate to express-cachebuster or custom middleware with `etag` and `last-modified` handling.","message":"Package has not been updated since 2013 and is incompatible with modern Express 4+ middleware pattern (no error middleware, deprecated `res.redirect` calls).","severity":"deprecated","affected_versions":">=0.0.17"},{"fix":"Ensure `app.use(cachify.setup(...))` is called before `app.use(express.static(...))`.","message":"The `cachify.setup` middleware must be placed before `express.static` or other response-sending middleware, otherwise assets will be served without fingerprinting.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Use middleware: `app.use(function(req, res, next) { res.locals.cachify_js = req.cachify_js; res.locals.cachify_css = req.cachify_css; next(); });`","message":"View helpers `cachify_js` and `cachify_css` are attached to `req` and `res` objects, not `app.locals`. In Express 4, you must manually pass them to templates via `res.locals`.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Set `root` option and use relative paths in assets map instead of `url_to_paths`.","message":"The `url_to_paths` option uses absolute filesystem paths; in production, use relative paths to avoid portability issues.","severity":"deprecated","affected_versions":">=0.0.1"}],"env_vars":null,"search_vec":"'0.0.17':17 '0.4.7':76 '2013':74 'age':85 'allow':38 'asset':11,31,55,82 'browser':7 'cach':8,61,79,86 'cachifi':3,25,27 'cachify.setup':20 'cadenc':70 'compil':67 'concaten':14 'connect':2,54 'connect-asset':53 'connect-cachifi':1 'connect/express':4 'content':36 'css':28 'current':15 'develop':51 'expir':42,81 'fallback':46 'far':40 'far-futur':39 'fingerprint':12 'focus':57 'futur':41 'hash':37 'header':43,62 'helper':24 'http':60,80 'includ':34 'individu':48 'javascript':78 'js':26 'last':71 'max':84 'max-ag':83 'middlewar':5,21 'node.js':75 'optim':9 'provid':19 'publish':72 'releas':69 'requir':77 'rewrit':30,65 'script':49 'sole':58 'transpar':45 'unlik':52 'unmaintain':18 'url':32,64 'version':16 'via':10 'view':23 'without':66","created_at":"2026-05-01T17:43:12.710559+00:00","updated_at":"2026-05-01T17:43:12.710559+00:00","problems":[{"fix":"Run `npm install connect-cachify` and ensure it's in your `package.json` dependencies.","cause":"Package not installed or missing from node_modules.","error":"Error: Cannot find module 'connect-cachify'"},{"fix":"Use `const cachify = require('connect-cachify');` and then `cachify.setup(...)`.","cause":"Importing the module incorrectly (e.g., using default import when CommonJS required).","error":"TypeError: cachify.setup is not a function"},{"fix":"Ensure `app.use(cachify.setup(...))` is called before any route that renders templates, and that `res.locals.cachify_js` is set.","cause":"View helper not available in template because middleware hasn't been applied or locals not set.","error":"ReferenceError: cachify_js is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/mozilla/connect-cachify","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/connect-cachify","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-04-25","next_check":"2026-07-24","install_tag":null}}