# Developer Guide

> Integrate with ZopNight's REST API to manage cloud resource schedules, discover resources, track costs, and automate start/stop operations across AWS, GCP, and Azure.

Source: https://zop.dev/developer-docs/overview/introduction

---

Integrate with ZopNight's REST API to manage cloud resource schedules, discover resources, track costs, and automate start/stop operations across AWS, GCP, and Azure.

{/* Quick links */}
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(250px, 1fr))', gap: '1rem', marginBottom: '3rem' }}>
  {[
    { to: '/docs/getting-started', title: 'Getting Started', desc: 'Set up authentication and make your first API call' },
    { to: '/docs/cloud-accounts', title: 'Cloud Accounts', desc: 'Connect your AWS, GCP, or Azure accounts' },
    { to: '/docs/schedules', title: 'Schedules', desc: 'Create automated start/stop schedules for resources' },
    { to: '/docs/api-reference', title: 'API Reference', desc: 'Complete endpoint reference for all APIs' },
  ].map((card) => (
    <a key={card.to} href={card.to} className="link-card">
      <h3>{card.title}</h3>
      <p>{card.desc}</p>
    </a>
  ))}
</div>

## How It Works

ZopNight follows a discover-schedule-execute pattern across your cloud infrastructure.

<div style={{ display: 'flex', flexDirection: 'column', gap: '1.25rem', marginBottom: '2.5rem' }}>
  {[
    { step: '1', title: 'Connect Cloud Accounts', desc: 'Provide credentials for your AWS, GCP, or Azure accounts. ZopNight supports multiple authentication methods per provider.' },
    { step: '2', title: 'Discover Resources', desc: 'ZopNight automatically discovers VMs, databases, Kubernetes clusters, serverless functions, and more across all connected accounts.' },
    { step: '3', title: 'Create Schedules', desc: 'Define cron-based schedules to automatically start and stop resources. Attach individual resources or groups for organized management.' },
    { step: '4', title: 'Execute & Monitor', desc: 'The scheduler evaluates crons every minute and executes start/stop actions. Track state history, cost savings, and get optimization recommendations.' },
  ].map((item) => (
    <div key={item.step} style={{ display: 'flex', gap: '1rem', alignItems: 'flex-start' }}>
      <span className="step-number">{item.step}</span>
      <div>
        <strong>{item.title}</strong>
        <p style={{ marginTop: '0.25rem', marginBottom: 0 }}>{item.desc}</p>
      </div>
    </div>
  ))}
</div>

## Architecture Overview

All API requests go through a gateway that handles authentication and routes to the appropriate backend service.

```plaintext
Client (Your App)
    │
    ▼
┌──────────┐     JWT validation, org context injection
│  Gateway  │─────────────────────────────────────────
└──────────┘
    │
    ├──► Config        Schedules, Groups, Overrides, Cloud Accounts,
    │                  Projects, Environments, Deployments, Spaces
    ├──► Discoverer    Resource discovery across cloud providers
    ├──► Executor      Start/stop execution, state history
    ├──► Aggregator    Cost reports, trends, budgets
    ├──► Recommender   Optimization recommendations, smart tags
    ├──► Deployer      Build, revision, rollback, events, loadbalancer
    └──► Provisioner   Cluster/datastore/component provisioning + auto-remediation
```

## Key Concepts

| Concept | Description |
|---|---|
| **Cloud Account** | A connected AWS, GCP, or Azure account with credentials for resource access |
| **Resource** | A discovered cloud resource (VM, database, cluster, etc.) that can be managed |
| **Schedule** | A set of cron-based rules that define when resources should be started or stopped |
| **Resource Group** | A logical collection of resources that can be scheduled together with execution ordering |
| **Override** | A temporary force-on or force-off that takes precedence over schedules |
| **Action** | A start or stop operation executed against a cloud resource |
| **Recommendation** | A cost optimization suggestion based on resource usage analysis |

## Cloud Provider Support

ZopNight supports resource discovery and scheduling across three major cloud providers.

<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(180px, 1fr))', gap: '1rem', marginBottom: '1.5rem' }}>
  {[
    { name: 'AWS', cls: 'provider-card-aws', resources: '64 resource types', exec: '16 executable' },
    { name: 'GCP', cls: 'provider-card-gcp', resources: '37 resource types', exec: '7 executable' },
    { name: 'Azure', cls: 'provider-card-azure', resources: '53 resource types', exec: '8 executable' },
  ].map((p) => (
    <div key={p.name} className={`provider-card ${p.cls}`}>
      <h3 style={{ margin: '0 0 0.5rem 0', fontSize: '1.1rem', borderBottom: 'none', paddingBottom: 0 }}>{p.name}</h3>
      <p style={{ margin: '0.125rem 0', fontSize: '0.85rem' }}>{p.resources}</p>
      <p style={{ margin: '0.125rem 0', fontSize: '0.85rem' }}>{p.exec}</p>
    </div>
  ))}
</div>

See the full [Cloud Support Matrix](https://zop.dev/docs/cloud-support) for details on supported resource types.
