Structural Libraries

Foundational libraries that power GoGrab Space applications

📚 Structural Libraries

Structural Angular libraries that provide essential functionality for all GoGrab Space applications.

This section documents the structural libraries that form the backbone of the GoGrab Space ecosystem, providing reusable components, services, and utilities that power our applications.

🎯 What Are Structural Libraries?

Structural libraries are shared, standalone Angular libraries that:

📖 Available Libraries

🌌 Singularity Library ⭐ PRIMARY LIBRARY

The flagship library for hierarchical content visualization and management.

Key Features:

Components:

Services:

Use Cases:

→ Full Documentation


🏗️ Library Architecture

Dependency Flow

┌─────────────────────────────────────┐
│  Applications (gograb-space, etc.)  │
└────────────────┬────────────────────┘
                 ↓
┌─────────────────────────────────────────────────┐
│  Structural Libraries (singularity-lib)      │
└────────────────┬─────────────────────────────┘
                 ↓
┌───────────────────────────────────────────────┐
│  Shared Systems                     │
│  • @storage-system                  │
│  • @theme-system                    │
└─────────────────────────────────────┘

Import Pattern

// Import from path alias
import {
  SpaceEditorComponent,
  SpaceMapFlashStateService,
  PageNode,
  GalaxyGroup
} from '@space-map-lib';

// Use in your component
@Component({
  standalone: true,
  imports: [SpaceEditorComponent],
  template: '<space-editor></space-editor>'
})
export class MyComponent {
  private spaceState = inject(SpaceMapFlashStateService);

  worlds = this.spaceState.worlds;
  galaxies = this.spaceState.galaxies;
}

🎯 Why Use Structural Libraries?

For Application Developers

✅ Reduced Development Time

✅ Consistent Experience

✅ Easy Maintenance

For Library Maintainers

✅ Single Source of Truth

✅ Better Testing

✅ Clear Dependencies

🔧 Integration Best Practices

1. Use TypeScript Path Aliases

// ✅ DO: Use path alias
import { SpaceEditorComponent } from '@space-map-lib';

// ❌ DON'T: Use relative paths
import { SpaceEditorComponent } from '../../../../libs/space-map-lib/src/...';

2. Import Only What You Need

// ✅ DO: Tree-shakeable imports
import { SpaceEditorComponent } from '@space-map-lib';

// ❌ DON'T: Wildcard imports
import * as SpaceMapLib from '@space-map-lib';

3. Follow Standalone Component Patterns

// ✅ DO: Use standalone imports
@Component({
  standalone: true,
  imports: [SpaceEditorComponent, CommonModule]
})
export class MyComponent {}

// ❌ DON'T: Use NgModules
@NgModule({
  imports: [SpaceMapLibModule]
})
export class MyModule {}

4. Leverage Dependency Injection

// ✅ DO: Use inject() function
export class MyComponent {
  private spaceState = inject(SpaceMapFlashStateService);
}

// ✅ ALSO OK: Constructor injection
export class MyComponent {
  constructor(private spaceState: SpaceMapFlashStateService) {}
}

🚀 Building Structural Libraries

Development Commands

# Build the library
npx nx build space-map-lib

# Run tests
npx nx test space-map-lib

# Lint code
npx nx lint space-map-lib

# Build all core libs
npx nx run-many --target=build --projects=space-map-lib,other-lib

Publishing Pattern

Core libraries are built as part of the monorepo and referenced via TypeScript path aliases. No separate publishing step required!

📊 Library Metrics

Space Map Library

🔗 Related Documentation

System Integration

Application Usage

Development Guides

💡 Future Libraries

Planned structural libraries for the GoGrab Space ecosystem:

🎨 Cosmic UI Kit

Reusable UI components with space-themed styling:

🔄 Sync Engine

Real-time synchronization across devices:

📊 Analytics Core

Unified analytics and monitoring:


📚 Structural libraries provide the foundation for building amazing GoGrab Space applications!

Leverage these well-tested, production-ready components to accelerate your development and ensure consistency across the entire platform.