SkillAgentSearch skills...

Gpress

Web3 content platform, Hertz + Go template + FTS5 full-text search, supports Ethereum and XuperChain, compatible with Hugo ecosystem, uses Wasm extension plugins, requires only 200M memory

Install / Use

/learn @springrain/Gpress
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<img src="gpressdatadir/public/gpress-logo.png" height="150px" />

<a href="./README.md">English</a> | <a href="./README.zh-CN.md">简体中文</a>

Introduction

Web3 content platform, Hertz + Go template + FTS5 full-text search, supports Ethereum,Solana and Baidu XuperChain, compatible with Hugo and WordPress ecosystems, uses Wasm extension plugins, and requires only 200M memory.

As a static site: The static files generated by gpress are consistent with Hugo, and gpress can also be simply considered as the backend management of Hugo, compatible with Hugo theme ecosystems. Multiple Hugo themes have been migrated: even, doks, book, geekdoc...
As a dynamic site: gpress is simple in functionality, with only 7 menus, 5 tables, and 5000 lines of code. It uses SQLite, starts with one click, and requires only 200M memory, supporting full-text search. It is compatible with WordPress theme ecosystems, and multiple WordPress themes have been migrated: generatepress, astra...
As Web3: gpress already supports Ethereum,Solana and Baidu XuperChain account systems and will continue to iterate decentralized features based on Wasm, allowing data to be a bit freer...
As a newcomer: Compared to excellent content platforms like Hugo and WordPress, gpress still has many shortcomings, being simple and immature in functionality...
Documentation: Click to view the documentation

The personal blog jiagou.com is built using gpress, with dynamic search and backend management, while the rest are static pages.
<img src="gpressdatadir/public/index.png" width="600px">

Development Environment

gpress uses https://github.com/wangfenjin/simple as the FTS5 full-text search extension. The compiled libsimple file is placed in the gpressdatadir/fts5 directory. If gpress fails to start and reports an error connecting to the database, please check if the libsimple file is correct. If you need to recompile libsimple, please refer to https://github.com/wangfenjin/simple.

The default port is 660, and the backend management address is http://127.0.0.1:660/admin/login.
First, unzip gpressdatadir/dict.zip.
Run go run --tags "fts5" ..
Package: go build --tags "fts5" -ldflags "-w -s".

The development environment requires CGO compilation configuration. Set set CGO_ENABLED=1, download mingw64 and cmake, and configure the bin to the environment variables. Note to rename mingw64/bin/mingw32-make.exe to make.exe.
Modify vscode's launch.json to add ,"buildFlags": "--tags=fts5" for debugging fts5.
Test needs to be done manually: go test -v -timeout 30s --tags "fts5" -run ^TestReadmks$ gitee.com/gpress/gpress.
Package: go build --tags "fts5" -ldflags "-w -s".
When recompiling simple, it is recommended to use the precompiled version from https://github.com/wangfenjin/simple.
Note to modify the Windows compilation script, remove the libgcc_s_seh-1.dll and libstdc++-6.dll dependencies for mingw64 compilation, and turn off BUILD_TEST_EXAMPLE as there are conflicts.

rmdir /q /s build
mkdir build && cd build
cmake .. -G "Unix Makefiles" -DBUILD_TEST_EXAMPLE=OFF -DCMAKE_INSTALL_PREFIX=release -DCMAKE_CXX_FLAGS="-static-libgcc -static-libstdc++" -DCMAKE_EXE_LINKER_FLAGS="-Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic"
make && make install

PostgreSQL

gpress uses SQLite as its default database. Starting from version v1.1.9, it supports PostgreSQL, the full-text search pg_search plugin must be installed,. The database configuration is specified in the gpressdatadir/db.json file. For specific configuration details, please refer to the zorm configuration. For example:

{
    "DSN":"postgresql://username:password@host:port/database?sslmode=disable&TimeZone=Asia/Shanghai",
    "DriverName":"postgres",
    "Dialect":"postgresql",
    "SlowSQLMillis":0,
    "MaxOpenConns":50,
    "MaxIdleConns":50,
    "ConnMaxLifetimeSecond":600
}

Staticization

The backend Refresh Site function will generate static HTML files to the statichtml directory, along with gzip_static files. You need to copy the css, js, image of the currently used theme and the gpressdatadir/public directory to the statichtml directory, or use Nginx reverse proxy to specify the directory without copying files.
Nginx configuration example:

### CSS files of the current theme (default)
location ~ ^/css/ {
    #gzip_static on;
    root /data/gpress/gpressdatadir/template/theme/default;  
}
### JS files of the current theme (default)
location ~ ^/js/ {
    #gzip_static on;
    root /data/gpress/gpressdatadir/template/theme/default;  
}
### Image files of the current theme (default)
location ~ ^/image/ {
    root /data/gpress/gpressdatadir/template/theme/default;  
}
### search-data.json FlexSearch JSON data
location ~ ^/public/search-data.json {
    #gzip_static on;
    root /data/gpress/gpressdatadir;  
}
### Public files
location ~ ^/public/ {
    root /data/gpress/gpressdatadir;  
}

### Markdown files, requests ending with .md. Static Markdown files are by default placed in the _markdown folder under the theme.
location ~* \.md$ {
    #gzip_static on;
    
    # text/plain is more general, text/markdown is not well supported
    default_type text/plain;
    #default_type text/markdown;

    charset utf-8;

    root   /data/gpress/gpressdatadir/statichtml/default/_markdown;
}

    
### Admin backend management, request dynamic service
location ~ ^/admin/ {
    proxy_redirect     off;
    proxy_set_header   Host      $host;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_pass  http://127.0.0.1:660;  
}
### Static HTML directory
location / {
    proxy_redirect     off;
    proxy_set_header   Host      $host;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Proto $scheme; 
    ## If there is a q query parameter, use the dynamic service. Also supports FlexSearch parsing public/search-data.json
    if ($arg_q) { 
       proxy_pass  http://127.0.0.1:660;  
       break;
    }

    ### Enable gzip static compression
    #gzip_static on;

    ### Nginx 1.26+ does not need to 302 redirect to the index.html under the directory, gzip_static will also take effect. This configuration is kept for record.
    ##if ( -d $request_filename ) {
        ## Not ending with /
    ##    rewrite [^\/]$ $uri/index.html redirect;
        ## Ending with /
    ##    rewrite ^(.*) ${uri}index.html redirect;      
    ##}
    
    ### Static file directory of the current theme (default)
    root   /data/gpress/gpressdatadir/statichtml/default;
    
    ### if directive may conflict with try_files directive, causing try_files to be invalid
    ## Avoid directory 301 redirect, e.g., /about will 301 to /about/           
    try_files $uri $uri/index.html;
    
    index  index.html index.htm;
}

Backend Management Supports English

The gpress backend management currently supports both Chinese and English, with the capability to extend to other languages. Language files are located in gpressdatadir/locales. By default, the system uses Chinese (zh-CN) upon initial installation. If English is preferred, you can modify the "locale":"zh-CN" to "locale":"en-US" in the gpressdatadir/install_config.json file before installation. Alternatively, after successful installation, you can change the Language setting to English in the Settings and restart the system to apply the changes.

Table Structure

ID defaults to timestamp (23 digits) + random number (9 digits), globally unique.
Table creation statement gpressdatadir/gpress.sql

Configuration (Table Name: config)

Reads gpressdatadir/install_config.json during installation.

| columnName | Type | Description | Remarks | | ----------- | ----------- | ----------- | ----------- | | id | string | Primary Key |gpress_config | | base_path | string | Base Path | Default / | | jwt_secret | string | JWT Secret | Randomly generated | | jwt_token_key | string | JWT Key | Default jwttoken | | server_port | string | IP:Port | Default :660 | | timeout | int | JWT Timeout Seconds| Default 7200 | | max_request_body_size | int | Max Request Size | Default 20M | | locale | string | Language Pack | Default zh-CN,en-US | | proxy | string | HTTP Proxy Address | | | create_time | string | Creation Time | 2006-01-02 15:04:05 | | update_time | string | Update Time | 2006-01-02 15:04:05 | | create_user | string | Creator | Initialization system | | sortno | int | Sort Order | Descending | | status | int | Status | Link Access (0), Public (1), Top (2), Private (3) |

User (Table Name: userinfo)

There is only one user in the backend.

| columnName | Type | Description | Remarks | | ----------- | ----------- | ----------- | ----------- | | id | string | Primary Key | gpress_admin | | account | string | Login Name | De

View on GitHub
GitHub Stars16
CategoryCustomer
Updated8d ago
Forks5

Languages

Go

Security Score

95/100

Audited on Apr 2, 2026

No findings