GitHub - oodzchen/dizkaz: A simple lightweight web system for discussion.

2 min read Original article ↗

dizkaz

English | 中文

A lightweight web community system for online topic discussion.

Development Instructions

This project uses the fresh tool during development. It listens for file changes and automatically restarts the process. Please make sure to install this module globally before starting development.

Whether for local development or production environments, Docker Compose is primarily used to manage the various services. Therefore, please ensure Docker is installed on your machine before you begin development.

Password encryption in this project uses the bcrypt algorithm. The htpasswd command, which supports this algorithm, can be used to generate sample data. Please ensure the corresponding tool is installed on your machine. Typically, the apache2-utils package on Linux distributions provides this command.

Before starting the service, you need to set up custom environment variables. Please refer directly to .env.example and create a new file based on the examples inside, such as .env.local.dev. Remember: Do not commit local development environment variable files to the repository.

Once the above preparations are complete, first install the dependencies:

After completing these steps, run:

This will start the service.

You can also use the docker compose command directly to start the service. However, some configuration files need to be generated beforehand. For details, you can read the code inside dev.sh.

Testing

This project includes unit tests and end-to-end tests. Both types of tests require the service to be running before execution (because some tests need to read from or write to the database).

Run unit tests:

Run end-to-end tests:

Although CI is configured to run automated tests, it is still recommended to run the tests manually before each push to avoid pushing faulty code to the remote repository.

Seed Data

The ./seed module is specifically designed for batch generating mock data to facilitate testing. For specific usage instructions, please check the help message:

Internationalization (i18n) Configuration

This project is configured for i18n. All configuration files are stored in the ./i18n directory. The TOML files within are generated by the go-i18n tool; please do not modify their contents directly.

To add new translations, please directly modify the code in the Go files within the i18n directory. After making changes, run the relevant i18n commands and add the translations for various languages. For details, please refer to the go-i18n documentation.