Build enterprise-grade applications that will stand the test of time.
Develop your software on a ready-to-use and highly productive clean architecture.
Develop your software on a ready-to-use and highly productive clean architecture.
Modularity
Organize applications into self-contained, reusable and composable modules.
Testability
Build easily testable components by breaking up dependencies.
Observability
Observable by default with strong OpenTelemetry integration.
Type Safety
A robust and type safe development environment using TypeScript.
@mondrian-framework/model
Expressive data model and schema validation
Mondrian allows you to define a data model in an intuitive human-readable way. In addition to model fields, types, possibly new scalars and relationships, you can utilize a wide range of validity rules or create new and reusable ones. Once the model is defined, the framework provides a set of fully automatic translation features to major standards: JSONSchema (OpenAPI), GraphQL and Protobuf.
app.ts
import { model } from '@mondrian-framework/model'
export const Post = model.object({
id: model.string(),
createdAt: model.timestamp(),
title: model.string(),
})
export type Post = model.Infer<typeof Post>
export const User = m.object({
id: model.string(),
createdAt: model.timestamp(),
email: model.email(),
password: model.string({ minLength: 8 }),
posts: model.array(Post),
})
export type User = model.Infer<typeof User>
@mondrian-framework/module
Modularity and well defined boundaries
Define your system as a set of functions grouped into modules. Each function has a single responsibility, with well-defined boundaries based on a formal interface, with no direct dependencies on the execution environment.
The design-first approach allows you to have a specification always aligned with the code and automatically generate tools and artifacts for the clients of your software.
The design-first approach allows you to have a specification always aligned with the code and automatically generate tools and artifacts for the clients of your software.
module.ts
import { functions, error } from '@mondrian-framework/module'
import { model } from '@mondrian-framework/model'
const register = functions
.define({
input: model.object({
email: model.email(),
password: model.string({ minLength: 8 })
}),
output: model.object({ jwt: model.string() })
})
.implement({
async body({ input: { email, password } }) {
// BUSINESS LOGIC
},
})
const userModule = module.build({
name: 'user',
functions: {
register
}
})
@mondrian-framework/runtime
Multiple runtimes with zero effort
Provide your own functions in any way you like, as an API (REST, GraphQL or gRPC), as a queue consumer (SQS, Kafka, etc.) or a scheduled job. Every runtime provided by the framework also support all best practices, from observability via Open Telemetry to automated documentation.
You can also develop your own runtime based on your needs to execute a module using a server of your choice and a dedicated infrastructure. This will allow you to embrace technological evolution without rewriting your code.
You can also develop your own runtime based on your needs to execute a module using a server of your choice and a dedicated infrastructure. This will allow you to embrace technological evolution without rewriting your code.
model.ts
import { graphql } from '@mondrian-framework/graphql'
import { serve } from '@mondrian-framework/graphql-fastify'
import { fastify } from 'fastify'
const api = graphql.build({
module: userModule,
functions: {
register: { type: 'mutation' },
},
})
const server = fastify()
serve({
server,
api,
options: { introspection: true },
})
server.listen({ port: 4000 }).then((address) => {
console.log(`Server started at address ${address}/graphql`)
})
Live Preview
See how your application may potentially look like without leaving your personal browser. Feel free to change the codebase and reload the preview of the OpenAPI specification.