Skip to content

forgeturl/forgeturl-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

93 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”– ForgetURL Server

Minimalist Bookmark Management Service - Make Link Collection Simple

Deploy Status Release License Go Version Stars

Features β€’ Quick Start β€’ API Docs β€’ Deployment

πŸ‡¨πŸ‡³ δΈ­ζ–‡ζ–‡ζ‘£


πŸ“– Introduction

ForgetURL is a modern bookmark management platform that helps users easily save, organize, and share web links. With a clean, elegant interface and powerful backend service, link collection becomes effortless.

Why ForgetURL?

  • 🎯 Minimalist Design - Focus on core features, no bloat
  • πŸ” Secure & Reliable - Support multiple OAuth providers
  • πŸ”— Flexible Sharing - Multi-level permission control for different sharing scenarios
  • πŸ“¦ Seamless Migration - Import/export bookmarks for easy data migration

✨ Features

πŸ” User Authentication

  • Support Google, GitHub and other OAuth providers
  • Secure token-based authentication
  • User profile management

πŸ“„ Page Management

  • Create Pages - Quickly create bookmark collection pages
  • Edit Pages - Real-time editing of title, description, and link collections
  • Delete Pages - Safely remove unwanted pages
  • Sort Pages - Customize page order

πŸ“ Link Organization

  • Link Collections - Group related links together
  • Tagging System - Add tags to links for easy filtering
  • Sub-links - Attach related sub-links to main links

πŸ”— Permission Sharing

Link Type Prefix Permission
Read-only R View only, no editing
Editable E View and edit content
Admin A Full control permissions

πŸ“₯ Import/Export

  • Import bookmarks from browsers
  • Export to universal formats

πŸ›  Tech Stack

Category Technology
Language Go 1.23
Web Framework Gin
ORM GORM + Gen
Database MySQL
Cache Redis
API Spec Protocol Buffers / gRPC
Container Docker
Auth Goth (OAuth)

πŸ“ Project Structure

forgeturl-server/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ api/                    # API Layer
β”‚   β”‚   β”œβ”€β”€ proto/              # Protobuf definitions
β”‚   β”‚   β”‚   β”œβ”€β”€ space.proto     # Space management API
β”‚   β”‚   β”‚   β”œβ”€β”€ login.proto     # Authentication API
β”‚   β”‚   β”‚   └── dumplinks.proto # Import/Export API
β”‚   β”‚   β”œβ”€β”€ space/              # Generated space service code
β”‚   β”‚   β”œβ”€β”€ login/              # Generated login service code
β”‚   β”‚   └── docs/               # Swagger documentation
β”‚   β”œβ”€β”€ cmd/                    # CLI entry points
β”‚   β”œβ”€β”€ conf/                   # Configuration files
β”‚   β”œβ”€β”€ dal/                    # Data Access Layer
β”‚   β”‚   β”œβ”€β”€ model/              # Data models
β”‚   β”‚   └── query/              # GORM Gen queries
β”‚   β”œβ”€β”€ pkg/                    # Shared packages
β”‚   β”‚   β”œβ”€β”€ connector-google/   # Google OAuth connector
β”‚   β”‚   β”œβ”€β”€ core/               # Core utilities
β”‚   β”‚   β”œβ”€β”€ lcache/             # Local cache
β”‚   β”‚   β”œβ”€β”€ maths/              # Math utilities (ID generation)
β”‚   β”‚   └── middleware/         # Middlewares
β”‚   β”œβ”€β”€ route/                  # Router configuration
β”‚   β”œβ”€β”€ main.go                 # Main entry point
β”‚   └── go.mod                  # Go module definition
β”œβ”€β”€ tests/                      # Test files
β”œβ”€β”€ Dockerfile                  # Docker build file
└── README.md

πŸš€ Quick Start

Prerequisites

  • Go 1.23+
  • MySQL 5.7+
  • Redis 6.0+

Local Development

# 1. Clone the repository
git clone https://github.com/your-username/forgeturl.git
cd forgeturl/forgeturl-server

# 2. Install dependencies
cd app
go mod download

# 3. Configure environment
cp conf/local.toml.example conf/local.toml
# Edit conf/local.toml to configure database and Redis connection

# 4. Start the server
go run main.go api start

Server runs at http://127.0.0.1:80 by default.

Docker Deployment

# Build image
docker build -t forgeturl-server .

# Run container
docker run -d -p 80:80 forgeturl-server

πŸ“š API Documentation

Authentication

All endpoints requiring authentication need the Token in request header:

X-Token: your_access_token

Core Endpoints

Space Management

Endpoint Method Description Auth Required
/space/getUserInfo POST Get user info Optional
/space/getMySpace POST Get my space βœ…
/space/getPage POST Get page details Optional
/space/createPage POST Create page βœ…
/space/updatePage POST Update page βœ…
/space/deletePage POST Delete page βœ…
/space/savePageIds POST Save page order βœ…
/space/addPageLink POST Generate share link βœ…
/space/removePageLink POST Remove share link βœ…

Authentication

Endpoint Method Description
/auth/{provider} GET OAuth authorization redirect
/callback/{provider} GET OAuth callback handler
/login/logout POST Logout

Import/Export

Endpoint Method Description
/dumplinks/importBookmarks POST Import bookmarks
/dumplinks/exportBookmarks POST Export bookmarks

Request Examples

Get User Info
curl 'http://127.0.0.1:80/space/getUserInfo' \
  -d '{"uid": 1}' \
  -H 'Content-Type: application/json'
Get My Space
curl 'http://127.0.0.1:80/space/getMySpace' \
  -d '{}' \
  -H 'Content-Type: application/json' \
  -H 'X-Token: your_token'
Create Page
curl 'http://127.0.0.1:80/space/createPage' \
  -d '{
    "title": "My Bookmarks",
    "brief": "Frequently used links",
    "collections": [
      {
        "title": "Dev Tools",
        "links": [
          {
            "title": "GitHub",
            "url": "https://github.com",
            "tags": ["code", "opensource"]
          }
        ]
      }
    ]
  }' \
  -H 'Content-Type: application/json' \
  -H 'X-Token: your_token'
Update Page
curl 'http://127.0.0.1:80/space/updatePage' \
  -d '{
    "page_id": "O3sFmpq",
    "title": "Updated Title",
    "brief": "Updated description",
    "collections": [...],
    "version": 0,
    "mask": 7
  }' \
  -H 'Content-Type: application/json' \
  -H 'X-Token: your_token'

Update Mask Values:

  • 0x01 (1): Update title
  • 0x02 (2): Update description
  • 0x04 (4): Update collections
  • 0x07 (7): Update all fields
Generate Share Link
curl 'http://127.0.0.1:80/space/addPageLink' \
  -d '{
    "page_id": "O3sFmpq",
    "page_type": "readonly"
  }' \
  -H 'Content-Type: application/json' \
  -H 'X-Token: your_token'

page_type Options:

  • readonly - Read-only link
  • edit - Editable link
  • admin - Admin link

🌐 Environment Configuration

The project supports three environments:

Environment Config File API Address
Local local.toml http://127.0.0.1:80
Test test.toml https://test-api.brightguo.com
Production onl.toml https://api.brightguo.com

πŸ”§ Development Guide

Code Generation

# Generate API code (from proto files)
./genapi.sh

# Generate GORM models and queries
cd dal && ./gensql.sh

Running Tests

cd tests
pip install -r requirements.txt
python run_tests.py

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

🀝 Contributing

Issues and Pull Requests are welcome!


Made with ❀️ by ForgetURL Team

About

Minimalist bookmark management API service built with Go + Gin + GORM + Protobuf

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors