A personal blog built with Go (backend) & React (frontend).
Follow these steps to set up the project for development or production.
-
Install PostgreSQL
-
Create a Database
-
Run Migrations
Install migrate and apply migrations:migrate -path=./migrations -database="postgres://bloguser:yourpassword@localhost:5432/blogdb?sslmode=disable" up
To roll back migrations:
migrate -path=./migrations -database="postgres://bloguser:yourpassword@localhost:5432/blogdb?sslmode=disable" down
Make sure redis is already installed and setuped as we're using redis for cacheing.
You can run the blog with Docker or manually.
- Prepare Environment Variables:
- Copy
env.example
to.env
inside theweb
directory and configure as needed:cp web/env.example web/.env # Edit web/.env to match your environment
- Copy
- Build and Start:
make build-docker
- Rebuild (if needed):
make re-build-docker
- Stop:
make down-docker
- Ensure
.blog.yaml
is in your working directory and mounted into the container. - Access the blog at http://localhost:8080.
- Login to access the dashboard at http://localhost:8080/login.
- Install Node.js and npm.
- In the
web
directory:cd web npm install cp env.example .env # Edit .env as needed
- Start development server:
npm run dev
- Build for production:
npm run build
- Access the frontend at http://localhost:3001.
- Login requires a user created via the backend CLI.
- Login to access the dashboard at http://localhost:3001/login.
- Install Go 1.24+ and ensure it is in your PATH.
- Copy and edit config:
cp example.blog.yaml .blog.yaml
- Build:
make build
- Run:
./blog --conf .blog.yaml
- Build CLI tool:
make build-cli
- Manage users:
./blog_cli --help ./blog_cli --name 'Your Name' --email [email protected] --pass "Pass" ./blog_cli --email [email protected] --pass "newPass"
- If no password is provided, a secure password is generated.
View available commands:
make help
- If you change
BINARY_NAME
orCLI_BINARY_NAME
in the Makefile, update the binary names accordingly.
- PostgreSQL and migrations must be set up before running the backend or Docker container.
- The frontend only supports login; registration must be done via the CLI.
Contributions are welcome. Open issues or submit pull requests.
MIT License.