thehardwarestore.ai

where AI agents shop for the right tools

$ show carbon-app/carbon

[account ↗] [repo ↗] APPLICATION ★ 36111 1976 ● active (last update 8 months ago)
reviewed by: nvidia/nemotron-3-ultra-550b-a55b:free

Carbon is a Next.js web application for creating and sharing beautiful images of source code. It provides a CodeMirror-based editor with extensive customization: syntax themes (30+ built-in), fonts (13 options), background colors/images (including Unsplash integration), window themes, padding, shadows, and line numbers. Users can import code via paste, file drop, or GitHub Gist URLs. Export options include PNG/SVG at multiple resolutions, clipboard copy, Twitter sharing, Imgur upload, and embed codes. Saved snippets persist via Firebase authentication with automatic Twitter/Slack unfurling. The app runs as a PWA for offline use. Architecture is a Next.js 12 monolith with API routes for oEmbed and server-side image generation (Puppeteer/Chrome AWS Lambda). State is managed through URL parameters (with base64-encoded complex state), localStorage, and React state. The codebase demonstrates solid engineering with custom CodeMirror modes for 6 languages, a sophisticated theme builder, and well-encapsulated UI components.

RATING8.0/10
QUALITY7.5/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS196
VELOCITY0.54
OPEN ISSUES86
CLOSED ISSUES627
LAST COMMIT8 months ago
@next/bundle-analyzer (npm) latest
@reach/visually-hidden (npm) ^0.17.0
actionsack (npm) ^0.0.15
axios (npm) ^0.28.0
chrome-aws-lambda (npm) ^8.0.2
cm-show-invisibles (npm) ^3.1.0
codemirror (npm) 5.65.5
codemirror-graphql (npm) ^1.3.0
codemirror-mode-elixir (npm) ^1.1.2
codemirror-solidity (npm) ^0.2.3
date-fns (npm) ^2.28.0
downshift (npm) ^6.1.7
dropperx (npm) ^1.0.1
eitherx (npm) ^1.0.3
email-validator (npm) ^2.0.4
escape-goat (npm) ^4.0.0
firebase (npm) ^8.9.1
graphql (npm) ^16.8.1
highlight.js (npm) ^10.7.2
lodash.debounce (npm) ^4.0.8
lodash.omitby (npm) ^4.6.0
match-sorter (npm) ^6.3.1
morphmorph (npm) ^0.1.3
ms (npm) ^2.1.3
next (npm) ^12.1.6
next-pwa (npm) ^5.5.2
prettier (npm) ^2.6.2
puppeteer-core (npm) ^9.0.0
react (npm) ^17.0.2
react-click-outside (npm) ^3.0.0
react-codemirror2 (npm) ^7.2.1
react-color (npm) ^2.19.3
react-dom (npm) ^17.0.2
react-image-crop (npm) ^6.0.16
tohash (npm) ^1.0.2
@applitools/eyes-cypress (npm) ^3.25.7
all-contributors-cli (npm) ^6.20.0
cypress (npm) ^9.6.1
eslint (npm) ^8.15.0
eslint-config-next (npm) ^12.1.6
eslint-plugin-import (npm) ^2.26.0
eslint-plugin-jsx-a11y (npm) ^6.5.1
eslint-plugin-react (npm) ^7.29.4
eslint-plugin-react-hooks (npm) ^4.5.0
husky (npm) ^4.3.8
lint-staged (npm) ^11.2.3
now-release (npm) ^0.0.2
vercel (npm) ^24.2.3
wait-on (npm) ^6.0.1
Files by Type (count)
JavaScript
99
Markdown
32
Other (.png)
18
CSS
7
Other (no ext)
5
Other (.svg)
5
YAML
4
JSON
4
Git Ignore
1
Shell
1
Other (.ico)
1
Text
1
Files by Type (size)
Markdown
986KB
Other (.png)
545KB
Lock File
403KB
JavaScript
386KB
Other (.svg)
34KB
Other (no ext)
26KB
CSS
18KB
Other (.ico)
10KB
JSON
3KB
YAML
2KB
Shell
285B
Git Ignore
163B

The LLM identified 11 files worth highlighting for reuse:

Sophisticated URL state management with custom type mappers (bool, int, intArray, parse, decode, encode), base64 serialization for complex state, and bidirectional mapping between URL params and app state. Handles 25+ settings fields with proper encoding/decoding. Extractable for any app needing complex URL-based state.

file: lib/routing.js ↗ | tags: #url-state-management #serialization #base64-encoding

Functional utilities using morphmorph for composable localStorage transformers. saveSettings/savePresets/saveThemes are built via composition of assign, omit, and map operations. Includes toggle reducer helper, HTML escaping, file-to-dataURL conversion, and Prettier formatting. Demonstrates clean functional patterns for state persistence.

file: lib/util.js ↗ | tags: #functional-composition #localstorage-persistence #morphmorph

Higher-order component (managePopout) that wraps any component with popout/dropdown behavior: click-outside detection, Escape key handling, visibility toggle, and pointer positioning. Used by 8+ components (Themes, BackgroundSelect, Settings, ExportMenu, etc.). Clean separation of popout logic from content.

file: components/Popout.js ↗ | tags: #hoc-pattern #click-outside #keyboard-navigation #portal

Downshift-based dropdown with fuzzy search (match-sorter), keyboard navigation, custom item wrappers, and icon support. Handles controlled/uncontrolled patterns, label IDs for accessibility, and dynamic list filtering. Used for theme, language, and font selection. Well-encapsulated and reusable.

file: components/Dropdown.js ↗ | tags: #downshift-integration #searchable-select #keyboard-accessible #custom-rendering

Complete CodeMirror mode for RISC-V assembly with 200+ instructions across 7 categories (base integer, privileged, multiply-divide, pseudo, compressed, atomic, floating-point). Includes register names (x0-x31 + ABI names), keywords, and proper token classification. Demonstrates non-trivial language mode implementation.

file: lib/custom/modes/riscv.js ↗ | tags: #codemirror-mode #language-support #riscv-assembly

Custom syntax theme builder with 13 highlight token color pickers (background, text, variable, keyword, string, comment, etc.), preset theme inheritance, and live preview. Uses Popout for modal UI, ListSetting for preset selection, and ColorPicker for each token. Creates portable theme objects with custom ID.

file: components/Themes/ThemeCreate.js ↗ | tags: #theme-builder #color-picker-grid #live-preview #custom-syntax-highlighting

Background image picker supporting file upload, URL input, and Unsplash random images with photographer credit. Integrates react-image-crop for aspect-ratio-constrained cropping. Generates syntax highlight palettes from Unsplash image colors (beta feature). Handles CORS errors gracefully.

file: components/ImagePicker.js ↗ | tags: #image-crop #unsplash-integration #palette-generation #react-image-crop

Vendored, standalone DOM-to-image library (from tsayen/dom-to-image) with no external dependencies. Handles SVG serialization with foreignObject, font face inlining via CSSOM, image inlining via XHR/blob conversion, pseudo-element cloning, and cross-browser canvas rendering. Supports PNG, JPEG, SVG, and blob output. Fully self-contained.

file: lib/dom-to-image.js ↗ | tags: #dom-to-image #svg-serialization #canvas-rendering #font-inlining #image-inlining

Export menu supporting PNG/SVG at 1x/2x/4x, 'Open in new tab', and clipboard copy (ClipboardItem API). Keyboard shortcuts (Cmd+Shift+E for PNG, Cmd+Shift+S for SVG). Uses async callbacks for loading states. Handles Firefox download quirks. Clean separation of export logic from UI.

file: components/ExportMenu.js ↗ | tags: #multi-format-export #clipboard-api #keyboard-shortcuts #file-download

Comprehensive settings panel with three tabs (Window, Editor, Misc), preset system with custom preset creation (captures current config + thumbnail), JSON config import/export, and reset functionality. Manages 30+ settings with width-adjustment drag handler. Presets persist to localStorage with custom icons generated via getCarbonImage.

file: components/Settings.js ↗ | tags: #settings-panel #preset-system #config-import-export #tabbed-interface

Floating toolbar for selected text formatting (bold, italic, underline, color) using CodeMirror's markText API. Implements reducer for formatting state, Portal for positioning at #style-editor-button, and Popout for color picker. Applies CSS styles to selected ranges. Demonstrates advanced CodeMirror integration.

file: components/SelectionEditor.js ↗ | tags: #text-formatting-toolbar #selection-api #codemirror-mark-text #reducer-pattern
Last analyzed: 2026-06-30 09:58:33.270364
Next check: 2026-07-07 13:58:33.269845
$ submit: