Create your first app
In this section, you will learn how to set up your Cpp.js project and write a minimal starter application. By the end of this section, you should be able to run a working Cpp.js app in development mode from your terminal.
- npm
- Yarn
- pnpm
- bun
npm init cpp.js@latest
yarn create cpp.js@latest
pnpm create cpp.js@latest
bunx create-cpp.js@latest
This command will install and execute create-cpp.js, the official Cpp.js project scaffolding tool. You will be presented with prompts for several optional features such as React.
Welcome to Cpp.js!
✔ Project Name … <your-project-name>
✔ Where should we create your project?
(leave blank to use current directory) … <your-project-name>
✔ Select a type: › Web
✔ Select a framework: › React
✔ Select a bundler: › Vite
Your project is ready!
If you are unsure about an option, simply choose Web, React and Vite. Once the project is created, follow the instructions to install dependencies and start the dev server:
- npm
- Yarn
- pnpm
- bun
cd <your-project-name>
npm install
npm run dev
cd <your-project-name>
yarn install
yarn dev
cd <your-project-name>
pnpm install
pnpm run dev
cd <your-project-name>
bun install
bun run dev
You should now have your first Cpp.js project running!
When you are ready to ship your app to production, run the following:
- npm
- Yarn
- pnpm
- bun
npm run build
yarn build
pnpm run build
bun run build
This will create a production-ready build of your app in the project's ./dist directory.