Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new /badge endpoint that returns a dynamic SVG visitor-counter badge, backed by a new SQLite database (Drizzle ORM + better-sqlite3), and extends the theme system with badge-specific themes plus documentation updates.
Changes:
- Add
/badgeroute +VisitorControllerthat increments a per-username visit counter and returns an SVG badge. - Introduce SQLite persistence (schema + db bootstrap) and Drizzle tooling/scripts.
- Extend theme utilities/types for badge themes and document the new endpoint/usage.
Reviewed changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/themes/badge.ts | Adds badge theme definitions (label/value colors + backgrounds). |
| src/utils/themes.ts | Exports badge themes and adds getBadgeTheme() alongside existing theme utilities. |
| src/types.ts | Introduces BadgeTheme type used by badge theming. |
| src/index.ts | Registers the new GET /badge route and exposes route docs. |
| src/db/schema.ts | Defines the visitors table schema for Drizzle. |
| src/db/index.ts | Sets up SQLite DB file and exports a Drizzle db instance. |
| src/controllers/visitor.ts | Implements the badge endpoint: increments counter and renders badge SVG. |
| src/components/badge-renderer.ts | Generates the badge SVG with theming/custom colors. |
| drizzle.config.ts | Adds Drizzle Kit configuration for SQLite. |
| package.json | Adds DB scripts and Drizzle/SQLite dependencies. |
| package-lock.json | Locks newly added dependency tree for Drizzle + SQLite. |
| README.md | Documents /badge endpoint and README embed usage; formatting tweaks. |
| .gitignore | Ignores the new data/ directory and common IDE/OS files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| ### Prerequisites | ||
|
|
||
| - Node.js 16+ |
There was a problem hiding this comment.
better-sqlite3 v12 requires Node 20+ (per its engines metadata), but the README still lists Node.js 16+ as a prerequisite. Please update the documented Node version (and ideally keep it in sync with package.json/CI) to avoid install/runtime failures.
Suggested change
| - Node.js 16+ | |
| - Node.js 20+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new visitor badge feature to the project, allowing users to embed a dynamic SVG badge in their README that tracks and displays visit counts. It also adds a persistent SQLite-backed database using Drizzle ORM for storing visitor data, updates documentation, and expands theme support to badges. Several new scripts and dependencies are included for database management.
New Visitor Badge Feature:
/badgeendpoint, which returns a dynamic SVG badge showing the number of visits for a given username. The badge supports themes and customizable colors via query parameters. [1] [2] [3] [4] [5]BadgeRenderercomponent for generating SVG badges, including theme and color customization logic.README.mdwith usage instructions, endpoint details, and example queries for the visitor badge feature.Database Integration and Schema:
package.jsonfor database generation, migration, and studio access.Theme System Enhancements:
Documentation and Developer Experience:
README.mdformatting, added endpoint examples, and clarified setup instructions for development and API usage. [1] [2] [3] [4] [5] [6] [7]Miscellaneous:
Let me know if you'd like a deeper dive into any of these changes!