A deployable markdown editor that connects with your self hosted files and lets you edit in a beautiful interface
Implementation Plan#
1. Save & Load Last Repo (Backend & Database)#
Objective: Store the user's last accessed repository in the database and return it upon login.
Database Schema#
- Create a new migration
backend/internal/database/migrations/002_add_last_repo.sql:- Add
last_repocolumn (TEXT) to theuserstable.
- Add
- Update
backend/internal/database/migrations.goto ensure the new migration file is embedded and executed.
Backend Logic#
- Update
backend/internal/database/models.go:- Add
LastRepo stringto theUserstruct.
- Add
- Update
backend/internal/database/queries.go:- Update
GetUserByIDquery and scan. - Update
GetUserByGithubIDquery and scan. - Update
CreateUserquery and scan. - Add
UpdateUserRepo(userID int, repoName string)function.
- Update
- Update
backend/internal/api/handlers/auth.go:- In
GetCurrentUser, includelast_repoin the response. - Create
UpdateUserRepohandler to handlePOST /api/user/repo.
- In
- Update
backend/internal/api/router.go:- Register the new route
POST /api/user/repo.
- Register the new route
2. Remove Folder Selection Step (Frontend)#
Objective: Simplify the setup wizard to skip the folder selection step and default to root.
Frontend Logic#
- Modify
frontend/src/components/dashboard/SetupWizard.tsx:- Remove the "Step 2" (Folder Configuration) UI and logic.
- Change "Next" button in Step 1 to "Complete Setup".
- On submission, default the folder path to
""(root).
3. Filter Empty Folders (Backend)#
Objective: Only show folders that actually contain markdown files (recursively).
Backend Logic#
- Modify
backend/internal/connectors/github.go:- In
ListFiles:- Implement logic to check if a directory or its subdirectories contain matching files (based on extensions).
- If a directory is empty (contains no matching files), exclude it from the returned
FileNodestructure.
- In
4. Separate Repo Selection URL (Frontend Routing)#
Objective: Create a distinct URL for repo selection to support browser navigation.
Frontend Architecture#
- Create
frontend/src/pages/select-repo.astro:- Migrate
SetupWizardcomponent usage here.
- Migrate
- Update
frontend/src/pages/dashboard.astro&DashboardApp.tsx:- Check for
last_repoin user data or URL params. - If no repo is active, redirect to
/select-repo. - If repo is active, show the
EditorContainer.
- Check for
- Update Sidebar Navigation:
- "Change repository" button should link to
/select-repo.
- "Change repository" button should link to