Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Aking16/timify/llms.txt

Use this file to discover all available pages before exploring further.

Because Timify stores all data in a local SQLite file, self-hosting is intentionally straightforward — there is no managed database to provision and no external service to authenticate against. The sections below cover everything you need to take Timify from a development checkout to a production deployment.

Environment Variables

The following environment variables are required in every production environment. Set them in your hosting platform’s secrets manager, a .env.production file (not committed to version control), or directly in your process environment.
VariableRequiredDescription
DB_FILE_NAMEPath to the SQLite file, e.g. file:/data/timify.db
BETTER_AUTH_SECRETLong random string used to sign session tokens
BETTER_AUTH_URLFull public URL of your deployment, e.g. https://timify.example.com
Never reuse your development BETTER_AUTH_SECRET in production. Generate a fresh secret with a cryptographically secure method:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Building and Starting the App

1
Create a production build
2
npm run build
3
Next.js compiles, optimises, and bundles the application into the .next directory. The React Compiler (reactCompiler: true) and component caching (cacheComponents: true) are both active during the build, so no extra flags are needed.
4
Run the production server
5
npm run start
6
The server listens on port 3000 by default. Use a reverse proxy (nginx, Caddy, Traefik) to terminate TLS and forward traffic to it.

SQLite File Persistence

Timify’s entire state lives in a single SQLite file. The path is controlled by the DB_FILE_NAME environment variable (default: file:./src/db/local.db).
If your hosting environment uses ephemeral or read-only filesystems — such as most serverless platforms, container registries, or PaaS build images — the SQLite file will be lost on every restart unless you mount a persistent volume.
Choose a path that is outside the application directory (e.g. /data/timify.db rather than ./src/db/local.db) so that redeploying or rebuilding the application cannot accidentally shadow or overwrite the database file.

Applying the Database Schema in Production

Before starting the app for the first time (and after any schema change), apply the Drizzle schema to your SQLite file.

Authentication Configuration

Secure cookies

The useSecureCookies flag in src/lib/auth.ts is currently set to false for local development over plain HTTP. In production you must serve Timify over HTTPS and set this to true to ensure session cookies carry the Secure attribute.
src/lib/auth.ts (production change required)
advanced: {
  crossSubDomainCookies: {
    enabled: true,
  },
  useSecureCookies: true, // ← change from false to true for HTTPS production
},

Trusted origins

The trustedOrigins array in src/lib/auth.ts controls which origins better-auth will accept requests from. You must add your production domain to this list, otherwise authentication requests from your public URL will be rejected.
src/lib/auth.ts
trustedOrigins: [
  process.env.BETTER_AUTH_URL || "http://localhost:3000",
  "https://timify.example.com", // ← add your production domain
],
BETTER_AUTH_URL is automatically included in trustedOrigins at runtime via process.env.BETTER_AUTH_URL, so setting the environment variable correctly is sufficient — you only need to hard-code additional origins (e.g. a secondary domain or a local network address) if required.

Deploying to Vercel

Timify was bootstrapped with create-next-app and targets Vercel’s build pipeline out of the box. You can deploy directly from the repository:
  1. Import the repository in the Vercel dashboard.
  2. Add the three required environment variables (DB_FILE_NAME, BETTER_AUTH_SECRET, BETTER_AUTH_URL) under Project → Settings → Environment Variables.
  3. Vercel will run npm run build automatically on every push.
Vercel’s serverless and edge runtimes use ephemeral filesystems. A SQLite file written to the local disk will not persist across function invocations. Timify is designed for self-hosted environments with a persistent local filesystem (a VPS, dedicated server, or container with a mounted volume). Deploying to Vercel without persistent storage is not supported.

Production Checklist

  • BETTER_AUTH_SECRET is a fresh, strong random string
  • BETTER_AUTH_URL is set to your full production URL (including https://)
  • useSecureCookies is set to true in src/lib/auth.ts
  • Your production domain is present in trustedOrigins
  • The SQLite file is on a persistent volume or persistent storage
  • npx drizzle-kit push has been run against the production database
  • A TLS certificate is in place and HTTP redirects to HTTPS
  • The .env file (or secrets) are not committed to version control

Build docs developers (and LLMs) love