Backend API (BaldrTs)
Introduction
Baldr is a Content Management System (CMS) for showcase websites, allowing you to instantiate pre-built modules to meet a wide range of client needs as comprehensively as possible.
The backend is built with Node.js, Express, TypeScript, and MongoDB, providing a robust, scalable API for managing multi-tenant applications.
Key Features
- Multi-Tenant Architecture: Support for multiple tenants with complete data isolation
- Modular System: Extensible module-based architecture
- RESTful API: Comprehensive REST API for all operations
- Authentication & Authorization: Role-based access control (RBAC)
- File Management: Advanced file upload and management system
- Caching: Redis-based caching for optimal performance
- Model Context Protocol (MCP): AI integration support
- Structured Data: Built-in support for SEO-optimized structured data
- Comprehensive Testing: Unit and integration tests
Documentation Sections
Core Architecture
- Architecture - System architecture overview
- Concept - Core concepts and philosophy
- Philosophie - Design philosophy
- Modules - Module system overview
API Documentation
- API Documentation - API reference
- API Integration - Integration guide
- Detailed API documentation:
Multi-Tenant System
- Multi-Tenant README - Overview
- Multi-Tenant Migration - Migration guide
- Multi-Tenant Implementation Progress - Status
- Multi-Tenant Role System - Role management
- Tenant Isolation Implementation - Data isolation
Development Guides
- Service Layer Refactoring - Service layer patterns
- Service Usage Examples - How to use services
- Optimization Guide - Performance optimization
- Route Loading Improvements - Route optimization
- Tests - Testing guide
- Test Refactoring Summary - Test improvements
Features & Systems
- Page Management System - Page system
- Page System Summary - Page overview
- Cart Management - Shopping cart
- Checkout Command Creation - Checkout process
- Category System Refactoring - Categories
- Measurement System - Units and measurements
- Thumbnail Regeneration - Image processing
Data & Storage
- Structured Data Guide - Structured data
- Structured Data Example - Examples
- Structured Data Quick Reference - Quick ref
- Table Order Aggregation - Data aggregation
- Cache Implementation Summary - Caching
AI & Integration
- AI Chat Tools - AI integration
- MCP Integration - Model Context Protocol
- MCP Summary - MCP overview
- MCP Quickstart - Get started with MCP
- MCP Authentication - MCP auth
Security & Infrastructure
- API Key Encryption - Security
- Infrastructure - Deployment and hosting:
Migrations & Summaries
- User Model Migration - User model changes
- Migration Summary - All migrations
- Implementation Summary - Feature implementations
- Module Slugs - Module identifiers
Getting Started
- Install dependencies:
npm install - Configure MongoDB connection in
.env - Set up environment variables (see
.env.example) - Start development server:
npm run dev - Run tests:
npm test
Tech Stack
- Node.js & Express: Server framework
- TypeScript: Type-safe development
- MongoDB: Database with Mongoose ODM
- Redis: Caching layer
- Jest: Testing framework
- JWT: Authentication
- Multer: File uploads
API Structure
src/
├── controllers/ # Request handlers
├── models/ # MongoDB models
├── routes/ # API routes
├── services/ # Business logic
├── middlewares/ # Express middlewares
├── validations/ # Request validation
├── utils/ # Utility functions
├── configs/ # Configuration files
└── tests/ # Test files