Technology Stack
Relevant source files
The following files were used as context for generating this wiki page:MessageJS is built on a modern, type-safe technology stack centered around TypeScript and Node.js. The project is structured as a monorepo, which contains distinct packages for the backend API, the client-side SDK, and a management dashboard. This architecture allows for shared code, streamlined development, and clear separation of concerns between the different parts of the system.
The core of the project is a Node.js backend powered by Express.js, which handles API requests, authentication, and communication with third-party messaging services. Data persistence is managed by a PostgreSQL database with Prisma as the Object-Relational Mapper (ORM). The frontend consists of a lightweight client SDK built with Rollup for broad compatibility and a React/Next.js dashboard for project management.
Sources: README.md:7-13, README.md:43-50, package.json, mono-repo.md
High-Level Architecture
The overall architecture follows a classic client-server model, where the client SDK communicates with the backend API, which then routes requests to the appropriate third-party messaging platform.
This diagram illustrates the basic message flow from the client SDK to the backend, which then dispatches the message through a specific connector.
Sources: README.md:38-41
Monorepo Structure
The project utilizes an npm workspaces-based monorepo to manage its different packages. This structure is defined in the root package.json and documented in mono-repo.md.
Sources: package.json:8-10, mono-repo.md
This diagram shows the directory structure of the monorepo, highlighting the key packages.
The primary packages within the monorepo are:
| Package | Description | Source |
|---|---|---|
@messagejs/core | The Node.js/Express backend API server. | README.md:20 |
@messagejs/client | A lightweight frontend SDK for browsers and Node.js. | README.md:21 |
@messagejs/dashboard | A React/Next.js application for managing projects, API keys, and connectors. | mono-repo.md:12 |
@messagejs/shared-types | Shared TypeScript types used across different packages. | README.md:22 |
@messagejs/examples | Example applications demonstrating SDK usage. | mono-repo.md:19 |
Sources: README.md:18-23, mono-repo.md
Core Backend (@messagejs/core)
The backend is a Node.js application responsible for all server-side logic.
Sources: packages/core/package.json, README.md:43-50
Runtime and Framework
- Runtime: Node.js
v20.0.0or greater. - Framework: Express.js for handling HTTP requests and routing.
- Language: TypeScript
v5.3.3.
The engines field in the root package.json specifies the required Node.js and npm versions. The core package dependencies show express and typescript.
Sources: package.json:28-31, packages/core/package.json:17, packages/core/package.json:25
Database and ORM
- Database: PostgreSQL.
- ORM: Prisma.
The backend uses Prisma to interact with a PostgreSQL database. The schema, defined in prisma/schema.prisma, outlines the data models, relations, and enums used throughout the application.
The following ER diagram represents the database schema:
This diagram shows the relationships between Users, Projects, Services, Templates, and Message Logs as defined in the Prisma schema.
Sources: packages/core/prisma/schema.prisma, packages/core/package.json:14-15
Client SDK (@messagejs/client)
The client SDK is a lightweight library designed for use in both browser and Node.js environments to send messages via the MessageJS API.
Language and Bundler
- Language: TypeScript.
- Bundler: Rollup.
The SDK is written in TypeScript and bundled using Rollup. The configuration builds both CommonJS (.cjs) and ES Module (.js) formats to ensure wide compatibility.
{
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
}
}
}
Source: packages/client/package.json:5-14
This configuration in packages/client/package.json ensures that the package can be correctly resolved by different module systems.
Sources: packages/client/package.json, README.md:48
Dashboard (@messagejs/dashboard)
The dashboard is a web application for users to manage their MessageJS projects.
- Framework: Next.js
v14.0.0. - UI Library: React
v18.2.0. - Language: TypeScript.
The use of Next.js provides a modern, server-rendered React framework for building the user interface.
Sources: packages/dashboard/package.json:11-13, mono-repo.md:12
Development and Tooling
The project relies on a set of tools to ensure code quality, consistency, and an efficient development workflow.
| Tool | Purpose | Source |
|---|---|---|
| npm Workspaces | Manages the monorepo structure and dependencies. | package.json:8-10 |
| TypeScript | Provides static typing for all packages. | package.json:26 |
| tsx | Executes TypeScript files directly for development in @messagejs/core. | packages/core/package.json:24 |
| Rollup | Bundles the @messagejs/client SDK for distribution. | packages/client/package.json:21 |
| Vite | Serves and builds the @messagejs/react-demo example. | packages/examples/react-demo/package.json:20 |
Sources: package.json, packages/core/package.json, packages/client/package.json