Usage
Basic Usage
Learn how to use nuxt-coolify to interact with your Coolify instance.
Example
This guide demonstrates how to make API calls to your Coolify instance using Nuxt's useFetch
composable.
app/app.config.ts
export default defineAppConfig({
ui: {
colors: {
primary: 'sky',
colors: 'slate'
}
}
})
Fetching Instances
Here's a basic example of how to fetch your Coolify instances:
<script setup lang="ts">
const {
data: instances,
pending,
error,
refresh: refreshInstanceList
} = useFetch('/api/v1/coolify/instances')
</script>
<template>
<div>
<h2>Instances</h2>
<div v-if="pending">
Loading Instances...
</div>
<div v-else-if="error">
Error: {{ error.message }}
</div>
<div v-else>
<pre>{{ instances }}</pre>
</div>
<button @click="refreshInstanceList">
Refresh Instances
</button>
</div>
</template>
Server side in Nitro
Create a endpoint in Nitro like below to return the Coolify Instances using the server composables:
~/server/api/v1/coolify/instances/[name]/index.get.ts
import type { Instance } from 'nuxt-coolify'
export default defineEventHandler(async (event) => {
const name = getRouterParam(event, 'name')
const { instances } = useRuntimeConfig().coolify
// Do additional checks for user auth permissions here
return useCoolify().instances(name as Instance)
})
Available Endpoints
The module provides several helpers that map to Coolify's API. Here are the available helpers organized by category:
Core Coolify Utilities
useCoolify().instances()
- List all servers/instancesuseCoolify().healthcheck()
- Check instance healthuseCoolify().version()
- Get Coolify versionuseCoolify().enableAPI()
- Enable API accessuseCoolify().disableAPI()
- Disable API access
Applications
useCoolifyApplications().list()
- List all applicationsuseCoolifyApplications().create()
- Create new applicationuseCoolifyApplications().get()
- Get specific applicationuseCoolifyApplications().update()
- Update applicationuseCoolifyApplications().delete()
- Delete applicationuseCoolifyApplications().logs()
- Get application logsuseCoolifyApplications().listEnvs()
- List application environmentsuseCoolifyApplications().createEnv()
- Create environment variableuseCoolifyApplications().updateEnv()
- Update environment variableuseCoolifyApplications().updateEnvsBulk()
- Update multiple environment variablesuseCoolifyApplications().deleteEnv()
- Delete environment variableuseCoolifyApplications().start()
- Start applicationuseCoolifyApplications().stop()
- Stop applicationuseCoolifyApplications().restart()
- Restart application
Projects
useCoolifyProjects().list()
- List all projectsuseCoolifyProjects().create()
- Create new projectuseCoolifyProjects().get()
- Get specific projectuseCoolifyProjects().update()
- Update projectuseCoolifyProjects().delete()
- Delete projectuseCoolifyProjects().environment()
- Get project environment
Servers
useCoolifyServers().list()
- List all serversuseCoolifyServers().create()
- Create new serveruseCoolifyServers().get()
- Get specific serveruseCoolifyServers().update()
- Update serveruseCoolifyServers().delete()
- Delete serveruseCoolifyServers().resources()
- Get server resourcesuseCoolifyServers().domains()
- Get server domainsuseCoolifyServers().validate()
- Validate server configuration
Databases
useCoolifyDatabases().list()
- List all databasesuseCoolifyDatabases().get()
- Get specific databaseuseCoolifyDatabases().create()
- Create new databaseuseCoolifyDatabases().update()
- Update databaseuseCoolifyDatabases().delete()
- Delete databaseuseCoolifyDatabases().start()
- Start databaseuseCoolifyDatabases().stop()
- Stop databaseuseCoolifyDatabases().restart()
- Restart database
Services
useCoolifyServices().list()
- List all servicesuseCoolifyServices().create()
- Create new serviceuseCoolifyServices().get()
- Get specific serviceuseCoolifyServices().update()
- Update serviceuseCoolifyServices().delete()
- Delete serviceuseCoolifyServices().listEnvs()
- List service environmentsuseCoolifyServices().createEnv()
- Create service environment variableuseCoolifyServices().updateEnv()
- Update service environment variableuseCoolifyServices().updateEnvsBulk()
- Update multiple service environment variablesuseCoolifyServices().deleteEnv()
- Delete service environment variableuseCoolifyServices().start()
- Start serviceuseCoolifyServices().stop()
- Stop serviceuseCoolifyServices().restart()
- Restart service
Teams
useCoolifyTeams().list()
- List all teamsuseCoolifyTeams().get()
- Get specific teamuseCoolifyTeams().members()
- Get team membersuseCoolifyTeams().authenticatedTeam()
- Get current authenticated teamuseCoolifyTeams().authenticatedTeamMembers()
- Get current team members
Private Keys
useCoolifyPrivateKeys().list()
- List all private keysuseCoolifyPrivateKeys().create()
- Create new private keyuseCoolifyPrivateKeys().get()
- Get specific private keyuseCoolifyPrivateKeys().update()
- Update private keyuseCoolifyPrivateKeys().delete()
- Delete private key
Deployments
useCoolifyDeployments().list()
- List all deploymentsuseCoolifyDeployments().get()
- Get specific deploymentuseCoolifyDeployments().deploy()
- Trigger deployment
You can find the complete API documentation on Coolify's API Reference page.
Next Steps
Join the Coolify Discord community to get help, share your experience, and stay updated with the latest developments.