README.md

April 2, 2026 · View on GitHub

English | 简体中文

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.

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.

columnNameTypeDescriptionRemarks
idstringPrimary Keygpress_config
base_pathstringBase PathDefault /
jwt_secretstringJWT SecretRandomly generated
jwt_token_keystringJWT KeyDefault jwttoken
server_portstringIP:PortDefault :660
timeoutintJWT Timeout SecondsDefault 7200
max_request_body_sizeintMax Request SizeDefault 20M
localestringLanguage PackDefault zh-CN,en-US
proxystringHTTP Proxy Address
create_timestringCreation Time2006-01-02 15:04:05
update_timestringUpdate Time2006-01-02 15:04:05
create_userstringCreatorInitialization system
sortnointSort OrderDescending
statusintStatusLink Access (0), Public (1), Top (2), Private (3)

User (Table Name: userinfo)

There is only one user in the backend.

columnNameTypeDescriptionRemarks
idstringPrimary Keygpress_admin
accountstringLogin NameDefault admin
passwordstringPassword-
user_namestringDescription-
create_timestringCreation Time2006-01-02 15:04:05
update_timestringUpdate Time2006-01-02 15:04:05
create_userstringCreatorInitialization system
sortnointSort OrderDescending
statusintStatusLink Access (0), Public (1), Top (2), Private (3)

Site Information (Table Name:site)

Site information, such as title, logo, keywords, description, etc.

columnNameTypeDescriptionRemarks
idstringPrimary Keygpress_site
titlestringSite Name-
keywordstringKeywords-
descriptionstringSite Description-
themestringDefault ThemeDefault uses default
theme_pcstringPC ThemeFirst get from cookie, if not, get from Header, write to cookie, default uses default
theme_wapstringMobile ThemeFirst get from cookie, if not, get from Header, write to cookie, default uses default
theme_wxstringWeChat ThemeFirst get from cookie, if not, get from Header, write to cookie, default uses default
logostringLogo-
faviconstringFavicon-
create_timestringCreation Time2006-01-02 15:04:05
update_timestringUpdate Time2006-01-02 15:04:05
create_userstringCreatorInitialization system
sortnointSort OrderDescending
statusintStatusLink Access (0), Public (1), Top (2), Private (3)
columnNameTypeDescriptionRemarks
idstringPrimary KeyURL path, separated by /, e.g., /web/
namestringNavigation Name-
href_urlstringRedirect Path-
href_targetstringRedirect Method_self,_blank,_parent,_top
pidstringParent Navigation IDParent Navigation ID
template_filestringTemplate FileCurrent navigation page template
child_template_filestringChild Theme Template FileDefault template for child pages, if not set, default uses this template
keywordstringNavigation KeywordsYes
descriptionstringNavigation DescriptionYes
create_timestringCreation Time2006-01-02 15:04:05
update_timestringUpdate Time2006-01-02 15:04:05
create_userstringCreatorInitialization system
sortnointSort OrderDescending
statusintStatusLink Access (0), Public (1), Top (2), Private (3)

Content (Table Name: content)

columnNameTypeDescriptionWhether to TokenizeRemarks
idstringPrimary KeyNoURL path, separated by /, e.g., /web/nginx-use-hsts
titlestringTitleYesUses jieba tokenizer
keywordstringContent KeywordsYesUses jieba tokenizer
descriptionstringContent DescriptionYesUses jieba tokenizer
href_urlstringSelf Page PathNo-
subtitlestringSubtitleYesUses jieba tokenizer
authorstringAuthorYesUses jieba tokenizer
tagstringTagsYesUses jieba tokenizer
tocstringTable of ContentsYesUses jieba tokenizer
summarystringSummaryYesUses jieba tokenizer
category_namestringNavigation MenuYesUses jieba tokenizer
category_idstringNavigation IDNo-
template_filestringTemplate FileNoTemplate
contentstringContentNo
markdownstringMarkdown ContentNo
thumbnailstringCover ImageNo
signaturestringPrivate Key Signature of ContentNo
sign_addressstringSignature AddressNo
sign_chainstringChain of AddressNo
tx_idstringOn-chain Transaction HashNo
content_typeintContent TypeNo0 markdown, 1 html
create_timestringCreation Time-2006-01-02 15:04:05
update_timestringUpdate Time-2006-01-02 15:04:05
create_userstringCreator-Initialization system
sortnointSort Order-Descending
statusintStatus-Link Access (0), Public (1), Top (2), Private (3)

Tag Function

Tag Function

  • The software copyright registration number of this gpress is 2025SR0120223
  • The software copyright of this gpress is owned by us, and secondary software copyright applications are prohibited. Infringement will be prosecuted
  • The copyright of programs developed by developers using gpress belongs to the developers
  • Please retain the copyright without any other restrictions. That is to say, you must include the original license agreement statement in your distribution, whether you distribute it in binary or source code form
  • The open-source version is released under the AGPL-3.0 open-source license and is provided for free use, but it is not allowed to release and sell modified and derivative code as closed-source commercial software!