# sparticle999/spacecompany architecture

> Architecture diagram of the GitHub repository sparticle999/spacecompany, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sparticle999/spacecompany
- Repository: https://github.com/sparticle999/spacecompany

## Overview

Space Company is a browser-based incremental game: players build resource production, research unlocks, expand through the solar system, then pursue interstellar exploration and galaxy-scale projects. The map highlights the economy, progression, interface, and long-term systems documented in the README. The excerpts show selected resource and UI interactions; many runtime links and some capabilities are documented but not visible in the sampled code, so those links are omitted or marked unverified.

Main entry points: [`resources.js`](https://github.com/sparticle999/spacecompany/blob/gh-pages/resources.js) (Resource economy), [`interstellar.js`](https://github.com/sparticle999/spacecompany/blob/gh-pages/interstellar.js) (Interstellar exploration), [`game.js`](https://github.com/sparticle999/spacecompany/blob/gh-pages/game.js) (Game runtime), [`core.js`](https://github.com/sparticle999/spacecompany/blob/gh-pages/core.js) (Production logic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_economy["Resource economy"]
  node_core["Production logic<br/>[core.js]"]
  node_resources["Resource economy<br/>[resources.js]"]
  node_resource_data["Resource definitions<br/>[resourceData.js]"]
  node_building_data["Building definitions<br/>[buildingData.js]"]
end

subgraph group_progression["Progression systems"]
  node_science["Science production<br/>[science.js]"]
  node_tech["Research system<br/>[tech.js]"]
  node_tech_data["Research definitions<br/>[techData.js]"]
  node_achievements["Achievements<br/>[achievements.js]"]
  node_achievement_data["Achievement definitions"]
  node_wonders["Wonders<br/>[wonder.js]"]
end

subgraph group_expansion["Space expansion"]
  node_solar["Solar system<br/>[solarSystem.js]"]
  node_rockets["Rocket travel<br/>[rocket.js]"]
  node_interstellar["Interstellar exploration<br/>[interstellar.js]"]
  node_star_data["Star catalog<br/>[starData.js]"]
  node_stargaze["Stargaze and rebirth<br/>[stargaze.js]"]
  node_stargaze_data["Stargaze definitions<br/>[stargazeData.js]"]
end

subgraph group_interface["Game interface"]
  node_tabs["Tab framework<br/>[gameTabUI.js]"]
  node_legacy_ui["Core game interface<br/>[legacyUI.js]"]
  node_resource_ui["Resource interface<br/>[resourceUI.js]"]
  node_achievement_ui["Achievement interface<br/>[achievementUI.js]"]
  node_interstellar_ui["Interstellar interface<br/>[interstellarUI.js]"]
  node_stargaze_ui["Stargaze interface<br/>[stargazeUI.js]"]
end

subgraph group_runtime["Runtime and state"]
  node_game["Game runtime<br/>[game.js]"]
  node_saving["Save and load<br/>[saving.js]"]
  node_settings["Settings<br/>[settings.js]"]
  node_statistics["Statistics<br/>[statistics.js]"]
  node_notifications["Notifications<br/>[notification.js]"]
  node_variables["Game variables<br/>[variable.js]"]
end

node_player(("Player"))

node_player -.->|"plays"| node_game
node_core -->|"adds production"| node_resources
node_core -->|"formats costs"| node_settings
node_resources -->|"reads efficiency"| node_tech
node_resources -->|"checks unlocks"| node_statistics
node_building_data -.->|"defines producers"| node_resources
node_tech_data -.->|"defines research"| node_tech
node_achievement_data -.->|"defines goals"| node_achievements
node_wonders -->|"records milestones"| node_statistics
node_wonders -->|"unlocks access"| node_interstellar
node_solar -.->|"supports travel"| node_rockets
node_star_data -.->|"supplies star catalog"| node_interstellar
node_stargaze_ui -->|"reads progression"| node_stargaze
node_stargaze_ui -->|"reads rocket parts"| node_interstellar
node_interstellar_ui -->|"renders exploration"| node_interstellar
node_tabs -.->|"accepts navigation"| node_player
node_legacy_ui -->|"formats values"| node_settings
node_resource_ui -.->|"shows resources"| node_resources
node_achievement_ui -.->|"shows achievements"| node_achievements
node_game -.->|"persists progress"| node_saving
node_game -.->|"reports events"| node_notifications
node_stargaze_data -.->|"defines upgrades"| node_stargaze

click node_game "https://github.com/sparticle999/spacecompany/blob/gh-pages/game.js"
click node_core "https://github.com/sparticle999/spacecompany/blob/gh-pages/core.js"
click node_resources "https://github.com/sparticle999/spacecompany/blob/gh-pages/resources.js"
click node_resource_data "https://github.com/sparticle999/spacecompany/blob/gh-pages/data/resourceData.js"
click node_building_data "https://github.com/sparticle999/spacecompany/blob/gh-pages/data/buildingData.js"
click node_science "https://github.com/sparticle999/spacecompany/blob/gh-pages/science.js"
click node_tech "https://github.com/sparticle999/spacecompany/blob/gh-pages/tech.js"
click node_tech_data "https://github.com/sparticle999/spacecompany/blob/gh-pages/data/techData.js"
click node_achievements "https://github.com/sparticle999/spacecompany/blob/gh-pages/achievements.js"
click node_achievement_data "https://github.com/sparticle999/spacecompany/blob/gh-pages/data/achievementsData.js"
click node_wonders "https://github.com/sparticle999/spacecompany/blob/gh-pages/wonder.js"
click node_solar "https://github.com/sparticle999/spacecompany/blob/gh-pages/solarSystem.js"
click node_rockets "https://github.com/sparticle999/spacecompany/blob/gh-pages/rocket.js"
click node_interstellar "https://github.com/sparticle999/spacecompany/blob/gh-pages/interstellar.js"
click node_star_data "https://github.com/sparticle999/spacecompany/blob/gh-pages/data/starData.js"
click node_stargaze "https://github.com/sparticle999/spacecompany/blob/gh-pages/stargaze.js"
click node_stargaze_data "https://github.com/sparticle999/spacecompany/blob/gh-pages/data/stargazeData.js"
click node_saving "https://github.com/sparticle999/spacecompany/blob/gh-pages/saving.js"
click node_settings "https://github.com/sparticle999/spacecompany/blob/gh-pages/settings.js"
click node_statistics "https://github.com/sparticle999/spacecompany/blob/gh-pages/statistics.js"
click node_notifications "https://github.com/sparticle999/spacecompany/blob/gh-pages/notification.js"
click node_tabs "https://github.com/sparticle999/spacecompany/blob/gh-pages/ui/gameTabUI.js"
click node_legacy_ui "https://github.com/sparticle999/spacecompany/blob/gh-pages/ui/legacyUI.js"
click node_resource_ui "https://github.com/sparticle999/spacecompany/blob/gh-pages/ui/resourceUI.js"
click node_achievement_ui "https://github.com/sparticle999/spacecompany/blob/gh-pages/ui/achievementUI.js"
click node_interstellar_ui "https://github.com/sparticle999/spacecompany/blob/gh-pages/ui/interstellarUI.js"
click node_stargaze_ui "https://github.com/sparticle999/spacecompany/blob/gh-pages/ui/stargazeUI.js"
click node_variables "https://github.com/sparticle999/spacecompany/blob/gh-pages/variable.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_core,node_resources,node_resource_data,node_building_data toneBlue
class node_science,node_tech,node_tech_data,node_achievements,node_achievement_data,node_wonders toneAmber
class node_solar,node_rockets,node_interstellar,node_star_data,node_stargaze,node_stargaze_data toneMint
class node_tabs,node_legacy_ui,node_resource_ui,node_achievement_ui,node_interstellar_ui,node_stargaze_ui toneRose
class node_game,node_saving,node_settings,node_statistics,node_notifications,node_variables,node_player toneIndigo
```

## Components

### Resource economy

- [Production logic](https://github.com/sparticle999/spacecompany/blob/gh-pages/core.js): `core.js`
- [Resource economy](https://github.com/sparticle999/spacecompany/blob/gh-pages/resources.js): `resources.js`
- [Resource definitions](https://github.com/sparticle999/spacecompany/blob/gh-pages/data/resourceData.js): `data/resourceData.js`
- [Building definitions](https://github.com/sparticle999/spacecompany/blob/gh-pages/data/buildingData.js): `data/buildingData.js`

### Progression systems

- [Science production](https://github.com/sparticle999/spacecompany/blob/gh-pages/science.js): `science.js`
- [Research system](https://github.com/sparticle999/spacecompany/blob/gh-pages/tech.js): `tech.js`
- [Research definitions](https://github.com/sparticle999/spacecompany/blob/gh-pages/data/techData.js): `data/techData.js`
- [Achievements](https://github.com/sparticle999/spacecompany/blob/gh-pages/achievements.js): `achievements.js`
- [Achievement definitions](https://github.com/sparticle999/spacecompany/blob/gh-pages/data/achievementsData.js): `data/achievementsData.js`
- [Wonders](https://github.com/sparticle999/spacecompany/blob/gh-pages/wonder.js): `wonder.js`

### Space expansion

- [Solar system](https://github.com/sparticle999/spacecompany/blob/gh-pages/solarSystem.js): `solarSystem.js`
- [Rocket travel](https://github.com/sparticle999/spacecompany/blob/gh-pages/rocket.js): `rocket.js`
- [Interstellar exploration](https://github.com/sparticle999/spacecompany/blob/gh-pages/interstellar.js): `interstellar.js`
- [Star catalog](https://github.com/sparticle999/spacecompany/blob/gh-pages/data/starData.js): `data/starData.js`
- [Stargaze and rebirth](https://github.com/sparticle999/spacecompany/blob/gh-pages/stargaze.js): `stargaze.js`
- [Stargaze definitions](https://github.com/sparticle999/spacecompany/blob/gh-pages/data/stargazeData.js): `data/stargazeData.js`

### Game interface

- [Tab framework](https://github.com/sparticle999/spacecompany/blob/gh-pages/ui/gameTabUI.js): `ui/gameTabUI.js`
- [Core game interface](https://github.com/sparticle999/spacecompany/blob/gh-pages/ui/legacyUI.js): `ui/legacyUI.js`
- [Resource interface](https://github.com/sparticle999/spacecompany/blob/gh-pages/ui/resourceUI.js): `ui/resourceUI.js`
- [Achievement interface](https://github.com/sparticle999/spacecompany/blob/gh-pages/ui/achievementUI.js): `ui/achievementUI.js`
- [Interstellar interface](https://github.com/sparticle999/spacecompany/blob/gh-pages/ui/interstellarUI.js): `ui/interstellarUI.js`
- [Stargaze interface](https://github.com/sparticle999/spacecompany/blob/gh-pages/ui/stargazeUI.js): `ui/stargazeUI.js`

### Runtime and state

- [Game runtime](https://github.com/sparticle999/spacecompany/blob/gh-pages/game.js): `game.js`
- [Save and load](https://github.com/sparticle999/spacecompany/blob/gh-pages/saving.js): `saving.js`
- [Settings](https://github.com/sparticle999/spacecompany/blob/gh-pages/settings.js): `settings.js`
- [Statistics](https://github.com/sparticle999/spacecompany/blob/gh-pages/statistics.js): `statistics.js`
- [Notifications](https://github.com/sparticle999/spacecompany/blob/gh-pages/notification.js): `notification.js`
- [Game variables](https://github.com/sparticle999/spacecompany/blob/gh-pages/variable.js): `variable.js`

### Other components

- **Player**

## Connections

- Player → Game runtime: plays
- Production logic → Resource economy: adds production (evidence: `resources.js`)
- Production logic → Settings: formats costs (evidence: `core.js`)
- Resource economy → Research system: reads efficiency (evidence: `resources.js`)
- Resource economy → Statistics: checks unlocks (evidence: `resources.js`)
- Building definitions → Resource economy: defines producers
- Research definitions → Research system: defines research
- Achievement definitions → Achievements: defines goals
- Wonders → Statistics: records milestones (evidence: `wonder.js`)
- Wonders → Interstellar exploration: unlocks access (evidence: `wonder.js`)
- Solar system → Rocket travel: supports travel
- Star catalog → Interstellar exploration: supplies star catalog
- Stargaze interface → Stargaze and rebirth: reads progression (evidence: `ui/stargazeUI.js`)
- Stargaze interface → Interstellar exploration: reads rocket parts (evidence: `ui/stargazeUI.js`)
- Interstellar interface → Interstellar exploration: renders exploration (evidence: `ui/interstellarUI.js`)
- Tab framework → Player: accepts navigation
- Core game interface → Settings: formats values (evidence: `ui/legacyUI.js`)
- Resource interface → Resource economy: shows resources
- Achievement interface → Achievements: shows achievements
- Game runtime → Save and load: persists progress
- Game runtime → Notifications: reports events
- Stargaze definitions → Stargaze and rebirth: defines upgrades
