How sundev207/mern-stack-cms works
Project type and purpose
• This is a full-stack MERN (MongoDB, Express, React, Node.js) content management system (CMS).
• The “client” folder contains a React/Redux single-page app (SPA) for both public site views and an admin interface.
• The “server” folder houses an Express RESTful API, Pug views for server-rendered pages (error/index), static asset hosting, authentication/middleware, and a MongoDB data layer.
File structure
• Top-level:
· client/ – React application (src, public, Redux actions/reducers, components/containers)
· server/ – Express app (app.js, routes/, models/, middlewares/, views/, public/static upload & styles)
· config.js & sites.json – global configuration and multisite definitions for MongoDB import
• Patterns & concerns:
· client/src/actions + reducers → Redux state management (REST calls, auth, categories, posts, sites, snackbars)
· client/src/containers → React Router routes and admin vs public page separation
· server/routes/*.js → REST endpoints for users, posts, pages, tags, sites, capabilities
· server/middlewares → authentication, brute-force rate limiting
· server/models/schemas.js → Mongoose schemas, models/index.js → model initialization
· server/public/upload/themes → user-uploadable theme assets
· server/views → Pug templates for server-rendered entry points (error.pug, index.pug)
Key README insights
• Uses MongoDB 3.2+, multi-site import via sites.json
• Separate npm installs/starts for client (port 3000) & server (port 3001)
• First admin user setup by manually updating the users collection’s role field
Detailing and essential capture
· Public UI vs Admin UI sections in the SPA
· API Gateway vs Business Logic vs Data Layer on the server
· External dependencies (MongoDB, file storage)
• Authentication flow: login → token/cookie → protected route middleware
• Static file serving path (e.g., GET /upload/themes/:themeName → file system)
• Special routes (e.g., /sites to load multisite configuration)