Coolify Examples

repository·v4.x·Indexed 18 days ago

https://github.com/coollabsio/coolify-examples

A collection of deployment examples and framework-specific configurations for applications using Coolify. Includes setup guides for Astro (SSR and static), Bun, Elixir Phoenix, Flask, Laravel, NestJS, Next.js (SSR, SPA, and Prisma), and Nuxt, as well as reproduction cases for Docker Compose bind mounts and environment variable issues.

Tokens
50.4K
Snippets
194
Records
227
Agent score
63%

What's inside coolify-examples

  1. Overview of Coolify Examples

    v4.x
    The coollabsio/coolify-examples repository provides a collection of reference implementations and configuration examples for deploying various application types using Coolify. Developers can use these examples to understand how to structure and configure different frameworks and runtimes for successful deployment within the Coolify ecosystem.
  2. Understand the T3 Stack technologies

    v4.x

    This project is a T3 Stack application bootstrapped with create-t3-app. It utilizes a specific set of technologies to provide a type-safe full-stack development experience:

    • Next.js: The React framework for the frontend and API routes.
    • NextAuth.js: For authentication.
    • Prisma or Drizzle: Object-Relational Mappers (ORMs) for database interaction.
    • Tailwind CSS: For utility-first styling.
    • tRPC: For end-to-end type-safe APIs.
  3. Configure Vue SSR for Coolify

    v4.x

    To deploy a Vue SSR application using Coolify, ensure your configuration follows these two requirements:

    1. Build Pack: Use Nixpacks as the build pack.
    2. Port Mapping: Set the Ports Exposed setting in Coolify to 3000 (or whichever specific port your SSR server is configured to listen on).
  4. Configure Nuxt using Nixpacks

    v4.x

    To deploy a Nuxt application in Coolify using Nixpacks, follow these steps:

    1. Create a nixpacks.toml file in your project root to specify the Nixpacks configuration.
    2. In the Coolify dashboard, select Nixpacks as the Build Pack.
    3. Set Ports Exposed to 3000 (or your application's port).
    4. Set the Start Command to node .output/server/index.mjs.

    Tip: Instead of manually setting the Start Command in Coolify, you can add a start script to your package.json:

    "scripts": {
      "start": "node .output/server/index.mjs"
    }

    Nixpacks will automatically detect and use this command.

    [phases.setup]
    nixpkgsArchive = '51ad838b03a05b1de6f9f2a0fffecee64a9788ee'
  5. Install and run the Bun example

    v4.x

    To set up and execute this Bun-based example project, use the following commands:

    1. Install dependencies: Use bun install to fetch all required packages.
    2. Run the application: Execute the entry point using bun run index.ts.
    bun install
    bun run index.ts
  6. Configure Next.js SPA for static build in Coolify

    v4.x

    To deploy a Next.js Single Page Application (SPA) as a static site in Coolify, you must configure the deployment settings to use Nixpacks and point to the correct output directory. This ensures the application is served as a collection of static files rather than a running Node.js server.

    ### Coolify Configuration Settings
    - **Build Pack**: `nixpacks`
    - **Is it a static site?**: `Enabled`
    - **Output Directory**: `out`
  7. Configure Coolify for all NodeJS apps in a monorepo

    v4.x

    To deploy a monorepo containing multiple NodeJS applications using a single Coolify application, use the following settings:

    1. Build Pack: Set to nixpacks.
    2. Start Command: Set to npm run start (Note: replace npm with your specific package manager, e.g., pnpm or yarn, though Nixpacks typically detects this from your lock file).
    3. Ports Exposes: Set to 3000,3001.
  8. Configure Next.js SPA for static deployment in Coolify

    v4.x

    To deploy a Next.js Single Page Application (SPA) as a static site in Coolify, configure the following settings in your service configuration:

    1. Build Pack: Set this to nixpacks.
    2. Is it a static site?: Enable this option.
    3. Output Directory: Set this to out.

    This configuration ensures that Next.js performs a static export (using next export or the output: 'export' configuration in next.config.js) and that Coolify serves the resulting files from the out directory.

  9. Customize the flask-minimal application

    v4.x

    The flask-minimal project is designed for rapid prototyping with a single-file backend. You can customize the application by modifying the following files:

    • Backend Logic & Routes: Edit app.py to add new Flask routes or application logic.
    • HTML Structure: Modify templates/index.html to change the page layout.
    • Styling: Update static/style.css for visual changes.
    • Client-side Interactivity: Edit static/script.js to add JavaScript functionality.
  10. Configure a Vue SPA with Router for Coolify

    v4.x

    To deploy a Vue Single Page Application (SPA) using vue-router on Coolify, follow these configuration steps in the Coolify dashboard:

    1. Build Pack: Select Nixpacks.
    2. Static Site: Enable the Is it a static site? toggle.
    3. Publish Directory: Set the directory to /dist.

    For specific build details, refer to the vite.config.ts file in the repository.

  11. Build a specific package using filters

    v4.x

    To avoid building the entire monorepo, use the --filter flag to target a specific package or application (e.g., docs or web).

    # Build only the 'docs' package
    # With global turbo
    turbo build --filter=docs
    
    # Without global turbo
    npx turbo build --filter=docs
    yarn exec turbo build --filter=docs
    pnpm exec turbo build --filter=docs