Installation
How to install REstJS and set up your development environment.
2 min readEdit this page
Requirements
| Requirement | Version |
|---|---|
| Node.js | 18.0.0 or higher |
| npm | 8.0.0 or higher |
| TypeScript | 5.0.0 or higher |
Install the CLI
npm install -g @restjs/cliVerify the installation:
rest --versionCreate a project
rest create my-apiThis generates a new project with:
- Pre-configured TypeScript
- Standard directory structure
- Sample controller and service
- Environment configuration
.gitignorewith sensible defaults
Project structure
my-api/
├── src/
│ ├── main.ts
│ ├── config/
│ │ └── app.config.ts
│ └── modules/
│ └── users/
│ ├── controllers/
│ ├── services/
│ └── users.test.ts
├── package.json
├── tsconfig.json
├── .env
└── .env.exampleInstall dependencies
cd my-api
npm installStart the server
rest runThe development server starts with hot reload. Every file save triggers incremental TypeScript compilation and automatic restart.
Tip
Run rest doctor inside your project to check for configuration issues.
Available CLI commands
rest create <name> # Create a new project
rest run # Start dev server with hot reload
rest build # Compile for production
rest test [pattern] # Run test files
rest deploy # Generate Docker + K8s files
rest install [package] # Install a package
rest doctor # Diagnose project issues