Skip to content

Conversation

Copy link

Copilot AI commented Oct 28, 2025

Migrates database from MongoDB to SQLite and replaces Clerk third-party auth with custom JWT email/password authentication.

Database Changes

  • SQLite + Drizzle ORM replaces MongoDB + Mongoose
  • Database auto-initializes at data/skytracker.db on first run
  • Schema mirrors existing structure: users, skylanders, settings, wishlist, collection, watching
  • All 25+ API endpoints updated to use new database utilities in server/utils/database.ts

Authentication Changes

  • JWT tokens (7-day expiry) replace Clerk sessions
  • Bcrypt password hashing (10 rounds) for user credentials
  • New endpoints: POST /api/auth/register, POST /api/auth/login, GET /api/auth/me
  • Auth middleware validates JWT via ST-Auth-Token header
  • Frontend: useAuth composable manages auth state with localStorage persistence

Frontend Updates

  • LoginModal and RegisterModal components replace Clerk UI
  • Updated components: navbar, shortcuts, settings page
  • Auth plugin initializes state and verifies token on page load

Migration Notes

  • Users must re-register (Clerk passwords not portable)
  • Skylanders data can be repopulated via existing scrape script
  • Set JWT_SECRET environment variable (see .env.example)

Example usage:

// useAuth composable
const { user, isSignedIn, login, logout } = useAuth();

await login('user@example.com', 'password');
// Token stored in localStorage, auto-included in API requests

Dependencies removed: mongoose, @clerk/backend, vue-clerk
Dependencies added: better-sqlite3, drizzle-orm, bcryptjs, jsonwebtoken

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/softmodded/skytracker/events
    • Triggering command: node /home/REDACTED/work/skytracker/skytracker/node_modules/.bin/nuxt build (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Rework the database to use SQLITE instead of Mongo and change clerk out for a custom auth solution that also allows email + Password

[Chronological Review: The conversation began with a user request to rework the database from MongoDB to SQLite and to replace the existing authentication system (Clerk) with a custom solution that supports email and password authentication. The user reiterated this request multiple times, indicating a focus on these two major changes.]

[Intent Mapping:

  • User Request: "Rework the database to use SQLITE instead of Mongo and change clerk out for a custom auth solution that also allows email + Password." This request indicates a desire to simplify the database architecture and implement a more customizable authentication method.]

[Technical Inventory:

  • Database Technology: MongoDB (current) to be replaced with SQLite.
  • Authentication: Clerk (current) to be replaced with a custom authentication solution supporting email and password.]

[Code Archaeology: No specific files or code changes have been discussed yet, as the conversation has focused on high-level requests rather than specific implementations.]

[Progress Assessment: No tasks have been completed yet; the user has only made requests for changes.]

[Context Validation: The user’s requests for transitioning to SQLite and implementing a custom authentication solution are clearly captured and ready for further action.]

[Recent Commands Analysis:

  • Last Agent Commands: The user has repeatedly requested the same changes without any specific tool commands executed by the agent.
  • Tool Results Summary: There have been no tool results to summarize as no commands were executed.
  • Pre-Summary State: The agent was actively awaiting further instructions or clarifications regarding the user’s requests when the token budget was exceeded.
  • Operation Context: The user’s requests are directly tied to improving the project’s database management and authentication processes.]
1. Conversation Overview: - Primary Objectives: The user explicitly requested to "Rework the database to use SQLITE instead of Mongo and change clerk out for a custom auth solution that also allows email + Password." - Session Context: The conversation has focused on the user's desire to transition from MongoDB to SQLite and replace the Clerk authentication system with a custom solution. - User Intent Evolution: The user has consistently reiterated their request for these changes, indicating a strong focus on simplifying the database and enhancing authentication.
  1. Technical Foundation:
  • Database Technology: MongoDB (current) to be replaced with SQLite.
  • Authentication Framework: Clerk (current) to be replaced with a custom authentication solution that supports email and password.
  1. Codebase Status:
  • No specific files or code changes have been discussed yet, as the conversation has primarily revolved around high-level requests.
  1. Problem Resolution:
  • Issues Encountered: No specific technical problems have been discussed yet.
  • Solutions Implemented: No solutions have been implemented as the conversation is still in the request phase.
  • Debugging Context: No ongoing troubleshooting efforts have been mentioned.
  • Lessons Learned: No insights or patterns have been discovered yet.
  1. Progress Tracking:
  • Completed Tasks: No tasks have been completed.
  • Partially Complete Work: The user’s requests are pending implementation.
  • Validated Outcomes: No features or code have been confirmed working.
  1. Active Work State:
  • Current Focus: The user is focused on transitioning the database and authentication system.
  • Recent Context: The last few exchanges have been reiterations of the same request for database and authentication changes.
  • Working Code: No specific code snippets have been discussed.
  • Immediate Context: The user is looking to implement SQLite and a custom authentication solution.
  1. Recent Operations:
  • Last Agent Commands: No specific commands were executed by the agent.
  • Tool Results Summary: There have been no tool results to summarize as no commands were executed.
  • Pre-Summary State: The agent was awaiting further instructions regarding the user’s requests.
  • Operation Context: The user’s requests are aimed at improving the project’s database management and authentication processes.
  1. Continuation Plan:
  • Pending Task 1: Transition the database from MongoDB to SQLite.
  • Pending Task 2: Implement a custom authentication solution that supports email and password.
  • Priority Information: The transition to SQLite and the custom authentication solution are both high-priority tasks.
  • Next Action: Begin planning the implementation of SQLite and the custom authentication system based on the user’s requests.
TITLE: Switching to SQLite and custom authentication solution

Created from VS Code via the GitHub Pull Request extension.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits October 28, 2025 16:14
…tom JWT

Co-authored-by: brandonapt <63559800+brandonapt@users.noreply.github.com>
Co-authored-by: brandonapt <63559800+brandonapt@users.noreply.github.com>
Co-authored-by: brandonapt <63559800+brandonapt@users.noreply.github.com>
Copilot AI changed the title [WIP] Rework database to use SQLite and implement custom authentication Replace MongoDB/Clerk with SQLite/JWT authentication Oct 28, 2025
Copilot AI requested a review from brandonapt October 28, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants