Create New Document

The title of your document (will be displayed as H1)
URL-friendly name (no spaces, use dashes)
Path where to create document (optional, use forward slashes to create subdirectories)

Move/Rename Document

Current location of the document
New path for the document (including the slug)
This only changes the document's path. It does not modify the document's title (H1 heading).

Delete Document

Are you sure you want to delete this document? This action cannot be undone.

Warning: If this is a folder, all contents including subfolders and documents will be deleted.

Message

Message content goes here.

Confirm Action

Are you sure?

Attachments

Allowed file types: jpg, jpeg, png, gif, svg, webp, txt, log, csv, sfd, zip, pdf, docx, xlsx, pptx, mp4 (Max: 10MB)

Document Files

Loading attached files...

Document History

Previous Versions

Loading versions...

Preview

Select a version to preview

Wiki Settings

Language for the user interface
Number of versions to keep per document. Set to 0 to disable versioning.
Maximum allowed file size for uploads in MB.

User Management

Add New User

Leave empty to keep current password
Users with these groups can access restricted sections.

Define path-based access rules for sections of your wiki, then assign users to groups in the Users tab. Rules are evaluated in order. First match wins.

Active Rules

Import markdown files from a ZIP archive. Files will be processed and stored in the appropriate document structure. Directory structure in the ZIP (category/subcategory) will be preserved in the wiki.

Upload a ZIP file containing markdown (.md) files to import.

Create and manage backups of your wiki data. Backups include all documents, images, and configuration files.

Available Backups

Loading backups...

Add/Edit Access Rule

Selected: /

Add Column

Mnemonica Backlot - Architecture Documentation

Version: 3.0.0
Last Updated: 2026-02-03
Status: Production-ready with ongoing improvements


Overview

Mnemonica Backlot is a modern Angular standalone application for managing contracts, projects, templates, and consumption tracking. It follows Angular best practices with a clean separation of concerns and modular architecture.


Technology Stack

Frontend

Backend Integration

Development Tools


Application Architecture

High-Level Structure

┌──────────────────────────────────────────┐
│          User Interface (Browser)         │
│                                           │
│  ┌─────────────────────────────────────┐ │
│  │  Angular Application (Port 4200)     │ │
│  │                                       │ │
│  │  ┌────────────┐    ┌──────────────┐ │ │
│  │  │   Core/    │◄──►│   Features/  │ │ │
│  │  │  Services  │    │  Components  │ │ │
│  │  └────────────┘    └──────────────┘ │ │
│  │         │                  │         │ │
│  │  ┌────────────┐    ┌──────────────┐ │ │
│  │  │   Models   │    │    Shared/   │ │ │
│  │  │Interfaces  │    │  Components  │ │ │
│  │  └────────────┘    └──────────────┘ │ │
│  └─────────────────────────────────────┘ │
└──────────────────────────────────────────┘
                    │ HTTP
                    ▼
┌──────────────────────────────────────────┐
│      n8n Workflow Automation API         │
│                                           │
│  ┌─────────────────────────────────────┐ │
│  │  Webhook Endpoints                   │ │
│  │  - contracts-crud                    │ │
│  │  - contract-templates                │ │
│  │  - consumption                       │ │
│  │  - projects                          │ │
│  └─────────────────────────────────────┘ │
└──────────────────────────────────────────┘
                    │
                    ▼
┌──────────────────────────────────────────┐
│           PostgreSQL Database             │
└──────────────────────────────────────────┘

Directory Structure

src/
├── app/
│   ├── core/                    # Core module (singleton services, models)
│   │   ├── models/              # TypeScript interfaces and types
│   │   │   ├── api.model.ts     # API response types
│   │   │   ├── contract.model.ts
│   │   │   ├── project.model.ts
│   │   │   ├── template.model.ts
│   │   │   ├── owner.model.ts
│   │   │   └── index.ts         # Barrel export
│   │   └── services/            # Application-wide services
│   │       ├── api.service.ts   # HTTP client wrapper
│   │       ├── logger.service.ts
│   │       ├── utils.service.ts
│   │       ├── theme.service.ts
│   │       └── preferences.service.ts
│   │
│   ├── features/                # Feature modules (lazy loaded)
│   │   ├── contracts/           # Contract management
│   │   │   ├── components/
│   │   │   │   ├── contracts-list/
│   │   │   │   └── contract-modal/
│   │   │   ├── services/
│   │   │   │   ├── contracts.service.ts
│   │   │   │   └── contract-modal.service.ts
│   │   │   └── contracts.component.ts
│   │   ├── projects/            # Project management
│   │   ├── templates/           # Template management
│   │   ├── consumption/         # Consumption tracking
│   │   └── diagnostics/         # System diagnostics
│   │
│   ├── shared/                  # Shared module
│   │   ├── components/          # Reusable components
│   │   │   ├── navigation/
│   │   │   ├── filter-panel/
│   │   │   └── logo-horiz-animated/
│   │   └── styles/              # Shared styles
│   │
│   ├── app.component.ts         # Root component
│   ├── app.config.ts            # Application configuration
│   └── app.routes.ts            # Route configuration
│
├── environments/                # Environment configs
│   ├── environment.ts
│   └── environment.prod.ts
│
├── styles/                      # Global styles
│   └── styles.scss
│
└── assets/                      # Static assets

n8n/                             # n8n workflow definitions
├── contracts-management.json    # Unified workflow (29 endpoints, 360+ nodes)
└── scripts/                     # Workflow sync scripts

Core Architectural Patterns

1. Standalone Components

All components use Angular's standalone architecture (no NgModules):

@Component({
  selector: 'app-contracts',
  standalone: true,
  imports: [CommonModule, MatTableModule, /* ... */],
  template: `...`
})
export class ContractsComponent {}

Benefits:

2. Smart/Dumb Component Pattern

Smart Components (Container/Feature)

Dumb Components (Presentational)

3. Signal-Based State Management

Uses Angular Signals for reactive state:

// Reactive state
projects = signal<Project[]>([]);
loading = signal(false);
error = signal<string | null>(null);

// Computed values
filteredProjects = computed(() => {
  return this.projects().filter(/* ... */);
});

// Effects
effect(() => {
  console.log('Projects changed:', this.projects());
});

Benefits:

4. Lazy Loading

All feature routes are lazy-loaded:

{
  path: 'contracts',
  loadComponent: () => import('./features/contracts/contracts.component')
    .then(m => m.ContractsComponent)
}

Benefits:

5. Service Layer Pattern

Services handle all business logic and API communication:

@Injectable({ providedIn: 'root' })
export class ApiService {
  getContracts(): Observable<ApiResponse<Contract[]>> {
    return this.http.get<Contract[]>(url).pipe(
      catchError(this.handleError),
      map(this.transformResponse)
    );
  }
}

Data Flow

Request Flow

Component
   │
   │ 1. User Action
   ├──────────► Service
   │              │
   │              │ 2. HTTP Request
   │              ├──────────► n8n API
   │              │              │
   │              │              │ 3. Database Query
   │              │              ├──────────► PostgreSQL
   │              │              │
   │              │              │ 4. Response
   │              │              ◄──────────┤
   │              │ 5. Transform
   │              ◄──────────┤
   │ 6. Update Signal
   ◄──────────┤
   │
   │ 7. UI Update (automatic)
   └──────────► View

State Management Flow

User Action → Component Method → Service Call → Signal Update → View Render

API Integration Architecture

n8n Webhook Structure

All endpoints are served via a single unified n8n webhook workflow. See N8N_WORKFLOW_REFERENCE.md for complete API reference.

Unified Workflow: contracts-management.json (29 endpoints)

Note: Some endpoints require webhook path prefixes (e.g., /get-plan-by-id/api/v1/plans/:id).
See OpenAPI Specification for authoritative paths.

API Service Pattern

// 1. Define request
getContracts(params?: QueryParams): Observable<ApiResponse<Contract[]>> {

// 2. Build URL with params
const url = `${this.baseUrl}/contracts${queryString}`;

// 3. Make HTTP call
return this.http.get<any>(url).pipe(

  // 4. Handle errors
  catchError(this.handleError),

  // 5. Transform N8N response
  switchMap(response => this.transformResponse(response))
);
}

Component Lifecycle

Standard Component Lifecycle

export class MyComponent implements OnInit, OnDestroy {
  private subscriptions: Subscription[] = [];

  constructor(private service: MyService) {
    // Dependency injection
  }

  ngOnInit(): void {
    // Initialize component
    // Load data
    // Setup subscriptions
    const sub = this.service.getData().subscribe(/*...*/);
    this.subscriptions.push(sub);
  }

  ngOnDestroy(): void {
    // Clean up subscriptions
    this.subscriptions.forEach(sub => sub.unsubscribe());
  }
}

Routing Architecture

Route Configuration

export const routes: Routes = [
  {
    path: '',
    redirectTo: '/contracts',
    pathMatch: 'full'
  },
  {
    path: 'contracts',
    loadComponent: () => import('./features/contracts/contracts.component')
      .then(m => m.ContractsComponent)
  },
  // ... other routes
  {
    path: '**',
    redirectTo: '/contracts'
  }
];
User clicks navigation → Router activates route → Lazy load component → Render view

Security Considerations

Current Implementation

Future Enhancements


Performance Optimization

Implemented Optimizations

  1. Lazy Loading: All feature modules loaded on-demand
  2. Virtual Scrolling: For large data sets (TODO)
  3. OnPush Change Detection: Where applicable
  4. Signal-based updates: Fine-grained reactivity
  5. HTTP Caching: Via interceptors (TODO)
  6. Bundle Optimization: Code splitting, tree-shaking

Build Output


Testing Strategy (Future)

Unit Tests

Integration Tests

E2E Tests


Deployment Architecture

Development

npm start → ng serve → localhost:4200

Production Build

npm run build → dist/ → Static hosting

Hosting Options


Future Architecture Enhancements

  1. State Management: Consider NgRx for complex state
  2. PWA: Offline support with Service Workers
  3. Internationalization: Multi-language support
  4. Testing: Comprehensive test suite
  5. CI/CD: Automated testing and deployment
  6. Monitoring: Error tracking and analytics
  7. Authentication: User management system

Path Aliases

Configured in tsconfig.json:

"paths": {
  "@core/*": ["src/app/core/*"],
  "@shared/*": ["src/app/shared/*"],
  "@features/*": ["src/app/features/*"],
  "@environments/*": ["src/environments/*"]
}

Usage:

// Instead of: import { ApiService } from '../../core/services/api.service';
import { ApiService } from '@core/services/api.service';

References


Maintained By: Development Team
Last Review: 2026-01-08

Attached Files

Loading attached files...

Comments

No comments yet. Be the first to comment!

Search Results