# First Deployment

> Deploy your first application on Nimbuz from GitHub, GitLab or a ZIP file: choose a deployment type, set environment variables, connect a database, monitor and scale.

Deploy your first application to Nimbuz in minutes. This guide walks you through the process of deploying your application on the Nimbuz platform.

## Prerequisites

Before deploying, ensure you have:

- Nimbuz account set up and verified
- Project created with environment configured
- Application code ready to deploy (GitHub, GitLab, or ZIP file)

## Accessing Deployments

You have two ways to access the Applications page:

### Option A: Click Proceed

1. Choose your project
2. Click the **Proceed** button at the bottom right of the Projects page

### Option B: Navigate to Applications

1. From the sidebar on the left, navigate to **Applications**

*Both options will take you to the same Applications page*

![Deployments Page](https://docs.nimbuz.tech/img/onboarding/image018.png)

## Create New Applications

Click **"+ New Applications"** button on the right side of the Applications screen.

![New Deployment](https://docs.nimbuz.tech/img/onboarding/image019.png)

## Choose Deployment Type

Click the dropdown labeled **"Choose a type to continue."**

You have three deployment options based on where your codebase is hosted:

![Deployment Type Selection](https://docs.nimbuz.tech/img/onboarding/image020.png)

1. **Deploy from GitHub repo**
2. **Deploy from GitLab repo**  
3. **Deploy zip**

### Deploy from GitHub Repository

Enter your GitHub credentials to connect to your GitHub account. After authorizing Nimbuz, your branches and repositories will be loaded automatically.

![GitHub Deployment](https://docs.nimbuz.tech/img/onboarding/image021.png)

### Deploy from GitLab Repository

Enter your GitLab credentials to connect to your GitLab account. After authorizing Nimbuz, your branches and repositories will be loaded automatically.

![GitLab Deployment](https://docs.nimbuz.tech/img/onboarding/image022.png)

### Deploy from ZIP/TAR

Browse and select ZIP or TAR file (maximum size: 500 MB) from local device. Then, click **Submit**.

![ZIP Deployment](https://docs.nimbuz.tech/img/onboarding/image023.png)

## Deployment Parameters - General

After selecting one of the repository options mentioned above, fill in the following details:

- **Name** *(required)*: Usually auto-populated. Must contain only lowercase letters, numbers, and separators (., -). Uppercase letters and consecutive separators are not allowed.

- **Replicas**: The number of instances you want to run (e.g., 1).

- **Port**: The port your application listens on (e.g., 3000). Leave blank to use the default.

## Supported Application Types

### Static Sites

Perfect for:

- React, Vue, Angular applications
- Static site generators (Gatsby, Next.js, Nuxt.js)
- HTML/CSS/JavaScript sites

**Example Configuration:**

- Build Command: `npm run build`
- Output Directory: `dist` or `build`
- Node Version: 18.x

### Backend APIs

Ideal for:

- REST APIs
- GraphQL servers
- Microservices

**Example Configuration:**

- Start Command: `npm start`
- Port: 3000 (or your app's port)
- Health Check: `/health` endpoint

### Full-Stack Applications

Deploy complete applications:

- Next.js applications
- Nuxt.js applications
- Express.js with frontend

**Example Configuration:**

- Build Command: `npm run build`
- Start Command: `npm start`
- Port: 3000

## Environment Configuration

### Environment Variables

Add environment variables for your application:

1. Go to **Project Settings** → **Environment Variables**
2. Add key-value pairs
3. Mark sensitive variables as "Secret"
4. Redeploy your application

Common environment variables:

```bash
NODE_ENV=production
DATABASE_URL=your-database-url
API_KEY=your-api-key
PORT=3000
```

### Custom Domains

Connect your custom domain:

1. Go to **Project Settings** → **Domains**
2. Click **"Add Domain"**
3. Enter your domain name
4. Follow DNS configuration instructions
5. SSL certificate is automatically provisioned

## Database Setup

Add a database to your application:

### PostgreSQL Database

1. Go to **Resources** → **Databases**
2. Click **"Create Database"**
3. Select **PostgreSQL**
4. Choose your plan and region
5. Database connection details will be provided

### MongoDB Database

1. Select **MongoDB** from database options
2. Configure cluster size and region
3. Get connection string for your application

### MySQL Database
1. Select **MySQL** from database options
2. Configure storage and instance type
3. Set your root password and custom database name

### MSSQL Database
1. Select **MSSQL** from database options
2. Choose your instance specifications
3. Configure administrative credentials

### n8n Workflow Automation
1. Select **n8n** from the tools section
2. Configure instance type
3. Access n8n using the provided URL

### RabbitMQ Message Broker
1. Select **RabbitMQ** for messaging and queuing
2. Set up your administrative user and password
3. Use the provided connection details in your app

## Monitoring Your Deployment

### Build Logs

Monitor your deployment:

- Real-time build logs during deployment
- Error messages and warnings
- Build duration and optimization tips

### Application Logs

View runtime logs:

1. Go to **Project** → **Logs**
2. Filter by log level (error, warn, info)
3. Search specific log messages
4. Export logs for analysis

### Performance Metrics

Track application performance:

- Response times
- Request volume
- Error rates
- Resource usage

## Scaling Your Application

### Automatic Scaling

Nimbuz automatically scales based on traffic:

- **Scale Up**: More instances during high traffic
- **Scale Down**: Fewer instances during low traffic
- **Custom Metrics**: Scale based on specific metrics

### Manual Scaling

Override automatic scaling:

1. Go to **Project Settings** → **Scaling**
2. Set minimum and maximum instances
3. Configure scaling triggers
4. Apply changes

## Common Deployment Issues

### Build Failures

**Node.js Version Mismatch**

```bash
# Specify Node.js version in package.json
{
  "engines": {
    "node": "18.x"
  }
}
```

**Missing Dependencies**

- Ensure all dependencies are in `package.json`
- Check for missing environment variables
- Verify build commands are correct

### Runtime Errors

**Port Configuration**

```javascript
// Use environment port or default
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(`Server running on port ${PORT}`);
});
```

**Database Connection Issues**

- Verify database connection string
- Check network connectivity
- Ensure database is accessible from Nimbuz

## Best Practices

### Performance Optimization

- Use build optimization flags
- Enable gzip compression
- Optimize images and assets
- Implement caching strategies

### Security

- Use environment variables for secrets
- Enable HTTPS (automatic with custom domains)
- Implement proper authentication
- Regular security updates

### Monitoring

- Set up health checks
- Configure alerting
- Monitor application metrics
- Log important events

## Next Steps

Congratulations on your first deployment! Now you can:

1. [Learn about resource management](./resource-management)
2. [Configure networking and custom domains](./deployment-guide#networking-configuration)
3. [Monitor costs and workloads on the dashboard](./dashboard)

## Getting Help

Need assistance with deployment?

- Check the [deployment troubleshooting section](./deployment-guide#troubleshooting)
- Contact support: [info@dilligentech.com](mailto:info@dilligentech.com)

Source: https://docs.nimbuz.tech/onboarding/first-deployment
