A fully functional CMS/Blog platform built with microservices architecture, featuring a React/Next.js frontend with Mantine UI and TipTap editor, backed by multiple Node.js microservices.
- Next.js 14 with App Router and Server-Side Rendering
- Mantine UI component library for modern, accessible interface
- TipTap Editor for rich text content creation
- React Query for efficient data fetching and caching
- TypeScript for type safety
- User Service - Authentication, user management, roles (admin, editor, author, reader)
- Content Service - CRUD operations for posts, drafts, versioning, scheduled publishing
- Media Service - File uploads, image processing, thumbnails
- Category & Tag Service - Content organization and filtering
- Comment Service - Comments, replies, moderation system
- PostgreSQL with separate schemas for each microservice
- Database migrations and initialization scripts
- Optimized indexes for performance
- β User authentication with JWT tokens
- β Role-based access control
- β Rich text editor with image uploads
- β Post scheduling and versioning
- β Media management with thumbnails
- β Categories and tags system
- β Comments with moderation
- β Responsive design
- β Docker Compose for easy setup
- Node.js 18+
- Docker and Docker Compose
- Git
git clone <repository-url>
cd cms-blog-platform# Start all services
docker-compose up -d
# Check service status
docker-compose psThis will start:
- 6 PostgreSQL databases (one per microservice)
- 5 Node.js microservices
- 1 Next.js frontend
- All services will be available on their respective ports
If you prefer to run services locally:
# Install root dependencies
npm install
# Install all service dependencies
npm run install:all# Start all services in development mode
npm run dev
# Or start services individually
npm run dev:user # User Service (port 3001)
npm run dev:content # Content Service (port 3002)
npm run dev:media # Media Service (port 3003)
npm run dev:category # Category Service (port 3004)
npm run dev:comment # Comment Service (port 3005)
npm run dev:frontend # Frontend (port 3000)| Service | URL | Description |
|---|---|---|
| Frontend | http://localhost:3000 | Next.js application |
| User Service | http://localhost:3001 | Authentication & user management |
| Content Service | http://localhost:3002 | Posts & content management |
| Media Service | http://localhost:3003 | File uploads & media |
| Category Service | http://localhost:3004 | Categories & tags |
| Comment Service | http://localhost:3005 | Comments & moderation |
This platform uses WSO2 Asgardeo for secure authentication (2FA) while managing roles locally.
New users can register via Asgardeo SSO:
- Click "Sign Up" in the navigation bar
- Fill in your details via Asgardeo's secure registration
- Verify your email
- Login with Asgardeo SSO
All new users receive the "reader" role by default. Admins can upgrade roles via the admin panel.
- Admin - Full platform access including user management
- Editor - Manage all content and moderate comments
- Author - Create and manage own blog posts
- Reader - View published content (default for new users)
Asgardeo is used ONLY for authentication (2FA), NOT for role management.
- Registration: Users sign up via Asgardeo
- JIT Provisioning: On first login, local account created with "reader" role
- Role Management: Admins assign roles (author/editor/admin) via admin panel
- User Status Sync: When admin deactivates a user, their Asgardeo account is locked automatically
Why this approach?
- Asgardeo provides secure 2FA authentication
- Local role management allows flexible, blog-specific permissions
- User status syncs to Asgardeo to prevent locked-out users from accessing via SSO
For initial setup, a default admin user is available:
- Email: admin@cms.com
- Password: admin123
- Role: admin
Note: For local development only. Change in production!
cms-blog-platform/
βββ frontend/ # Next.js frontend application
β βββ src/
β β βββ app/ # App Router pages
β β βββ components/ # Reusable components
β β βββ contexts/ # React contexts
β β βββ hooks/ # Custom hooks
β β βββ services/ # API services
β βββ package.json
βββ services/ # Microservices
β βββ user-service/ # Authentication & users
β βββ content-service/ # Posts & content
β βββ media-service/ # File uploads
β βββ category-service/ # Categories & tags
β βββ comment-service/ # Comments
βββ database/ # Database schemas
β βββ init/ # Database initialization
β βββ schemas/ # Service-specific schemas
βββ docker-compose.yml # Docker Compose configuration
βββ package.json # Root package.json
Each microservice has its own PostgreSQL database:
users- User accounts and profilesuser_sessions- JWT token sessionsuser_profiles- Extended user information
posts- Blog posts and articlespost_versions- Post version historypost_categories- Post-category relationshipspost_tags- Post-tag relationshipspost_views- View tracking
media_files- Uploaded files metadatamedia_thumbnails- Generated thumbnailsmedia_usage- File usage tracking
categories- Content categoriestags- Content tagscategory_hierarchy- Category relationships
comments- User commentscomment_moderation- Moderation actionscomment_likes- Comment likes
- Frontend Changes: Edit files in
frontend/src/ - Backend Changes: Edit files in
services/[service-name]/src/ - Database Changes: Update schemas in
database/schemas/
Each service exposes REST APIs:
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/users/profile- Get user profilePUT /api/users/profile- Update profile
GET /api/posts- List postsPOST /api/posts- Create postPUT /api/posts/:id- Update postDELETE /api/posts/:id- Delete postPOST /api/posts/:id/publish- Publish post
GET /api/media- List media filesPOST /api/media/upload- Upload filesPUT /api/media/:id- Update media metadataDELETE /api/media/:id- Delete media
GET /api/categories- List categoriesPOST /api/categories- Create categoryGET /api/tags- List tagsPOST /api/tags- Create tag
GET /api/comments- List commentsPOST /api/comments- Create commentPOST /api/comments/:id/like- Like commentPOST /api/comments/:id/moderate- Moderate comment
Important: Copy .env.example to .env in the project root and fill in your credentials. See SETUP.md for detailed instructions.
Example environment variables for each service:
NODE_ENV=development
PORT=3001
DATABASE_URL=postgresql://user_service:user_password@localhost:5433/user_service
JWT_SECRET=your-super-secret-jwt-key
JWT_EXPIRES_IN=7d
# Asgardeo SSO Configuration
ASGARDEO_BASE_URL=https://api.asgardeo.io/t/your-org-name
ASGARDEO_CLIENT_ID=your-frontend-client-id
ASGARDEO_CLIENT_SECRET=your-frontend-client-secret
ASGARDEO_ORG_NAME=your-org-name
# Asgardeo M2M Configuration (User Status Sync)
ASGARDEO_M2M_CLIENT_ID=your-m2m-client-id
ASGARDEO_M2M_CLIENT_SECRET=your-m2m-client-secretNODE_ENV=development
PORT=3002
DATABASE_URL=postgresql://content_service:content_password@localhost:5434/content_serviceNODE_ENV=development
PORT=3003
DATABASE_URL=postgresql://media_service:media_password@localhost:5435/media_service
UPLOAD_PATH=/app/uploadsNODE_ENV=development
PORT=3004
DATABASE_URL=postgresql://category_service:category_password@localhost:5436/category_serviceNODE_ENV=development
PORT=3005
DATABASE_URL=postgresql://comment_service:comment_password@localhost:5437/comment_serviceNEXT_PUBLIC_API_BASE_URL=http://localhost
NEXT_PUBLIC_USER_SERVICE_URL=http://localhost:3001
NEXT_PUBLIC_CONTENT_SERVICE_URL=http://localhost:3002
NEXT_PUBLIC_MEDIA_SERVICE_URL=http://localhost:3003
NEXT_PUBLIC_CATEGORY_SERVICE_URL=http://localhost:3004
NEXT_PUBLIC_COMMENT_SERVICE_URL=http://localhost:3005
# Asgardeo Configuration
NEXT_PUBLIC_ASGARDEO_BASE_URL=https://api.asgardeo.io/t/your-org-name
NEXT_PUBLIC_ASGARDEO_CLIENT_ID=your-frontend-client-id
NEXT_PUBLIC_ASGARDEO_REDIRECT_URL=http://localhost:3000
NEXT_PUBLIC_ASGARDEO_SCOPE=openid profile emailFor detailed Asgardeo setup instructions, see SETUP.md.
Quick overview:
-
Create Asgardeo Organization
- Sign up at https://console.asgardeo.io/
- Create a new organization
-
Create Frontend Application (Traditional Web Application)
- Navigate to Applications β New Application
- Select "Traditional Web Application"
- Configure authorized redirect URLs
- Enable self-registration in "Login Flow" tab
- Note the Client ID and Client Secret
-
Create M2M Application (for User Sync)
- Navigate to Applications β New Application
- Select "Machine to Machine"
- Grant API scopes:
internal_user_mgt_update,internal_user_mgt_view - Enable SCIM2 Users API authorization
- Note the Client ID and Client Secret
-
Configure Environment Variables
- Copy
.env.exampleto.env - Fill in your Asgardeo credentials
- See SETUP.md for detailed instructions
- Copy
Important: Asgardeo is used ONLY for 2FA authentication. Roles are managed locally in the admin panel, NOT via Asgardeo groups
# Run all tests
npm run test
# Run frontend tests
npm run test:frontend
# Run service tests
npm run test:services- Access the frontend: http://localhost:3000
- Login with admin credentials: admin@cms.com / admin123
- Create a new post: Navigate to "Create Post"
- Upload media: Use the media upload feature
- Test comments: Add comments to posts
- Test categories: Create and assign categories
# Build all services
npm run build
# Start production services
docker-compose -f docker-compose.prod.yml up -dFor production deployment:
- Update environment variables
- Configure database connections
- Set up file storage (AWS S3, etc.)
- Configure reverse proxy (Nginx)
- Set up SSL certificates
- Port conflicts: Ensure ports 3000-3007 are available
- Database connection: Check PostgreSQL is running
- File uploads: Verify upload directory permissions
- CORS errors: Check service URLs in frontend config
# View all service logs
docker-compose logs -f
# View specific service logs
docker-compose logs -f user-service
docker-compose logs -f frontend# Stop services
docker-compose down
# Remove volumes
docker-compose down -v
# Restart services
docker-compose up -d- Next.js Documentation
- Mantine UI Documentation
- TipTap Editor Documentation
- PostgreSQL Documentation
- Docker Compose Documentation
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For issues and questions:
- Check the troubleshooting section
- Review service logs
- Create an issue with detailed information
- Include error messages and steps to reproduce
Happy coding! π