A simple blog system using microservices architecture with go-micro v5.

The project consists of the following microservices:
- Users Service: User management (create, read, update, delete)
- Posts Service: Post management (create, read, delete, list, tag management)
- Comments Service: Comment management (create, read, delete, list)
- Web Service: REST API that uses all other services
This branch includes a minimalist static web interface for the blog, located in web/static/
:
index.html
: Main feed, create posts, view posts and commentslogin.html
: User login pagesignup.html
: User registration pageprofile.html
: User profile, posts, and comments
You do not need to run a separate static file server. When you run the web service (web/main.go
), it will serve both the REST API and the web interface (static files) on http://localhost:42096.
Just start the web service as shown below, then open http://localhost:42096 in your browser to use the app.
Authentication and profile features are available via the UI. The static UI interacts with the REST API provided by the web service.
The blog allows you to:
- Add tags to posts
- Remove tags from posts
- Filter the feed to show posts with a specific tag
- Browse all available tags
- Go 1.24 or higher
- Micro v5 (master branch)
To install Micro CLI:
go install github.com/micro/micro/v5@master
Make sure that $GOPATH/bin
(or $HOME/go/bin
) is in your PATH
so you can use the micro
command.
You have two options to run all services:
Option 1: Use Micro CLI
If you have Micro installed, you can run all services at once from the project root:
micro run --all
Option 2: Use the Makefile (no Micro required)
You can use the Makefile to run all services in parallel using plain Go:
make run-all
Or run individual services:
make run-users
make run-posts
make run-comments
make run-web
The REST API and web interface will be available at http://localhost:42096
This project includes comprehensive documentation built with MkDocs. To view the documentation:
- Install the required dependencies:
pip install -r requirements.txt
- Run the MkDocs development server:
mkdocs serve
- Open http://localhost:8000 in your browser to view the documentation.
To build the documentation site:
mkdocs build
The built documentation will be in the site/
directory.
GET /posts
: List all postsGET /posts/:id
: Get a post by IDPOST /posts
: Create a new post{ "title": "Post title", "content": "Post content" }
GET /comments
: List all comments (optionally filter bypost_id
query param)POST /comments
: Add a comment{ "content": "Comment content", "post_id": "post_id" }
GET /users
: List all usersGET /users/:id
: Get a user by IDPOST /users
: Create a new user{ "name": "User Name", "email": "email@example.com" }
POST /signup
: Register a new user (and log in){ "name": "User Name", "email": "email@example.com", "password": "plaintextpassword" }
POST /login
: Log in as a user{ "email": "email@example.com", "password": "plaintextpassword" }
POST /logout
: Log out the current userGET /users/me
: Get the current session user info
POST /posts/:id/tags
: Add a tag to a post{ "tag": "tagname" }
DELETE /posts/:id/tags/:tag
: Remove a tag from a postGET /tags
: Get all available tagsGET /tags?post_id=:id
: Get tags for a specific postGET /posts/by-tag/:tag
: Get posts with a specific tag
blog/
├── comments/ # Comments service
│ ├── handler/ # Request handlers
│ ├── main.go # Entry point
│ └── proto/ # Protobuf definitions
├── posts/ # Posts service
│ ├── handler/
│ ├── main.go
│ └── proto/
├── users/ # Users service
│ ├── handler/
│ ├── main.go
│ └── proto/
└── web/ # REST API and static web UI
├── main.go # REST API server
└── static/ # Static web UI (index.html, login.html, signup.html, profile.html)