Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cordtus/gist-manager

Repository files navigation

Gist Manager

Modern web application for creating, editing, and managing GitHub Gists with advanced features and customizable theming.

Features

Core Functionality

  • GitHub OAuth authentication - Secure login with GitHub account
  • Gist management - Create, edit, delete, and organize your gists
  • Multi-file support - Manage multiple files within a single gist
  • Smart title generation - Automatic descriptive titles from file metadata
  • Live Markdown preview - Real-time preview while editing Markdown files
  • Advanced search - Search by title, filename, content with filters
  • Community sharing - Share and discover gists from other users

Theme System

  • Modern CSS variable-based theming - Consistent design across the app
  • Three theme modes - Light, Dark, and Custom themes
  • Theme Sandbox - Visual theme editor with live preview
  • Customizable colors - Modify 12+ color properties including:
    • Primary colors (buttons, links, highlights)
    • Background and surface colors
    • Text hierarchy colors
    • UI elements (borders, success, warning, danger)

User Experience

  • Responsive design - Works on desktop, tablet, and mobile
  • Collapsible sidebar - Space-efficient navigation
  • Toast notifications - User-friendly feedback system
  • File format conversion - Convert between Markdown, HTML, and plain text
  • Syntax highlighting - Code display with language detection
  • Per-user cache isolation - Enhanced security and performance

Requirements

  • Node.js 18+ (recommended) or 14+ (minimum)
  • Yarn package manager
  • GitHub account
  • GitHub OAuth application credentials

Installation

  1. Clone repository:

    git clone https://github.com/yourusername/gist-manager.git
    cd gist-manager
  2. Install dependencies:

    yarn install:all

    This will install dependencies for both client and server workspaces.

  3. Configure environment: Create .env file with:

    GITHUB_CLIENT_ID=your_client_id
    GITHUB_CLIENT_SECRET=your_client_secret
    REDIRECT_URI=http://localhost:3000/callback
    FRONTEND_URL=http://localhost:3000
    SESSION_SECRET=your_secure_random_string
    NODE_ENV=development
    
    REACT_APP_GITHUB_CLIENT_ID=your_client_id
    REACT_APP_REDIRECT_URI=http://localhost:3000/callback
    REACT_APP_BACKEND_URL=http://localhost:3000

Running the Application

Development Mode

Start both client and server in development mode:

yarn dev

Production Build

Create optimized production build:

yarn build:prod

Serve production build:

yarn serve:prod

Individual Services

Start server only:

yarn start:server

Start client only:

yarn start:client

Testing

Run test suite:

yarn test

Cleanup

Remove all dependencies and build files:

yarn clean

Architecture

Authentication

  • OAuth 2.0 - GitHub authorization code flow
  • Session management - Secure HTTP-only cookies
  • Token caching - Per-user isolated cache with security boundaries
  • Automatic token refresh - Seamless user experience

API Endpoints

Authentication

  • GET /api/auth/github - Initiate OAuth flow
  • GET /api/auth/callback - Handle OAuth callback
  • POST /api/auth/logout - Clear session and cache

Gist Management

  • GET /api/gists - Fetch user's gists
  • GET /api/gists/:id - Get specific gist
  • POST /api/gists - Create new gist
  • PUT /api/gists/:id - Update existing gist
  • DELETE /api/gists/:id - Delete gist

Community Features

  • GET /api/shared-gists - Browse shared gists
  • POST /api/shared-gists - Share a gist
  • DELETE /api/shared-gists/:id - Unshare a gist

Project Structure

gist-manager/
├── client/                    # React frontend workspace
│   ├── public/               # Static assets
│   ├── src/
│   │   ├── components/       # React components
│   │   │   ├── common/      # Reusable UI components
│   │   │   ├── markdown/    # Markdown rendering
│   │   │   └── ...         # Feature components
│   │   ├── contexts/        # React contexts
│   │   │   ├── AuthContext.js
│   │   │   ├── ThemeContext.js
│   │   │   └── ToastContext.js
│   │   ├── services/        # API service layer
│   │   │   └── api/        # API endpoints
│   │   ├── styles/          # CSS and theme files
│   │   │   ├── index.css
│   │   │   ├── modern-theme.css
│   │   │   └── ...        # Component styles
│   │   └── utils/          # Utility functions
│   └── package.json
├── server/                   # Express backend workspace
│   ├── controllers/         # Request handlers
│   ├── routes/             # API route definitions
│   ├── server.js           # Main server file
│   └── package.json
├── data/                    # Persistent data storage
│   └── sharedGists.json    # Community gists database
└── package.json            # Root workspace configuration

Key Technologies

Frontend

  • React 18 - Modern React with hooks
  • React Router - Client-side routing
  • Tailwind CSS - Utility-first styling
  • CSS Variables - Dynamic theming
  • React Icons - Icon library
  • Prism.js - Syntax highlighting

Backend

  • Express.js - Web framework
  • express-session - Session management
  • node-cache - In-memory caching
  • axios - HTTP client
  • cors - Cross-origin support

Security Features

  • Per-user cache isolation - Prevents cross-user data leakage
  • Secure session management - HTTP-only cookies with proper SameSite settings
  • Token validation - Ensures tokens are valid before API calls
  • CORS configuration - Restricts API access to authorized origins
  • Environment variable protection - Sensitive data kept in .env files

Contributing

Contributions are welcome! Please ensure:

  • Code follows existing patterns and conventions
  • New features include appropriate documentation
  • Changes maintain backward compatibility
  • Security best practices are followed

License

GNU Affero General Public License v3.0

About

All-in-one personal docs and notes hub built arouind github gists.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •