A modern collaboration or social interaction module is incomplete without a rich comment system. Applications such as Slack, GitHub, Facebook, Jira, and internal enterprise tools allow users to mention other users using the @username format and categorize or highlight topics using #hashtags.
This article explains how to build a complete mentions and hashtags–enabled comment system using Angular (frontend) and ASP.NET Core (backend) with a scalable database design in SQL Server.
The objective is to design a reusable, production-ready module suitable for enterprise web applications.
1. Key Functional Requirements
Users can type comments.
Auto-suggestions appear when typing
@for users.Auto-suggestions appear when typing
#for tags.Comments should highlight mentions and hashtags.
Backend must store extracted mentions and tags.
Display comments with clickable mentions and hashtags.
Should support comment editing and deletion.
2. High-Level Workflow
User types comment →
Detect @mention or #tag →
Show suggestion list →
User selects item →
Submit comment →
Backend processes comment →
Save comment, mentions, tags →
Return formatted comment →
Display in UI
Flowchart (Comment Entry + Processing)
+----------------------+
| User types comment |
+---------+------------+
|
v
+--------------------------+
| Detect @ or # character |
+------------+-------------+
|
+----------+-----------+
| |
v v
+-----------------+ +-----------------+
| Load user list | | Load tag list |
+--------+--------+ +--------+--------+
| |
v v
+-----------------+ +-----------------+
| User selects | | User selects |
| mention | | tag |
+--------+--------+ +--------+--------+
| |
+-----------+-----------+
|
v
+------------------------+
| Submit final comment |
+-----------+------------+
|
v
+--------------------------+
| Backend extracts tokens |
+-----------+--------------+
|
v
+--------------------------+
| Save in database |
+-----------+--------------+
|
v
+--------------------------+
| Return formatted comment |
+--------------------------+
3. ER Diagram (SQL Server)
+------------------------+
| Users |
+------------------------+
| UserId (PK) |
| DisplayName |
| Email |
+------------------------+
+------------------------+
| Comments |
+------------------------+
| CommentId (PK) |
| UserId (FK) |
| Content |
| CreatedOn |
+------------------------+
+---------------------------+
| CommentMentions |
+---------------------------+
| Id (PK) |
| CommentId (FK) |
| MentionedUserId (FK) |
+---------------------------+
+---------------------------+
| Tags |
+---------------------------+
| TagId (PK) |
| TagName |
+---------------------------+
+---------------------------+
| CommentTags |
+---------------------------+
| Id (PK) |
| CommentId (FK) |
| TagId (FK) |
+---------------------------+
4. Architecture Diagram (Visio Style)
+------------------------------+
| Angular App |
+------------------------------+
| Type Comment
v
+--------------------------+
| Comment Component |
+------------+-------------+
|
| API Calls
v
+-------------------------------+
| ASP.NET Core API (Web API) |
+-------------------------------+
| Validate | Parse | Save Data |
|
v
+-------------------------------+
| SQL Server (Comments, Tags) |
+-------------------------------+

Join the conversation! Your thoughts help the community grow.