This version of the core function has been improved, but also some of the suggestions and bugs have been fixed; We sincerely invite you to pay attention to the development of GoFrame project and contribute to the ecological development.
Update features:
- The article reply function is perfect: add a point to like, step on, delete, reply, adopt;
- Edit information to join my message module: this version is mainly added to the reply message unified display;
- Added a simple admin function to clean up spam posts and spam replies;
- Join Docker Compose one-click deployment, greatly convenient deployment in Linux environment;
- Some suggestions from netizens and the previous version of the bug has been repaired;
Zero, about Focus
Focus Focus community is a GoFrame community project, which uses simple and powerful GoFrame as the back-end WEB framework. As the front-end system needs SEO, GF template engine is used, the database uses MySQL, and the front-end uses jQuery/ Bootstrap framework.
First, the source address
github
:github.com/gogf/focusgitee
:gitee.com/johng/focus
Ii. Demo address
Focus.goframe.org/
Three, installation and deployment
The installation
1, download the source code of the project: git clone https://github.com/gogf/focus
Create focus database
CREATE DATABASE `focus` CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin';
Copy the code
3. Run focus. SQL under Document to initialize database SQL.
4. Copy the config.example.toml configuration file from config to config.toml.
[database] link = "mysql:root:123456@tcp(127.0.0.1:3306)/focus" debug = trueCopy the code
5, Run: go run main.go
6. Visit http://127.0.0.1:8199 to see the login page. The default account/password is goframe / 123456
A key deployment
One-click deployment only supports Linux, and docker-compose installation is required.
git clone https://github.com/gogf/focus && \\
cd focus && chmod 755 focus.sh && ./focus.sh build
Copy the code
For more commands, run./focus help
Traditional deployment
1, install GF-CLI tool chain, see: development tools
2, package command: execute GF build, for detailed configuration, please refer to build cross-compilation
3, packaging results: The default Linux/MacOS/Windows three versions.
Trash ├── trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trash ├─ trashCopy the code
4. Place config.toml and focus in the same directory and start Focus.
Release notes:
In the default configuration file configuration, the public and template directories are binary packaged and shipped with the executable. Therefore, you only need to copy config.toml and focus to the target server when publishing. Alternatively, you can consider distributing specific configuration files as packages, so that only the Focus executable needs to be published.
If you want to package the configuration file into the executable, you can also refer to the modification method for reading the default configuration file: Config Management # Default File Modification
Iv. Project structure
├ ─ ─ app │ ├ ─ ─ dao │ ├ ─ ─ model │ ├ ─ ─ Shared │ └ ─ ─ system │ ├ ─ ─ the admin │ │ └ ─ ─ internal │ └ ─ ─ index │ └ ─ ─ internal │ ├ ─ ─ API │ ├─ define │ ├─ Service │ ├─ Config │ ├─ Document │ ├─ Library │ ├─ Public │ Template │ ├─ upload │ ├─ ├─ go. ├─ main.goCopy the code
5. Description of contents
Directory/file name | instructions | describe |
---|---|---|
app |
Business logic layer | Directories where all business logic is stored. |
– dao |
The data access | Database access operations, including only the most basic database CURD method. |
– model |
The data model | Holds data related entity structure definitions. |
– system |
System module | It may contain multiple subsystems, with resources isolated from each other. |
– index |
The front page | Subsystem, front-end page. |
– internal |
Internal module | Internal system modules that are only available for current internal system calls and cannot be shared between systems. |
– api |
Business interface | An entry/interface layer within the system that receives/parses user input parameters |
– define |
Structure definition | System internal input and output data structure definition. |
– service |
Logic encapsulated | Encapsulate the internal business logic of the system to achieve specific business requirements. |
config |
Configuration management | Directory for storing all configuration files. |
docker |
Image file | Docker image dependency files, script files and so on. |
document |
Project documentation | Documentation project Documentation, such as design Documentation, help Documentation, etc. |
library |
The public library package | Common functionality packages often do not include business requirement implementations. |
packed |
Package directory | Package the resource fileGo The files are stored here,boot Automatically called when the package is initialized. |
public |
Static directory | Only files in this directory can be accessed by static services. |
template |
Template file | Directory where MVC template files are stored. |
Dockerfile |
Image description | The cloud native era is used to compile and generate Docker image description file. |
go.mod |
Dependency management | useGo Module Dependency description file for package management. |
main.go |
Entrance to the file | Program entry file. |
Six, frame design
Because of the powerful and easy-to-use GoFrame development framework, you can refer to some of the framework design introduction.
- Code layering
- Object encapsulation design
- Context: Business processes share variables
- Single-application multi-system design
- More: Frame design
Vii. Project screenshots
Figure 1. Community Home page
Figure 2. Login page
Figure 3. Registration page
Figure 4. Publish/edit page
Figure 5. Content details
Figure 6. Search page
Figure 7. Personal homepage
Figure 8. Edit data
Eight, database table design
Ix. Progress of functional modules
Focus document
For more information, please go to: Focus community Documentation