0.4.111 • Published 10 months ago

@api-buddy/cli v0.4.111

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

@api-buddy/cli

Command Line Interface for API Buddy, providing utilities for scaffolding and managing API Buddy projects with ease.

šŸš€ Current Status

āœ… Implemented

  • Basic project scaffolding with init command
  • Interactive project setup with prompts
  • TypeScript configuration
  • Basic project structure generation
  • Package manager detection (npm, yarn, pnpm)

🚧 In Progress

  • generate command implementation
  • File watching and hot reload
  • Plugin system integration
  • Database integration (Prisma)

Features

  • šŸš€ Project Initialization: Scaffold new API Buddy projects with modern setup
  • āš™ļø Interactive Setup: Guided project configuration
  • šŸ“¦ Package Management: Works with npm, Yarn, and pnpm
  • šŸ”„ TypeScript Ready: Pre-configured TypeScript support
  • šŸ—ļø Modular Architecture: Built for extensibility

Installation

# Using npm
npm install -g @api-buddy/cli

# Using Yarn
yarn global add @api-buddy/cli

# Using pnpm
pnpm add -g @api-buddy/cli

Quick Start

Initialize a New Project

api-buddy init my-api
cd my-api

This will guide you through an interactive setup process where you can:

  • Choose your preferred package manager
  • Select a database (PostgreSQL, MySQL, MongoDB, or SQLite)
  • Set up authentication (JWT, OAuth, or none)
  • Configure TypeScript settings
  • Install dependencies automatically

Start Development Server

api-buddy dev

This will start the development server with hot-reloading enabled.

Available Commands

init [directory]

Initialize a new API Buddy project in the specified directory (or current directory if not specified).

Options:

  • --use-npm: Use npm as the package manager
  • --use-yarn: Use Yarn as the package manager
  • --use-pnpm: Use pnpm as the package manager

generate

Generate code from schema definitions.

Options:

  • -w, --watch: Watch for changes and regenerate automatically
  • -o, --out-dir <dir>: Output directory (default: .api-buddy)
  • -s, --schema <file>: Path to schema file (default: api-buddy.config.ts)

dev

Start the development server.

build

Build the project for production.

test

Run tests.

Project Structure

A typical API Buddy project structure looks like this:

my-api/
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ config/       # Configuration files
│   ā”œā”€ā”€ models/       # Data models
│   ā”œā”€ā”€ routes/       # API routes
│   └── services/     # Business logic
ā”œā”€ā”€ .env              # Environment variables
ā”œā”€ā”€ .env.example      # Example environment variables
ā”œā”€ā”€ package.json      # Project dependencies and scripts
└── tsconfig.json     # TypeScript configuration

Configuration

Create an api-buddy.config.ts file in your project root to customize the CLI behavior. Here's an example configuration:

import { defineConfig } from '@api-buddy/core';

export default defineConfig({
  server: {
    port: 3000,
    host: '0.0.0.0',
  },
  database: {
    client: 'postgresql',
    connection: {
      host: process.env.DB_HOST,
      port: process.env.DB_PORT,
      database: process.env.DB_NAME,
      user: process.env.DB_USER,
      password: process.env.DB_PASSWORD,
    },
  },
  // ... other configurations
});

Plugins

API Buddy supports a rich plugin ecosystem. You can add plugins to extend functionality:

// api-buddy.config.ts
export default defineConfig({
  plugins: [
    // Add plugins here
  ],
});

Contributing

Contributions are welcome! Please read our contributing guidelines to get started.

License

MIT

0.4.111

10 months ago

0.4.109

10 months ago

0.4.108

10 months ago

0.4.107

10 months ago

0.4.106

10 months ago

0.0.4

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago