Add Personal Access Tokens (API Keys) for External Tool Authentication#27
Merged
0xGingi merged 8 commits intonanogpt-community:mainfrom Jan 7, 2026
thejudge22:api-access
Merged
Add Personal Access Tokens (API Keys) for External Tool Authentication#270xGingi merged 8 commits intonanogpt-community:mainfrom thejudge22:api-access
0xGingi merged 8 commits intonanogpt-community:mainfrom
thejudge22:api-access
Conversation
For building/testing locally.
…tokens (API keys).
…for message generation.
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.
Summary
This PR implements Personal Access Tokens (PATs) that allow users to authenticate with the nano-chat API using Bearer tokens from external tools like
curl, scripts, or integrations.Features
/account/developer) - New UI for generating and managing API keysAuthorization: Bearer nc_...header with the generate-message endpointlastUsedAttimestamp updates on each API callChanges
New Files
drizzle/0022_add_api_keys.sql- Database migrationsrc/routes/api/api-keys/+server.ts- API key CRUD endpoints (GET/POST/DELETE)src/routes/account/developer/+page.server.ts- Server load functionsrc/routes/account/developer/+page.svelte- Developer settings UIscripts/test-api-key.sh- Verification scriptModified Files
src/lib/db/schema.ts- AddedapiKeystable, relations, and type exportssrc/routes/api/generate-message/+server.ts- Added Bearer token authentication supportsrc/routes/account/+layout.svelte- Added "Developer" navigation itemAPI Usage
Testing
/account/developer./scripts/test-api-key.sh nc_your_key_hereKey Design Decisions
nc_<uuid>prefix for easy identification