The Apito CLI is a powerful command-line tool that allows you to create, manage, and deploy GraphQL and REST API projects from your terminal. This open source tool streamlines your development workflow and enables rapid API building with our API builder platform.
npm install -g @apito/cli
curl -fsSL https://get.apito.io/install.sh | bash
apito --version
You should see the installed version of the Apito CLI.
First, authenticate with your Apito account:
apito login
This will open your browser to authenticate with your Apito account. Once authenticated, you'll be able to create and manage projects from the command line.
Create a new API builder project:
apito create my-project
This command will:
cd my-project
Launch the local development environment:
apito dev
This will start a local development server where you can:
# List all your projects
apito projects
# Get project details
apito project info
# Switch between projects
apito project switch <project-id>
# Connect to a database
apito db connect <connection-string>
# Generate API from existing database
apito db generate-api
# Run database migrations
apito db migrate
# Seed the database with sample data
apito db seed
# Generate GraphQL schema from models
apito generate schema
# Create new API endpoints
apito create endpoint <endpoint-name>
# Deploy API changes
apito deploy
# Import content from external sources
apito content import <source>
# Export content for backup
apito content export
# Sync content between environments
apito content sync
Your project includes a apito.config.js
file for configuration:
module.exports = {
project: {
name: 'my-project',
version: '1.0.0'
},
database: {
provider: 'postgresql',
url: process.env.DATABASE_URL
},
api: {
graphql: {
playground: true,
introspection: true
},
rest: {
swagger: true,
cors: true
}
},
cms: {
media: {
provider: 'local',
maxSize: '10MB'
}
}
}
Create a .env
file in your project root:
# Database Configuration
DATABASE_URL=postgresql://user:password@localhost:5432/mydb
# API Configuration
API_SECRET=your-api-secret
JWT_SECRET=your-jwt-secret
# Media Storage
CLOUDINARY_URL=your-cloudinary-url
AWS_ACCESS_KEY_ID=your-aws-key
AWS_SECRET_ACCESS_KEY=your-aws-secret
# Deploy your project to Apito Cloud
apito deploy --production
# Generate deployment files
apito generate deployment
# Deploy with Docker
docker build -t my-apito-app .
docker run -p 4000:4000 my-apito-app
# Create a new plugin
apito plugin create <plugin-name>
# Install community plugins
apito plugin install <plugin-name>
# List installed plugins
apito plugin list
# Run API tests
apito test
# Generate test coverage report
apito test --coverage
# Run specific test suites
apito test --suite=integration
# View project logs
apito logs
# Monitor API performance
apito monitor
# Get project analytics
apito analytics
Authentication Problems:
# Re-authenticate
apito logout
apito login
Database Connection Issues:
# Test database connection
apito db test-connection
# Reset database configuration
apito db reset
Build Errors:
# Clear build cache
apito clean
# Rebuild project
apito build --force
# Show help for any command
apito help <command>
# Show all available commands
apito --help
# Get detailed command documentation
apito <command> --help
Now that you have the Apito CLI installed and configured:
apito dev
to start the development server and explore your GraphQL and REST API endpointsapito deploy
to make your API builder project liveFor more detailed documentation, visit our GitHub repository or explore the other documentation sections in this guide.
:::tip
The Apito CLI is continuously updated with new features. Keep your CLI updated by running npm update -g @apito/cli
regularly.
:::