Get Started
Get up and running with LightTs, a lightweight Node.js framework, in just a few steps. This guide walks you through installing the CLI, initializing a project, and generating your first components.
-
Installation
Install the LightTs CLI globally to streamline project setup and management:
Terminal window npm install -g lighttsAlternatively, use
npx
to run the CLI without global installation:Terminal window npx lighttsThe CLI supports both
lightts
andlts
commands. For example:Terminal window lts init -
Initialize a Project
Create a new LightTs project with the
init
command:Terminal window lts initThe CLI will prompt you to configure your project:
- Project Name: Enter a name (e.g.,
my-api
). - File Naming Style: Choose between Angular-style (
auth.service.ts
) or regular (auth.ts
) naming conventions. - Features: Select optional features like JWT authentication, CORS, validation, or database integration.
- Database Options: If database support is selected, choose from PostgreSQL, MySQL, MariaDB, or MongoDB, and configure migrations, seeders, or dummy data.
- Code Quality Tools: Optionally set up ESLint, Prettier, and Husky for code consistency.
- Package Manager: Choose npm, Yarn, or pnpm.
This generates a project structure with all necessary files and configurations.
- Project Name: Enter a name (e.g.,
-
Generate Components
Use the
generate
(org
) command to create controllers, services, validators, or resources:Terminal window lts generate controller userlts g service authlts g validate userlts g resource productThese commands create modular, reusable components that follow LightTs conventions.
-
Run Your Project
Navigate to your project directory and start the development server:
Terminal window cd my-apinpm run devYour API will be available at
http://localhost:8000
(or a custom port if configured).
Done! Your LightTs API is live. Check the CLI docs for more commands.