Snipr: A Personal Code Library with Ownership Checks

Dalrymple Ramos

Project overview

Snipr is a code snippet management app built for developers who want one organized place to store, manage, and access their favorite code patterns.

Convex keeps saved snippets synchronized in real time, while Clerk manages access to the library. Developers can collect and retrieve reusable patterns in one place instead of searching through old projects.

Built with

table of contents

Snipr gives developers a place to collect code snippets, organize folders, and retrieve favorite patterns. It uses Next.js, Convex, Clerk, and syntax-highlighting tools for a synchronized personal library.

My implementation focus#

The implementation focus is ownership across reading and mutation paths. A personal library needs more than a query filtered to the current user: editing, deletion, and folder assignment also need to inspect the stored records.

The inspected Convex functions and schema show the relevant data relationships and access decisions.

Derive the owner on the server#

Creating a snippet obtains the authenticated identity and uses its subject as the owner. The client does not choose that owner identifier.

Listing snippets uses a user index. Favorites use a composite user-and-favorite index. These indexes support the access pattern; they do not independently enforce all permissions.

Check both sides of folder assignment#

Update and delete operations load the stored snippet and compare its owner with the authenticated user. Adding a snippet to a folder checks both the snippet owner and the folder owner.

Checking only one side could let a valid identifier create a relationship across two users' libraries. The server checks the records behind those identifiers before changing the relationship.

Demonstrable result and limitations#

The source provides concrete ownership checks for core library operations, alongside realtime retrieval and organization. This is implementation evidence rather than a comprehensive security audit or a measured productivity claim.

Future review should follow every new mutation through the same ownership questions, especially if sharing or collaboration is added. The companion article explains ownership beyond an indexed query.