JK Docs
System Admin

Coolify Deployment & Data Persistence

Last updated: 4/23/2026

Best Practices for SQLite & Persistent Volumes

When deploying this platform on Coolify using a persistent SQLite database, certain rules must be followed to avoid data loss or "Module Not Found" errors.

1. Persistent Volumes

The database is located at /app/prisma/dev.db. In Coolify, you must mount a persistent volume at /app/prisma.

2. The Volume Mount Pitfall

When you mount a volume at /app/prisma, it hides all files in that directory that were part of the Docker image (like schema.prisma).

  • Solution: We moved the migration scripts to a separate /app/scripts directory.
  • Startup Logic: Our start.sh automatically restores the schema file and runs migrations on the volume at every startup.

3. Build vs Runtime

  • Build Phase: Prisma generate and a temporary DB push are run to allow Next.js page pre-rendering.
  • Runtime Phase: The actual database migration happens when the container starts, ensuring your server's data is never overwritten by the build.
JK Docs
New Guide

Categories

DevOpsBackendFrontendDatabaseToolsSecurityDesignSystem Admin
Admin Panel