Installation
This guide walks you through installing StratusTS and verifying your setup. Let’s get you up and running!
Prerequisites
Section titled “Prerequisites”Before installing StratusTS, ensure you have:
Node.js
- Minimum version: Node.js 16.x or higher
- Recommended: Node.js 18.x or later
- Check your version:
node --version - Download Node.js if needed
Package Manager
- npm (comes with Node.js) or
- pnpm (recommended for faster installs)
- yarn also works
TypeScript Knowledge
- Basic understanding of TypeScript
- Familiarity with types and interfaces
- Understanding of async/await
Optional but Helpful
- Experience with Express or similar frameworks
- Familiarity with Django’s architecture
- Basic database knowledge
Installation Methods
Section titled “Installation Methods”Method 1: Global Installation (Recommended)
Section titled “Method 1: Global Installation (Recommended)”Installing globally gives you access to the st command anywhere on your system.
Using pnpm:
pnpm add -g stratus-tsor,
Using npm:
npm install -g stratus-tsor,
Using yarn:
yarn global add stratus-tsThis installs the stratus-ts CLI globally, allowing you to run commands like st create project from any directory.
Verify Installation
Section titled “Verify Installation”After installing, verify stratus-ts is accessible:
st --versionor
stratus-ts --versionYou should see the current version number, like 0.1.0.
If you see “command not found,” check the Troubleshooting section below.
Your First Project
Section titled “Your First Project”Once installed, create your first project:
st create project my-first-appThis command:
- Creates a new directory called
my-first-app - Sets up the project structure
- Generates configuration files
- Creates initial source files
You’ll see output like:
✓ Creating project directory...✓ Generating package.json...✓ Setting up TypeScript configuration...✓ Creating source files...✓ Project created successfully!
Next steps: cd my-first-app npm install npm run devInstall Dependencies
Section titled “Install Dependencies”Navigate to your project and install dependencies:
cd my-first-apppnpm i # or npm installThis installs all required packages including:
- TypeScript compiler
- stratus-ts runtime
- Development tools
Start Development Server
Section titled “Start Development Server”Run your application in development mode:
pnpm dev # or npm run devYou should see:
server running on port : 2000Open your browser and visit http://localhost:2000. You should see a welcome message!
Project Structure
Section titled “Project Structure”After installation, your project looks like this:
Directorymy-first-app/
Directorynode_modules/ # Installed dependencies
- …
Directorysrc/ # Your application code
- app.ts # App setup
- main.ts # Entry point
- settings.ts # Configuration
- package.json # Dependencies and scripts
- tsconfig.json # TypeScript configuration
Key Files Explained:
package.json
Defines your project dependencies and scripts. Contains commands like npm run dev and npm run build.
tsconfig.json
Configures how TypeScript compiles your code. Pre-configured with optimal settings.
src/app.ts
Sets up your StratusTS application. Registers apps and configures the server.
src/main.ts
The entry point. Imports your app configuration and starts the server.
src/settings.ts
Central configuration for port, database, apps, and templates. Learn more about settings.
Available Scripts
Section titled “Available Scripts”Your project comes with several npm scripts:
Development:
pnpm dev # or npm run devRuns the application in development mode with hot reloading.
Build:
pnpm build # or npm run buildCompiles TypeScript to JavaScript for production.
Start:
npm start # prefer because pnpm is over kill for prodRuns the compiled production build.
Troubleshooting
Section titled “Troubleshooting”Command Not Found
Section titled “Command Not Found”If st or stratus-ts isn’t recognized:
On Linux/macOS:
-
Check npm global bin path:
terminal npm config get prefix -
Ensure this path is in your
$PATH. Add to~/.bashrcor~/.zshrc:terminal export PATH="$PATH:$(npm config get prefix)/bin" -
Reload your shell:
terminal source ~/.bashrc # or ~/.zshrc
On Windows:
-
Check global installation directory:
terminal npm config get prefix -
Add this path to your system’s PATH environment variable:
- Search for “Environment Variables” in Start menu
- Edit “Path” under System Variables
- Add the npm prefix path
Alternative: Use the full path:
npx stratus-ts create project my-appPermission Errors (Linux/macOS)
Section titled “Permission Errors (Linux/macOS)”If you get EACCES permission errors:
Option 1: Fix npm permissions (recommended)
mkdir ~/.npm-globalnpm config set prefix '~/.npm-global'echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrcsource ~/.bashrcThen reinstall:
npm install -g stratus-tsOption 2: Use sudo (not recommended)
sudo npm install -g stratus-tsPort Already in Use
Section titled “Port Already in Use”If port 2000 is busy, change it in src/settings.ts:
const PORT = 3000; // Use any available portTypeScript Errors
Section titled “TypeScript Errors”Ensure you have compatible TypeScript version:
pnpm i -D typescript # or npm install -D typescriptModule Not Found
Section titled “Module Not Found”If imports fail, regenerate dependencies:
rm -rf node_modules package-lock.jsonnpm installSlow Installation
Section titled “Slow Installation”If npm install is slow:
Use pnpm (faster):
npm install -g pnpmpnpm installOr enable npm cache:
npm config set cache ~/.npm-cache --globalUpdating StratusTS
Section titled “Updating StratusTS”To update to the latest version:
Global installation:
npm update -g stratus-tsCheck for updates:
npm outdated -g stratus-tsInstall specific version:
npm install -g stratus-ts@0.2.0Uninstalling
Section titled “Uninstalling”To remove StratusTS:
Global uninstallation:
npm uninstall -g stratus-tsRemove projects (be careful!):
rm -rf my-first-appNext Steps
Section titled “Next Steps”Installation complete! Here’s what to do next:
Quick Start Guide - Build your first endpoint
Need help? Check GitHub Issues or Discussions.