Skip to content

Migrating to v2

JSONExpress v2 is a full rewrite. The single json-express package from v1 has been replaced by a modular ecosystem — a headless microkernel and a set of focused, independently installable packages. Every layer (transport, database, API style, logger, auth, docs) is now a swappable plugin.

What changed

v1v2
Installnpm install json-expressnpm install @json-express/boot + plugins
TransportExpress (hardcoded)@json-express/transport-express or transport-fastify
DatabaseFile-based JSON (hardcoded)adapter-memory, adapter-json, or any custom adapter
API styleREST onlyapi-rest or api-graphql
AuthBuilt-in, opinionatedmiddleware-auth + plugin-identity (opt-in)
ExtensibilityLimited hooksFull plugin lifecycle (onRegister, onBoot, onReady, onShutdown)

Installing v2

The quickest path is @json-express/boot, a meta-package that bundles the recommended default stack (Express + in-memory adapter + REST + console logger + docs):

bash
npm install @json-express/boot

From there, swap in individual packages as you need them:

bash
# Use Fastify instead of Express
npm install @json-express/transport-fastify

# Persist data to JSON files on disk
npm install @json-express/adapter-json

# Add GraphQL alongside REST
npm install @json-express/api-graphql

# Add user identity and JWT auth
npm install @json-express/plugin-identity @json-express/middleware-auth

# Add Swagger / OpenAPI docs
npm install @json-express/docs-swagger

# Add Pino structured logging
npm install @json-express/logger-pino

# Add Faker-powered database seeding
npm install @json-express/seeder-faker

JSONExpress auto-discovers any @json-express/* package listed in your package.json and activates it — no manual wiring required.

Full package reference

PackagePurpose
@json-express/bootQuickstart preset (bundles the default stack)
@json-express/coreMicrokernel and IoC container (peer dep)
@json-express/config-env.env-based configuration
@json-express/transport-expressExpress HTTP transport
@json-express/transport-fastifyFastify HTTP transport
@json-express/adapter-memoryIn-memory database adapter
@json-express/adapter-jsonJSON file database adapter
@json-express/api-restREST API generator
@json-express/api-graphqlGraphQL API generator
@json-express/middleware-authJWT authentication middleware
@json-express/middleware-validationZod request validation middleware
@json-express/plugin-identityUser identity and session management
@json-express/plugin-health/health endpoint
@json-express/plugin-devcertLocal HTTPS via devcert
@json-express/docs-swaggerSwagger / OpenAPI UI
@json-express/docs-lightLightweight built-in docs
@json-express/logger-consoleConsole logger (default)
@json-express/logger-pinoPino structured logger
@json-express/seeder-fakerFaker-powered database seeding
@json-express/kv-memoryIn-memory key-value store
@json-express/queue-memoryIn-memory job queue
@json-express/email-consoleConsole email driver (dev)

Configuration

v2 uses a .env-based config system. The jex.* namespace controls all framework settings:

bash
jex.port=3000
jex.adapter=adapter-json
jex.transport=transport-fastify

See the config-env docs for the full reference.