@mounaji_npm/cli
v0.6.1
Published
CLI to scaffold a new Mounaji SaaS app — full Next.js template with selectable modules
Maintainers
Readme
@mounaji_npm/cli
CLI scaffolder for Mounaji applications. Templates — SaaS App, Forum / Community, Landing Page, Landing Page + Forum, and SaaS Multi-Tenant — generate a complete Next.js or Vite+React project in one command, with the right packages, routes, and config files pre-wired.
Usage
No install needed — run directly with npx:
npx @mounaji_npm/cli create my-saas-appOr install globally:
npm install -g @mounaji_npm/cli
mounaji create my-saas-appmounaji create
Interactive project scaffolder. Supports two templates — choose at the first prompt.
mounaji create <project-name>
# Examples
mounaji create my-saas-app
mounaji create my-forum
mounaji create . # scaffold into current directory
npx @mounaji_npm/cli create my-appTemplate 1 — SaaS App
Full platform shell with sidebar navigation, module registry, and optional DevToolbar.
SaaS prompts
1. Project name → folder name
2. Choose a template → 1. SaaS App (this path)
3. Framework → Next.js App Router | Vite + React
4. Modules to include → multiselect (or 'a' for all)
5. Include DevToolbar + TokenEditor? → y/n
6. Include i18n? → y/n
↳ Select languages → en (base), es, pt, zh, de
↳ Default locale
↳ Show language switcher?
7. Include Docker production setup? → y/nAvailable SaaS modules
| ID | Label | Installs |
|---|---|---|
| home | Home | (included in AppShell) |
| dashboard | Dashboard | @mounaji_npm/dashboard |
| chat | Chat | @mounaji_npm/chat |
| assistants | Assistants | @mounaji_npm/assistant |
| knowledge-base | Knowledge Base | @mounaji_npm/knowledge-base |
| tasks | Tasks | — |
| connections | Connections | — |
| settings | Settings | (included) |
| inventory | Inventory | — |
| contacts | Contacts | — |
| workflows | Workflows | — |
| platforms | Platforms | — |
| pricing | Pricing | — |
Template 2 — Forum / Community
Forum listing, post threads, reply system, voting, and an optional landing page. Built on @mounaji_npm/forum and @mounaji_npm/forum-landing.
Forum prompts
1. Project name → folder name
2. Choose a template → 2. Forum / Community (this path)
3. Framework → Next.js App Router | Vite + React
4. Include a landing page? → y/n (adds @mounaji_npm/forum-landing at /)
5. Include admin DevToolbar + Module Manager? → y/n
6. Include Docker production setup? → y/nForum generated routes
| Route | Component | Package |
|---|---|---|
| / | ForumLandingPage (if landing selected) | @mounaji_npm/forum-landing |
| /forum | ForumPage — listing with categories + search + sort | @mounaji_npm/forum |
| /forum/[id] | PostPage — post content + reply thread | @mounaji_npm/forum |
| /forum/create | CreatePostPage — title, body, category, tags | @mounaji_npm/forum |
| /admin/modules | ModulesPage (if admin selected) | @mounaji_npm/admin-dashboard |
Forum config file
The CLI generates mn-forum-config.js at the project root. Edit it to customize your community without touching generated page files:
// mn-forum-config.js
export const MN_FORUM_CONFIG = {
name: 'My Community',
tagline: 'Discussions, questions, and ideas from the community.',
// Brand colors (fed into TokensProvider)
primaryColor: '#3B82F6',
accentColor: '#8B5CF6',
// Sidebar categories
categories: [
{ id: 'all', label: 'All Posts', icon: '◉' },
{ id: 'general', label: 'General', icon: '💬' },
{ id: 'questions',label: 'Questions', icon: '❓' },
{ id: 'ideas', label: 'Ideas', icon: '💡' },
{ id: 'bugs', label: 'Bug Reports',icon: '🐛' },
],
// Hero CTAs on the landing page
primaryCTA: { label: 'Join the Community' },
secondaryCTA: { label: 'Browse Discussions' },
};Template 5 — SaaS Multi-Tenant
A production-shaped multi-tenant SaaS: Organization → Project hierarchy with
per-tenant RBAC, real authentication (NextAuth), and a config-driven tenancy
engine. Built on @mounaji_npm/auth, @mounaji_npm/tenancy-core,
@mounaji_npm/scope-context, and the @mounaji_npm/saas-template shell.
Prompts
1. Project name → my-saas
2. Choose a template → 5. SaaS Multi-Tenant (this path)No further prompts — it scaffolds a ready-to-run app.
What you get
| Concern | Package | Where |
|---|---|---|
| Hierarchy (org → project) | tenancy-core defineTenancy() | lib/tenancy/model.js |
| Server store + RBAC | tenancy-core/server (memory or Supabase) | lib/tenancy/store.js |
| API routes (App Router) | tenancy-core/nextjs createTenancyRoutes | app/api/tenancy/** |
| Auth | NextAuth + @mounaji_npm/auth createNextAuthAdapter | lib/auth/**, app/ClientShellProvider.js |
| Active tenant (UI) | scope-context + TenancyScopeSwitcher | app/ClientShellProvider.js |
| Tenant CRUD + members UI | tenancy-core/client | app/organizations/**, app/projects/** |
Run it
cd my-saas
npm install
npm run dev # http://localhost:3000Sign in as [email protected] (any password), create an organization, switch to it
in the top-bar scope switcher, add a project, and invite members. The store is
in-memory by default (zero config); set SUPABASE_URL /
SUPABASE_SERVICE_ROLE_KEY to persist to Postgres — see DOCS/SUPABASE_SETUP.md
in the generated project.
Requires
@mounaji_npm/tenancy-coreto be published to your registry.
Programmatic
import { scaffoldApp } from '@mounaji_npm/cli/scaffold'; // or bin/create.js
await scaffoldApp({ template: 'saas-multitenant', outDir: '/abs/path/my-saas', name: 'my-saas' });Generated Output
Next.js App Router
my-app/
├── app/
│ ├── layout.js ← AppShell wired with selected modules
│ ├── page.js ← Home page
│ ├── dashboard/page.js ← (if selected)
│ ├── chat/page.js ← (if selected)
│ ├── assistants/page.js ← (if selected)
│ └── .../page.js ← one file per selected module
├── locales/ ← (if i18n selected)
│ ├── en.js
│ └── es.js ← (one per selected language)
├── mn-config.js ← branding + token overrides + custom module slots
├── .env.local ← env variable template
├── docker-compose.yml ← (if Docker selected)
├── Dockerfile ← (if Docker selected)
└── package.json ← all required @mounaji_npm/* deps pre-wiredVite + React
my-app/
├── src/
│ ├── App.jsx ← BrowserRouter + AppShell + Routes
│ ├── main.jsx
│ └── pages/
│ └── [Module]Page.jsx ← one per selected module
├── index.html
├── locales/ ← (if i18n selected)
├── mn-config.js
├── .env
└── package.jsonAfter Scaffolding
cd my-app
npm install
npm run dev- Next.js starts on
http://localhost:3000 - Vite starts on
http://localhost:5173
mounaji add docker
Add Docker production infrastructure to an existing project:
cd my-existing-app
mounaji add docker
# or
npx @mounaji_npm/dockerThis runs the same Docker generator as the create command's Docker prompt. See @mounaji_npm/docker for what gets generated.
mn-config.js
The generated mn-config.js is the branding and configuration file for your app. Edit it to customize your app without touching the generated layout files:
// mn-config.js
export default {
appName: 'My SaaS App',
// Replace with your logo (React component, <img>, or null for text)
logo: null,
// Token overrides — change colors, fonts, radii
tokens: {
colorPrimary: '#7C3AED',
colorAccent: '#06B6D4',
fontFamily: '"Geist", system-ui, sans-serif',
radiusMd: '10px',
},
// Extra custom module manifests added to AppShell
modules: [
// {
// id: 'my-page',
// label: 'My Page',
// icon: '🚀',
// path: '/my-page',
// section: 'Workspace',
// order: 20,
// },
],
};Environment Variables
The generated .env.local (Next.js) or .env (Vite) includes placeholders for common services:
# App
NEXT_PUBLIC_APP_URL=http://localhost:3000
# Firebase (if auth selected)
NEXT_PUBLIC_FIREBASE_API_KEY=
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
NEXT_PUBLIC_FIREBASE_PROJECT_ID=
# Backend API
NEXT_PUBLIC_API_URL=http://localhost:5000
# Mounaji widget (if chat selected)
NEXT_PUBLIC_MOUNAJI_API_KEY=