Snippets Library

Snippets Library

Code snippet manager with syntax highlighting and sharing

58stars
6forks
Last commit: 4mo ago
Repo age: 1y old
Snippets Library screenshot

Snippets Library is a full-stack code snippet manager for storing, organizing, and sharing code with high-quality syntax highlighting and search. It provides authenticated snippet storage, public share links with view/like tracking, per-user settings, and a RESTful API surface for snippet management.

Key Features

  • Create, edit, delete and organize code snippets with metadata (title, description, language, tags).
  • Server-side syntax highlighting using Shiki with a cached highlighting service and fallback language detection.
  • Public share links implemented via secure random share IDs with view counting, like/unlike and copy-as-new-snippet actions.
  • Per-user bookmarks, likes, and persistent user settings stored in a JSONB settings object.
  • Authentication via NextAuth (GitHub provider) with a Drizzle adapter; sessions stored in the database.
  • Postgres-backed schema using Drizzle ORM; includes snippet views, likes, bookmarks and user tables plus migration scripts.
  • Instant search, pagination, language filtering and tag-based queries on the snippets API.
  • Utility endpoints for language detection, health checks and user settings.

Use Cases

  • Maintain a personal searchable library of commonly used code snippets and templates.
  • Share public examples or utilities with teammates using secure share links and track engagement.
  • Seed a developer blog or documentation with copyable, highlighted snippets and preserve authorship and metadata.

Limitations and Considerations

  • Default authentication is configured for GitHub OAuth; additional providers require custom NextAuth configuration.
  • Requires a PostgreSQL database and appropriate environment variables; migrations are managed via drizzle-kit.
  • Shiki-based server-side highlighting can increase memory/CPU usage at scale and may require caching/worker tuning.
  • The repository snapshot contains no bundled unit tests; testing must be added if required by deployments.

Snippets Library is suited for developers and teams who need a lightweight, self-hosted snippet manager with high-quality highlighting and sharing features. It is configurable for production deployments but requires standard Node/Postgres infrastructure and OAuth credentials to enable authentication.

Categories:

Tags:

Tech Stack:

Share:

Similar Services

asciinema

asciinema

Command-line terminal session recorder and web player

16.7k
994
Last commit: 3d ago

Open-source CLI for recording, replaying and live-streaming terminal sessions using lightweight asciicast files and an embeddable web player.

Alternative to:
Screen Studio
Screen Studio
+1
PrivateBin

PrivateBin

Zero-knowledge encrypted pastebin with browser-side AES encryption

7.9k
953
Last commit: 11d ago

PrivateBin is a minimalist zero-knowledge pastebin that encrypts and decrypts pastes in the browser, with optional passwords, expiration, discussions, and file uploads.

Alternative to:
Pastebin
Pastebin
+5
MicroBin

MicroBin

Secure pastebin for text and file sharing with URL shortening

4k
257
Last commit: 4d ago

MicroBin is a lightweight, secure pastebin for sharing text, files, and short URLs with optional encryption, expiration controls, and raw file serving.

Alternative to:
Pastebin
Pastebin
+17
Opengist

Opengist

Self-hosted Git-backed pastebin and Gist-compatible code snippet manager

2.9k
145
Last commit: 20d ago

Self-hosted pastebin powered by Git. Create, share and manage public, unlisted or private code snippets with syntax highlighting, Git push/pull, OAuth logins and Docker/H...

Alternative to:
Pastebin
Pastebin
+6
Onetime Secret

Onetime Secret

Self-destructing service for sharing single-use encrypted secrets

2.7k
422
Last commit: 3d ago

Open-source web and API service to create encrypted, single-view links for sharing secrets with configurable expiry and optional passphrase protection.

Alternative to:
Onetime Secret
Onetime Secret
+6
ByteStash

ByteStash

Self-hosted web app for storing and organizing code snippets

2k
95
Last commit: 1mo ago

ByteStash is a self-hosted snippet manager for creating, editing, and filtering code snippets with secure storage in SQLite and an optional API with Swagger UI.

Alternative to:
SnippetsLab
SnippetsLab
+2