用于 Gin & React 项目的模板. Template for Gin & React projects.
The Gin project template is a template for Gin & React projects. It comes with several built-in features such as user management, file management, GitHub authentication, WeChat official account authorization (requires wechat-server), email verification, password reset via email, request rate limiting, static file caching, mobile adaptation, token-based authentication, automatic packaging of executable files and Docker images using GitHub Actions, and Cloudflare Turnstile user verification. The template can be deployed using Docker and provides detailed instructions for manual deployment.
To install the Gin project template, follow these steps:
Execute the following command to deploy the template using Docker:
docker run --name gin-template -d --restart always -p 3000:3000 -v /home/ubuntu/data/gin-template:/data justsong/gin-template
This will save the data in the /home/ubuntu/data/gin-template
directory on the host machine.
For manual deployment, either download the executable file from GitHub Releases or compile the source code.
Run the template by accessing http://localhost:3000/
and logging in. The initial username is root
and the password is 123456
.
For detailed deployment instructions, refer to the link provided (URL removed).
Configuration of the system is ready out of the box. You can configure the system by setting environment variables or command line parameters after the system is started.
REDIS_CONN_STRING
: Set this to use Redis as the storage for request rate limiting instead of using in-memory storage. Example: REDIS_CONN_STRING=redis://default:redispw@localhost:49153
SESSION_SECRET
: Set this to use a fixed session secret, so logged-in user cookies remain valid after system restarts. Example: SESSION_SECRET=random_string
SQL_DSN
: Set this to use a specific database instead of SQLite. Example: SQL_DSN=root:123456@tcp(localhost:3306)/gin-template
Command line parameters:
--port <port_number>
: Specify the port number for the server to listen on. Default is 3000
. Example: --port 3000
--log-dir <log_dir>
: Specify the folder for log files. If not set, logs will not be saved. Example: --log-dir ./logs
--version
: Print the system version and exit.The Gin project template is a comprehensive template for Gin & React projects. It provides a wide range of built-in features including user and file management, authentication with GitHub and WeChat official accounts, as well as various customization options for deployment and configuration. The template can be easily deployed using Docker or manually by downloading the executable file or compiling the source code. With its extensive features and flexibility, the Gin project template offers a solid foundation for developing Gin & React projects.