create-drogon-app
v0.0.1
Published
CLI tool to scaffold Drogon C++ applications
Readme
🚀 create-drogon-app
A tiny Node.js CLI that scaffolds a ready-to-build Drogon (C++) backend.
It copies the template from templates/drogon-starter into a new folder.
✨ What you get
The generated project includes:
- ⚙️ CMake project (CMake >= 3.15)
- 📦 Conan dependency management (
drogon/1.9.12) - 🐘 PostgreSQL dev database via
docker compose - 🐳 A Dockerfile to build/run the app in a container
- 🩺 A sample
GET /healthroute - 🔌 Loads
PORTfrom.env(defaults to3000)
✅ Prerequisites
For the generator
- Node.js (recommended: an active LTS)
- npm
For building the generated C++ project
- C++17 toolchain (e.g. GCC/Clang)
- CMake >= 3.15
- Python 3 + pip
- Conan
- Docker (optional, used for PostgreSQL and/or building the image)
📥 Install
Option A (recommended): use as a starter via npm
npm create drogon-app@latest my-serviceThen:
cd my-serviceIf your npm version requires
--to pass args, use:npm create drogon-app@latest -- my-service.
Option B: use locally from this repo (development)
# from the repo root
npm install -g .
create-drogon-app my-serviceOption C: run without installing globally
node ./bin/index.js my-service🧪 Usage
Create a new Drogon project:
npm create drogon-app@latest my-service
cd my-serviceThe CLI prints basic build commands. For a more complete local setup (recommended), run:
# 1) local env + config
cp .env.example .env
cp config/config.example.json config/config.json
# 2) (optional) start Postgres
docker compose up -d
# 3) install dependencies
conan profile detect --force
conan install . --output-folder=build --build=missing -s build_type=Release
# 4) configure + build
cmake --preset conan-release
cmake --build --preset conan-release
# 5) run
./build/Drogon_StarterHit the health endpoint:
curl -s http://localhost:3000/health🗂️ Template details
The template lives at:
templates/drogon-starter/
It is copied as-is into your new project directory. For full template documentation, see:
templates/drogon-starter/README.md
🛠️ How it works
- Entry point:
bin/index.js - It reads the project name from the first CLI argument.
- It copies
templates/drogon-starterto./<projectName>using Node’sfs.cpSync(..., { recursive: true }).
🧩 Development (this repo)
Typical workflow:
# edit files under templates/drogon-starter/
node ./bin/index.js _tmp_test_app
rm -rf _tmp_test_app📄 License
MIT
