NaesungCMS is built on a modern Next.js 14 App Router foundation, enhanced with custom architectural patterns for security and flexibility.
The core innovation of NaesungCMS is its ability to switch underlying infrastructure providers without code changes. This is achieved through the Adapter Pattern.
Standardizes file operations (upload, delete) across different providers.
StorageAdapter@aws-sdk/client-s3. Supports AWS S3, Cloudflare R2, and MinIO.fs. Stores files in public/uploads.Standardizes email delivery (send).
MailAdapternodemailer. Compatible with Gmail, Outlook, and self-hosted Postfix.We do not rely on API route separation for security. Instead, we enforce security at the Data Access Layer.
withTenant WrapperEvery database function is wrapped in withTenant:
export const getPosts = withTenant(async (db, blogId) => {
return db.post.findMany({ where: { blogId } })
})
blogId from the request context (headers/domain).blogId.Next.js Middleware (src/middleware.ts) intercepts every request to handle subdomain routing.
blog.naesungcms.com -> blog./_tenants/blog/....src/app/[domain] handles the request.This allows us to serve thousands of distinct sites from a single Next.js deployment.