# MarkEdit A modern, git-based markdown editor for managing blog posts stored in GitHub repositories. Edit your markdown files with a beautiful WYSIWYG editor, track changes with automatic version control, and publish updates via pull requests. ## Features - **Beautiful WYSIWYG Editor** - Rich text editing powered by TipTap with markdown support - **Frontmatter Support** - Edit YAML frontmatter metadata alongside your content - **Auto-save** - Changes are automatically saved as drafts every 2 seconds - **Git Integration** - Automatic branching, commits, and pull request creation - **GitHub OAuth** - Secure authentication with your GitHub account - **Multi-repo Support** - Work with multiple repositories and folder structures - **Fast & Lightweight** - Built with modern technologies for optimal performance - **Docker Ready** - Easy deployment with Docker and docker-compose ## Quick Start ### Prerequisites - Docker and Docker Compose installed - GitHub OAuth application credentials ([Setup Guide](./SETUP.md)) ### Run with Docker 1. Clone the repository: ```bash git clone https://tangled.org/usaa.ma/markedit cd markedit ``` 2. Copy the environment file and configure: ```bash cp .env.example .env # Edit .env with your GitHub OAuth credentials ``` 3. Start the application: ```bash make up ``` 4. Open your browser to `http://localhost:3000` That's it! The application will be running with all dependencies containerized. ## Development ### Local Development Setup #### Backend Requirements: - Go 1.24 or higher ```bash cd backend cp .env.example .env # Edit .env with your credentials # Run migrations and start server go run cmd/server/main.go ``` The backend will start on `http://localhost:8080` #### Frontend Requirements: - Bun 1.x or higher ```bash cd frontend bun install bun run dev ``` The frontend will start on `http://localhost:4321` ## How It Works ### Workflow 1. **Authenticate** - Sign in with your GitHub account 2. **Select Repository** - Choose the GitHub repo containing your blog posts 3. **Select Folder** - Optionally specify a folder within the repo 4. **Edit Files** - Browse and edit markdown files with the WYSIWYG editor 5. **Auto-save** - Changes are automatically saved as drafts 6. **Publish** - Create a pull request with your changes ### Git Integration MarkEdit uses a smart branching strategy: - Creates timestamped branches: `markedit-{unix_timestamp}` - Reuses branches if they're less than 4 hours old - Automatically commits your changes with descriptive messages - Creates pull requests with your custom title and description - Cleans up drafts after successful publication ### Draft System - All edits are saved as drafts in the SQLite database - Drafts are user-specific and file-specific - Published changes replace the draft content - Drafts are automatically deleted after successful PR creation ## Configuration ### Environment Variables See [SETUP.md](./SETUP.md) for detailed configuration instructions. **Backend** (`.env`): ```bash GITHUB_CLIENT_ID=your_github_oauth_client_id GITHUB_CLIENT_SECRET=your_github_oauth_client_secret SESSION_SECRET=random-32-character-string DATABASE_PATH=./data/markedit.db GIT_CACHE_DIR=./data/repos CORS_ALLOWED_ORIGINS=http://localhost:4321,http://localhost:3000 ``` **Frontend** (`frontend/.env`): ```bash PUBLIC_API_URL=http://localhost:8080 ``` ## Deployment ### Docker Production Deployment 1. Configure environment variables in `.env` 2. Build and start containers: ```bash make build make up ``` 3. Check logs: ```bash make logs ``` 4. Stop containers: ```bash make down ``` ### Manual Deployment See [SETUP.md](./SETUP.md) for detailed deployment instructions for various platforms. ## Makefile Commands ```bash make build # Build Docker images make up # Start containers make down # Stop containers make restart # Restart containers make logs # View logs make logs-f # Follow logs make clean # Remove containers and volumes make shell-be # Access backend shell make shell-fe # Access frontend shell ``` ## Security - OAuth tokens are securely stored and never exposed to the frontend - Session cookies are encrypted and HTTP-only - File operations are scoped to authenticated user's accessible repos - Git operations use the user's GitHub token with appropriate permissions ## Contributing I am not expecting contributions yet. I will have a guide here once I am ready. ## License MIT License - see [LICENSE](./LICENSE) for details ## Support For detailed setup instructions, see [SETUP.md](./SETUP.md) For issues and feature requests, please use [Tangled Issues](https://tangled.org/usaa.ma/markedit/issues)