coreseed-cli
v0.5.5
Published
Scaffold Django + Vue or React (Vite) projects with configurable UI libraries and optional setup
Maintainers
Readme
coreseed-cli
npm: coreseed-cli · Source on GitLab
coreseed-cli scaffolds a single-folder project with Django 6 and your choice of Vue 3 or React + Vite. Django exposes JSON APIs and serves an HTML shell; The selected frontend loads from Vite in development and from static assets when you build for production. The tool copies a bundled template, substitutes placeholders, and optionally creates a Python virtualenv, installs dependencies, runs migrations, and installs frontend packages.
Requirements
| Tool | Notes |
| ---- | ----- |
| Node.js | 18.18+ (also 20.9+ or 21.1+ per engines). Checked before work begins. |
| npm | For npx / global install. Generated projects may use pnpm if you choose it. |
| Python 3 | 3.12+ when setup runs (venv, pip, migrate). |
The target directory must be missing or empty.
Install and run
Try without installing globally (from the parent folder where the new project should appear):
npx coreseed-cli@latest my-appPin a version for reproducible runs:
npx [email protected] my-appGlobal install:
npm install -g coreseed-cli
coreseed-cli my-appContributors (from a clone of this repo):
npm install
node index.mjs my-appQuick start
Interactive (choose Quick for fewer prompts, or Custom for every option):
cd ~/projects
npx coreseed-cli@latest acme-portalNon-interactive defaults (Vue + Element Plus, npm, default API URL, full setup unless skipped):
npx coreseed-cli@latest acme-portal --defaultsScaffold only (no venv, pip, migrate, or frontend install):
npx coreseed-cli@latest acme-portal --defaults --skip-installCommand-line reference
coreseed-cli [project-directory] [options]| Option | Description |
| ------ | ----------- |
| --template <dir> | Alternate template directory (resolved from cwd unless absolute). |
| --defaults | Non-interactive: display name = directory name, API base http://127.0.0.1:8000, Vue + Element Plus, npm, full setup unless --skip-install. |
| --skip-install | Skip venv, pip, migrations, frontend install, frontend build, and collectstatic. With interactive mode you still answer questions that affect generated files. |
| --no-migrate | When setup runs: skip python manage.py migrate; frontend install, build, and collectstatic still run. |
| -h, --help | Print usage. |
The project folder name becomes the directory on disk and feeds placeholders such as the project slug; the npm name field is derived as kebab-case.
Interactive wizard
Without --defaults:
- Quick or Custom — Quick locks Vue + Element Plus, npm, the default API URL, SQLite, and no extra Django apps (only setup confirmation remains, unless
--skip-install). - Custom path: database (SQLite or PostgreSQL), PostgreSQL connection details when selected, display name, Django API base URL, optional comma-separated Django app names, Vue 3 vs React, Vue state management (None / Pinia / Vuex) and optional Vue Router setup for Vue, a framework-specific UI library (Element Plus / Naive UI / PrimeVue for Vue; Material UI / Ant Design / None for React), npm vs pnpm, then whether to run setup (unless
--skip-install).
Django app names must be valid Python identifiers, such as accounts, loans, reports. When setup runs, the CLI executes python manage.py startapp <name> for each name and adds the apps to INSTALLED_APPS. With --skip-install, create them manually after installing Python dependencies and add them to INSTALLED_APPS. When selected, Pinia or Vuex is registered in main.js, and Vue Router is created in src/router/index.js and registered in the app.
Canceling a prompt exits with failure.
What the CLI does (order)
- Ensures Node version is supported.
- Resolves the target directory and checks it is empty.
- Runs the wizard (or applies defaults).
- Copies the template (skips
node_modules,variants,dist, venvs, etc.). - Applies the selected frontend variant (
main.js/App.vuefor Vue ormain.jsx/App.jsxfor React, plusvite.config.jsand mergedpackage.jsondeps). - Substitutes placeholders in a fixed list of files (see placeholders below).
- If setup is enabled: creates venv, upgrades
pip, and installsrequirements.txt. - Runs Django
startappfor each selected app, then runsnpm/pnpm installandmigratein parallel (unless--no-migrate). - Runs
npm/pnpm run build. - Runs Django
collectstatic --noinputafter the frontend build completes. - Prints the project path or manual next steps if setup was skipped.
Generated layout (typical)
After scaffolding (before install artifacts):
my-app/
├── .env.example
├── .gitignore
├── README.md
├── config.json
├── manage.py
├── requirements.txt
├── package.json
├── vite.config.js
├── index.html
├── public/
│ └── .gitkeep
├── templates/
│ └── base.html
├── core/
│ ├── __init__.py
│ ├── asgi.py
│ ├── settings.py
│ ├── urls.py
│ ├── views.py
│ └── wsgi.py
└── src/
├── main.js
└── App.vueVue projects also create src/assets/ (with fonts/, images/, main.css, and base.css), src/components/, src/composables/, src/constants/, src/layouts/, src/router/, src/stores/, and src/views/; PrimeVue projects additionally create src/ui/. React projects keep the simpler src/ layout.
Tailwind CSS is configured by default through the Vite plugin for every frontend variant. PrimeVue projects also include the tailwindcss-primeui integration.
The generated root scripts/ directory contains local-build.sh for rebuilding local static assets and deploy.sh for preparing and pushing a deployment commit.
After setup you may also see env/, db.sqlite3 (unless --no-migrate), node_modules/, a lockfile, dist/, and static/. The CLI runs the frontend build and then Django collectstatic automatically when setup is enabled.
config.json is a flat application configuration shared by Django and Vite. It includes DEBUG, HOST, PORT, DJANGO_PORT, DB_ENGINE, database settings, API_BASE_URL, and optional email/SMS settings. Custom setup asks whether to use SQLite or PostgreSQL; SQLite is the default for quick setup. It is returned as JSON from GET /api/config/ for the selected frontend app.
Running the generated project
Copy env:
cp .env.example .env(optional; Vite can readVITE_API_BASE_URL; the app also loads/api/config/).Backend (if you skipped setup):
python3 -m venv env source env/bin/activate pip install -r requirements.txt python manage.py migrate python manage.py runserverFrontend (second terminal):
npm installthennpm run dev(orpnpm).Open
http://127.0.0.1:8000/so Django servesbase.html, which loads the selected Vite frontend (default 5173) whenDEBUGis true.DJANGO_PORTandPORTinconfig.jsondocument the backend and frontend ports; passDJANGO_PORTtorunserverwhen using a non-default backend port. You can still use Vite alone with the rootindex.htmlif you configure the API proxy.
Production: npm run build, set DEBUG false, run collectstatic as needed, serve Django and static files per your host.
Placeholders
These tokens are replaced in a known set of project files (not in every file in the tree):
| Token | Meaning |
| ----- | ------- |
| __PACKAGE_NAME__ | Kebab-case npm name from the directory argument. |
| __DISPLAY_NAME__ | Display / app title. |
| __PROJECT_SLUG__ | Directory name you passed. |
| __SECRET_KEY__ | Generated Django SECRET_KEY. |
| __VITE_API_BASE__ | API origin for config.json / .env.example (no trailing slash). |
Custom templates should keep using these tokens in the same kinds of files, or extend the CLI’s allowlist if you fork it.
Publishing (maintainers)
- Bump
versioninpackage.json, updateCHANGELOG.md, and commit. - Verify pack contents:
npm pack --dry-run - Run tests:
npm testandnode scripts/verify-template.mjs - Log in once:
npm login - Publish:
npm publish(usenpm publish --access publicif the package is scoped and should be public)
Ensure you have rights to the coreseed-cli package on npm. If npm publish warns about bin, run npm pkg fix locally and release a patch version.
Developing this CLI
npm test
node scripts/verify-template.mjsLicense
MIT
