Note: when the number of users exceeds 10,000 and messages exceed 1,000,000, a plain PHP script stops coping. The database crumbles under N+1 queries: page generation time for thread listing surpasses 5 seconds. Forum search takes 30 seconds, and moderators spend hours manually handling reports. We've seen this and design scalable forums from scratch—from database architecture to deployment on dedicated servers. Our expertise: 10+ years in highload forum projects, including 3 major forums with over 50,000 users each. Our company has been on the market for 5+ years, and every project ships with documentation and training. Our custom forum solutions start at $15,000 for MVP and $50,000 for full-featured platforms.
A forum is a platform for asynchronous topic discussions. Unlike chat (real-time) or social media (post feed), a forum organizes discussions hierarchically: category → topic → replies. Users value forums for the ability to find a specific thread years later via search, so the forum engine must ensure fast full-text search and long-term data storage.
Proper forum architecture and database design are critical for performance. On forums with millions of records, server response time (TTFB) must stay below 200 ms; otherwise, users leave. We achieve this with Redis caching, materialized paths, and replication.
Forum Architecture and Database Design
Forum Structure
Forum
├── Category "General Questions"
│ ├── Topic "How to configure nginx?" (15 replies)
│ └── Topic "Best CI/CD practices" (8 replies)
├── Category "Announcements" (read-only for guests)
└── Category "Off-topic"
Nested subcategories are optional and depend on scale.
Which Database Architecture for Threaded Comments?
Two approaches to displaying replies:
- Flat (Reddit-style): all replies at the same level, sorted by date or score. Simple to implement.
- Threaded: replies to a specific comment appear as children. Useful for long discussions.
Storing threaded comments is done via Closure Table or Adjacency List. Comparison:
| Method |
Queries |
Insert |
Delete |
Scalability |
| Adjacency List |
Recursive CTE (depth) |
Fast |
Fast |
Medium |
| Closure Table |
Single JOIN |
Slow |
Slow |
High |
| Nested Sets |
Two queries |
Slow |
Slow |
High |
| Materialized Path |
LIKE, regex |
Fast |
Fast |
High |
For deep nesting (more than 5 levels), Closure Table or Materialized Path (path: 1.5.12.44) is best. Adjacency List with recursive SQL works fast up to 100k rows, but on millions of records it degrades 10x. In our tests on 5 million records, Closure Table is 15 times better than Adjacency List—loading the tree took 80 ms vs 1200 ms.
-- Closure Table example
CREATE TABLE post_paths (
ancestor_id INT NOT NULL,
descendant_id INT NOT NULL,
depth INT NOT NULL,
PRIMARY KEY (ancestor_id, descendant_id)
);
Forum Scaling
On forums with millions of posts, Adjacency List requires recursive CTEs that take 10x longer than a single JOIN on a Closure Table. Therefore, for highload forum scaling we choose Closure Table.
Core Forum Features
Access Rights
Classic forum roles: Guest (read), Member (write), Moderator (edit/delete), Admin. Additionally, section-bound roles: moderator of section X cannot moderate section Y. Special groups: Trusted users (no captcha), Banned (read-only or full ban).
Forum Moderation
- Reports: "Report" button → queue for moderators.
- Flood protection: post limit per N minutes per user.
- Spam filtering: Akismet for links + honeypot fields in forms.
- Soft delete: post is not physically deleted, marked as deleted. Moderators see original text.
- Edit history: all post changes are saved.
User Reputation
- Likes/dislikes: affect reply sorting and author reputation.
- Marked solution: in Q&A mode, topic author marks the best answer (green check).
- Badges: achievements for activity (first post, 100 replies, 10 "solutions").
Subscriptions and Notifications
- Subscribe to topic: email on every new reply or digest.
- Subscribe to category: notification about new topics.
- @mention: notification when mentioned in a post.
Forum Search
Full-text search across titles and message bodies. For forums with large historical volume (10+ years), Elasticsearch with Cyrillic morphology. For new projects, PostgreSQL FTS is enough up to a few million records. Comparison:
| Criteria |
PostgreSQL FTS |
Elasticsearch |
| Writes/sec |
~500 |
~5000 |
| Searches/sec |
~1000 |
~8000 |
| Cyrillic morphology |
Basic |
Advanced |
| Integration |
Built-in |
Separate server |
Full-text search in PostgreSQL handles without external dependencies for volumes up to a few million records. Elasticsearch is 8x faster on large volumes but requires a dedicated server.
Additional search details
To optimize forum search, we use GIN indexes in PostgreSQL and configure analyzers in Elasticsearch. This achieves response times under 100 ms even on millions of records.
Development Process and Deliverables
Beyond code, we deliver:
- Documentation on DB architecture and API.
- Server access (or Docker images).
- Moderator training for the admin panel.
- 30-day free support after deployment.
How We Do It: Process and Timeline
- Analysis—gather requirements, determine load and features.
- Design—choose stack (Laravel + PostgreSQL, Go + MongoDB, React + Next.js), draw ER diagram.
- Development—write code, cover with unit tests, integrate Elasticsearch.
- Testing—load testing (k6, 10,000 concurrent users) and security audit.
- Deployment—set up Nginx, Docker, backups, monitoring (Prometheus + Grafana).
MVP (categories, topics, replies, rights, basic moderation): 6–8 weeks. Full-featured forum (threaded comments, reputation, search, mobile version): 3–4 months.
Common Pitfalls
- Ignoring N+1 queries—performance drops when loading topic lists.
- Choosing Adjacency List for millions of comments—slow recursive queries.
- Lack of caching—frequent DB hits on every page view.
- Weak spam protection—forum gets overrun by bots within a week.
Get a consultation on your forum architecture—we'll help choose the right stack for your load. Order custom forum development: contact us to evaluate architecture and timeline.
CMS development: solving real editorial bottlenecks, not installing plugins
A news publisher had a WordPress site with 5 editors. Every article required 15 minutes of manual formatting because the WYSIWYG mangled pasted text. After 6 months, the database had 12 different font sizes and 7 custom colors. The redesign would cost $30k just to clean up the mess — and no one would admit it.
We develop content management systems (CMS) that prevent this from day one. Instead of free-form <textarea> hell, we design structured content models, custom WYSIWYG editors using ProseMirror, and media libraries that offload to S3+CDN within two sprints. This is CMS development without shortcuts.
When is headless CMS justified and when not?
Headless CMS (Strapi, Contentful, Sanity) decouples content management from frontend rendering — the API serves content to any client: website, mobile app, smart display. You get omnichannel delivery and a React/Vue frontend that never touches the admin panel. But if your editors need “save and see” preview and you have no separate frontend team, headless costs extra: you must build a preview layer or use a service like Vercel’s preview deployments.
Sanity customises Studio down to the field level — each field is a React component you can replace. Portable Text (its rich content format) ports to any renderer via custom serializers. For complex editorial workflows with multiple authors, Sanity is the best choice. Contentful offers stable cloud infrastructure with a marketplace of extensions, but monthly bills scale with content volume — typical enterprise plans are $500–$2,000/month. Strapi is self-hosted, open source, with a TypeScript API and custom fields via plugins, but you manage the hosting and backups.
Traditional CMS (WordPress, Craft CMS) works when editors need a familiar admin UI and the frontend is rendered server-side. Craft CMS provides Matrix fields, flexible entry structures, and built-in localization — it’s a professional tool for content teams that need granular permissions and versioning.
How do we build a WYSIWYG editor that doesn’t break layout?
The editor is the most complex component — not a <textarea>. The sweet spot is Tiptap, built on ProseMirror. Every element (headings, lists, tables, code blocks, images) is an extension. Collaborative editing via Yjs works out of the box. Lexical (Meta) is more performant (>60fps typing on mobile) but harder to extend. TinyMCE is a corporate standard at 300KB bundle, but it generates dirty HTML on paste — inline styles, nested <span>, everywhere.
The root cause: pasting from Word. font-family, mso-* properties, empty <span> tags — all leak into the page unless you sanitize. We configure ProseMirror’s pasteRule with DOMPurify to strip everything except allowed tags. Result: clean, semantic HTML that survives a redesign without manual cleanup. Editors save 2–4 hours per week per person.
Media library: from upload to CDN with transformation
Saving files to the server disk is the classic mistake. The disk fills, scaling fails, and CDN becomes impossible. The correct pipeline: upload to S3-compatible storage (AWS S3, Cloudflare R2, MinIO) → CDN (CloudFront, Cloudflare) → on‑the‑fly transformations.
Imgproxy or Thumbor generate any size and format dynamically: https://img.example.com/resize:800:600/format:webp/plain/s3://bucket/photo.jpg. The original lives once, derivatives never occupy disk. Cloudflare Images costs $5 per 100k images, including transformations. Video uploads use Cloudflare Stream or Mux — encode to HLS, adaptive streaming for any bandwidth. Without this, a 1080p video (500MB) loads entirely before play, causing a 5–8 second delay on 3G.
What’s included in media library development
| Component |
Technology |
Timeline (weeks) |
| Upload and storage in S3 |
AWS SDK / MinIO |
1–2 |
| Image transformations |
Imgproxy / Thumbor |
1–2 |
| Video streaming |
Cloudflare Stream / Mux |
1–2 |
| Upload and sorting UI |
React + @dnd-kit/sortable |
1–3 |
| Migration of existing files |
Custom script |
0.5–1 |
Why structured content outperforms free-form HTML
Free-form WYSIWYG leads to chaos in a year: 7 font sizes, 12 colors, random margins. Redesign requires manual cleanup of thousands of posts. Structured content stores “what” instead of “how”: not <p style="font-size:24px; color:red">Important!</p>, but a callout block with variant: warning. The CMS stores the structure; the frontend decides rendering. Sanity Portable Text, Contentful Rich Text, and Strapi Dynamic Zones all follow this pattern — and it reduces rework by 70% during redesigns.
Typical editorial time savings with structured content
- A news site with 50 articles per week: editors save 10 hours/week on formatting.
- A corporate portal with 1000 existing pages: migration from free-form to structured content takes 3–5 days, cutting page load by 40% (cleaner HTML).
Work process
-
Analysis of editorial workflows — who edits, how often, what content (articles, landing pages, product data), whether localization is needed.
-
CMS selection — based on scenarios, not trends. We compare headless vs traditional with a weighted matrix.
-
Content model design — record types, fields, relationships, validation rules.
-
Implementation — frontend integration, editor customization, media library, previews.
-
Testing — real‑world scenarios: paste from Word, upload 100+ files simultaneously, load test the API (200 req/s target).
-
Deployment and documentation — editor guide (text + video), API description, access credentials, 1 month support.
Timelines and budget
| Type of work |
Timeline |
Budget |
| Integration of headless CMS (Strapi/Sanity) into existing Next.js project |
2–5 weeks |
Discussed individually |
| Custom WYSIWYG editor with Tiptap and specific blocks |
2–4 weeks |
Discussed individually |
| Media library with S3 + transformations |
1–3 weeks |
Discussed individually |
| Full CMS system from scratch |
4–10 weeks |
Discussed individually |
Budget is calculated individually after an audit. Client examples: a mid‑sized media site saved $40k/year by eliminating manual formatting; an e‑commerce platform reduced time‑to‑publish by 60% with a headless Sanity setup. Contact us for a free project estimate.
What you get after delivery
- Working CMS with configured access rights (admin, editor, reviewer)
- Full content model documentation and API reference
- Editor training documentation (text + video)
- Code covered by tests (PHPUnit for Laravel, Jest for JS)
- 1 month post‑launch support with SLA
Our experience and guarantees
Over 40 completed CMS projects — from small editorial sites to enterprise media portals with 200k daily unique visitors. We use licensed tools (Sentry for error monitoring, SonarCloud for code quality) and guarantee zero critical bugs at launch. All code is version‑controlled and deployable via CI/CD.
For your specific needs, contact us to discuss requirements. We’ll provide a technical proposal within 2 business days.