You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP โ†’
Socket
Book a DemoInstallSign in
Socket

rtg-template

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rtg-template

A CLI tool for quickly scaffolding full-stack project templates

1.0.0-beta.2
latest
npmnpm
Version published
Weekly downloads
123
Maintainers
0
Weekly downloads
ย 
Created
Source

RTG Template ๐Ÿš€

A powerful CLI tool for quickly scaffolding full-stack project templates with your preferred tech stacks.

Features โœจ

  • Quick Setup: Scaffold projects in seconds with pre-configured templates
  • Interactive Mode: Choose your stack through an intuitive CLI interface
  • Flexible Options: Mix and match frameworks, databases, and add-ons
  • Post-Install Hooks: Automatic dependency installation and project setup
  • Extensible: Support for custom and community templates
  • TypeScript Ready: Full TypeScript support across all templates

Installation ๐Ÿ“ฆ

# Use via npx (recommended)
npx rtg-template

# Or install globally
npm install -g rtg-template

Quick Start ๐Ÿƒโ€โ™‚๏ธ

# Interactive mode - choose your stack step by step
npx rtg-template

# Direct template usage
npx rtg-template react my-react-app --typescript --tailwind
npx rtg-template next my-next-app --auth
npx rtg-template node-api my-api --mongodb

Available Templates ๐Ÿ“‹

TemplateDescriptionFrameworksAdd-ons
reactReact with ViteReact, ViteTypeScript, Tailwind CSS, Redux Toolkit
react-tailwindReact with Tailwind CSSReact, Vite, Tailwind CSSTypeScript, Redux Toolkit
react-tailwind-tsReact with Tailwind + TypeScriptReact, Vite, Tailwind CSS, TypeScriptRedux Toolkit
react-material-uiReact with Material-UIReact, Vite, Material-UITypeScript, Redux Toolkit
react-styled-componentsReact with Styled ComponentsReact, Vite, Styled ComponentsTypeScript, Redux Toolkit
react-tsReact with TypeScriptReact, Vite, TypeScriptTailwind CSS, Redux Toolkit
nextNext.js applicationNext.js, ReactTypeScript, Tailwind CSS, Auth
node-apiExpress.js APINode.js, ExpressTypeScript, MongoDB, MySQL, PostgreSQL, Auth
nestjsNestJS applicationNestJS, TypeScriptPrisma, PostgreSQL, MySQL, Auth
fastapiFastAPI Python appFastAPI, PythonMySQL, PostgreSQL, Auth

Usage Examples ๐Ÿ’ก

Interactive Mode

npx rtg-template
# Follow the prompts to select your template and options

Direct Commands

# React app with TypeScript and Tailwind
npx rtg-template react my-app --typescript --tailwind

# React with Tailwind CSS (pre-built template)
npx rtg-template react-tailwind my-app

# React with Material-UI
npx rtg-template react-material-ui my-app

# React with Styled Components
npx rtg-template react-styled-components my-app

# React with TypeScript (pre-built template)
npx rtg-template react-ts my-app

# React with Tailwind + TypeScript (pre-built template)
npx rtg-template react-tailwind-ts my-app

# Next.js app with authentication
npx rtg-template next my-next-app --auth --typescript

# Node.js app with MongoDB
npx rtg-template node-api my-api --mongodb --typescript

# NestJS with Prisma and PostgreSQL
npx rtg-template nestjs my-nest-app --prisma --postgres

Custom Repository

# Use a custom template repository
npx rtg-template react my-app --repo username/my-custom-template

CLI Options ๐Ÿ› ๏ธ

OptionDescriptionExample
-t, --typescriptAdd TypeScript support--typescript
--tailwindAdd Tailwind CSS--tailwind
--authAdd authentication setup--auth
--prismaAdd Prisma ORM--prisma
--mongodbAdd MongoDB support--mongodb
--mysqlAdd MySQL support--mysql
--postgresAdd PostgreSQL support--postgres
-i, --interactiveRun in interactive mode--interactive
-d, --directory <dir>Output directory--directory ./projects
--repo <repository>Custom template repository--repo org/template
--no-installSkip dependency installation--no-install
--no-gitSkip git initialization--no-git

๐Ÿ“š Complete Command Reference

Main Command

npx rtg-template <template> <project-name> [options]

Available Commands

CommandDescriptionExample
rtg-template --helpShow help informationnpx rtg-template --help
rtg-template --versionShow versionnpx rtg-template --version
rtg-template listList all available templatesnpx rtg-template list
rtg-template lsAlias for list commandnpx rtg-template ls
rtg-template interactiveRun in interactive modenpx rtg-template interactive
rtg-template iAlias for interactive modenpx rtg-template i

Template-Specific Commands

React Templates

# Basic React with Vite
npx rtg-template react my-app

# React with TypeScript
npx rtg-template react my-app --typescript

# React with Tailwind CSS
npx rtg-template react my-app --tailwind

# React with Redux Toolkit
npx rtg-template react my-app --redux-toolkit

# React with multiple options
npx rtg-template react my-app --typescript --tailwind --redux-toolkit

# Pre-built React templates
npx rtg-template react-tailwind my-app
npx rtg-template react-material-ui my-app
npx rtg-template react-styled-components my-app
npx rtg-template react-ts my-app
npx rtg-template react-tailwind-ts my-app

Full-Stack Templates

# Next.js
npx rtg-template next my-next-app
npx rtg-template next my-next-app --auth --typescript

# Node.js API
npx rtg-template node-api my-api
npx rtg-template node-api my-api --mongodb --typescript
npx rtg-template node-api my-api --postgres --auth

# NestJS
npx rtg-template nestjs my-nest-app
npx rtg-template nestjs my-nest-app --prisma --postgres

# FastAPI
npx rtg-template fastapi my-api
npx rtg-template fastapi my-api --mysql

Advanced Options

# Custom output directory
npx rtg-template react my-app --directory /path/to/projects

# Skip dependency installation
npx rtg-template react my-app --no-install

# Skip git initialization
npx rtg-template react my-app --no-git

# Use custom template repository
npx rtg-template react my-app --repo username/my-custom-template

# Interactive mode
npx rtg-template --interactive

๐Ÿš€ Deployment Guide

Publishing to npm

1. Prepare for Publishing

# Ensure you're logged in to npm
npm login

# Check your package.json
cat package.json

# Build the project
npm run build

# Test the build locally
node dist/cli.js --help

2. Version Management

# Update version (patch, minor, or major)
npm version patch  # 1.0.0 -> 1.0.1
npm version minor  # 1.0.1 -> 1.1.0
npm version major  # 1.1.0 -> 2.0.0

# Or manually update in package.json
# "version": "1.0.0"

3. Publishing

# Publish to npm
npm publish

# For scoped packages (if using @your-org/rtg-template)
npm publish --access public

4. Verify Publication

# Check if package is published
npm view rtg-template

# Test the published package
npx rtg-template --version

Pre-publishing Checklist

  • All tests pass
  • Build is successful (npm run build)
  • Version is updated in package.json
  • README.md is up to date
  • All templates are working
  • CLI commands are tested
  • No sensitive information in the package

Post-publishing

# Tag the release in git
git tag v1.0.0
git push origin v1.0.0

# Create a GitHub release (optional)
# Go to GitHub and create a new release with the tag

๐Ÿงช Local Testing Guide

# 1. Build your project
npm run build

# 2. Create a global symlink
npm link

# 3. Test the command globally
rtg-template --help
rtg-template list
rtg-template react-tailwind my-test-app

# 4. When done testing, unlink
npm unlink

Method 2: Direct Node Execution

# Test directly with node
node dist/cli.js --help
node dist/cli.js list
node dist/cli.js react-tailwind my-test-app

Method 3: Using npx with Local Path

# Test with npx pointing to your local directory
npx . react-tailwind my-test-app
npx . list
npx . --help

Method 4: Development Mode with tsx

# Run directly from TypeScript source (for development)
npm run dev react-tailwind my-test-app
npm run dev list
npm run dev --help

Method 5: Install Globally for Testing

# Install your package globally for testing
npm install -g .

# Test globally
rtg-template --help
rtg-template list
rtg-template react-tailwind my-test-app

# Uninstall when done
npm uninstall -g rtg-template

Development Workflow

# 1. Set up the link once
npm link

# 2. During development, just rebuild and test
npm run build
rtg-template list

# 3. Test different templates
rtg-template react-tailwind test-app1
rtg-template react-material-ui test-app2
rtg-template react-styled-components test-app3

# 4. Clean up test projects
rm -rf test-app1 test-app2 test-app3

# 5. When done developing, unlink
npm unlink

Testing Checklist

Basic Commands

  • rtg-template --help
  • rtg-template --version
  • rtg-template list

Template Creation

  • rtg-template react-tailwind my-app
  • rtg-template react-material-ui my-app
  • rtg-template react-styled-components my-app
  • rtg-template react-tailwind-ts my-app

Options Testing

  • rtg-template react my-app --typescript
  • rtg-template react my-app --tailwind
  • rtg-template react my-app --redux-toolkit
  • rtg-template react my-app --typescript --tailwind --redux-toolkit

Interactive Mode

  • rtg-template --interactive

Project Verification

  • Check if all files are created correctly
  • Verify dependencies are installed
  • Test if the project runs (npm run dev)

Commands ๐Ÿ“

Create Project

rtg-template <template> <project-name> [options]

List Templates

rtg-template list
# or
rtg-template ls

Interactive Mode

rtg-template interactive
# or
rtg-template i

Template Structure ๐Ÿ—๏ธ

Templates can include the following features:

Template Variables

Templates support variable replacement:

  • {{PROJECT_NAME}} - Project name in uppercase
  • {{project-name}} - Project name in lowercase
  • {{Project Name}} - Project name in title case

Post-Install Configuration

Templates can include a post-install configuration in the registry:

{
  postInstall: {
    dependencies: ['react', 'react-dom'],
    devDependencies: ['@vitejs/plugin-react', 'vite'],
    envTemplate: 'PORT=3000\nNODE_ENV=development\n',
    scripts: ['npm run build'],
    instructions: 'Run `npm run dev` to start development server.'
  }
}

Development ๐Ÿ”ง

Setup

# Clone the repository
git clone https://github.com/your-org/rtg-template.git
cd rtg-template

# Install dependencies
npm install

# Build the project
npm run build

# Run in development mode
npm run dev <template> <project-name>

Project Structure

src/
โ”œโ”€โ”€ cli.ts              # Main CLI entry point
โ”œโ”€โ”€ commands/           # CLI commands
โ”‚   โ”œโ”€โ”€ create.ts      # Project creation logic
โ”‚   โ”œโ”€โ”€ list.ts        # Template listing
โ”‚   โ””โ”€โ”€ interactive.ts # Interactive mode
โ”œโ”€โ”€ core/              # Core functionality
โ”‚   โ”œโ”€โ”€ template-engine.ts  # Template processing
โ”‚   โ”œโ”€โ”€ registry.ts         # Template registry
โ”‚   โ””โ”€โ”€ post-install.ts     # Post-install hooks
โ”œโ”€โ”€ utils/             # Utility functions
โ”‚   โ””โ”€โ”€ validation.ts  # Input validation
โ””โ”€โ”€ types.ts           # TypeScript types

Adding New Templates

  • Add to Registry: Update src/core/registry.ts with your template configuration
  • Create Template: Add your template files to the templates/ directory or use an external repository
  • Test: Run the CLI with your new template

Example template configuration:

'my-template': {
  name: 'my-template',
  description: 'My awesome template',
  repository: 'github-user/my-template-repo',
  frameworks: ['React', 'Express'],
  addons: ['typescript', 'tailwind'],
  postInstall: {
    dependencies: ['express'],
    instructions: 'Run `npm start` to begin!'
  }
}

Contributing ๐Ÿค

  • Fork the repository
  • Create a feature branch: git checkout -b feature/amazing-feature
  • Commit your changes: git commit -m 'Add amazing feature'
  • Push to the branch: git push origin feature/amazing-feature
  • Open a Pull Request

Guidelines

  • Add tests for new features
  • Update documentation for any API changes
  • Follow the existing code style
  • Ensure all tests pass

Custom Templates ๐ŸŽจ

You can use custom templates from any Git repository:

# GitHub shorthand
npx rtg-template react my-app --repo username/my-react-template

# Full Git URL
npx rtg-template react my-app --repo https://github.com/username/my-react-template

Template Repository Structure

your-template-repo/
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ index.js
โ”œโ”€โ”€ .env.example
โ””โ”€โ”€ .get-template.js  # Optional custom post-install script

Troubleshooting ๐Ÿ”

Common Issues

Template not found

  • Check available templates with npx rtg-template list
  • Verify the template name spelling

Permission errors

  • Try running with sudo on Unix systems
  • Check directory permissions

Git errors

  • Ensure Git is installed and configured
  • Check network connectivity for remote repositories

Dependency installation fails

  • Check your internet connection
  • Try with --no-install flag and install manually

License ๐Ÿ“„

MIT ยฉ [Your Name]

Support ๐Ÿ’ฌ

  • ๐Ÿ“ง Email: support@rtg-template.dev
  • ๐Ÿ› Issues: GitHub Issues
  • ๐Ÿ’ฌ Discussions: GitHub Discussions

Made with โค๏ธ by the RTG Template team

Keywords

cli

FAQs

Package last updated on 29 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts