TaxHacker Configuration Files: Complete Location and Usage Guide
TaxHacker configuration files are centralized in lib/config.ts for runtime settings, with environment variables defined in .env.example and framework-specific configurations handled by next.config.ts, sentry.edge.config.ts, and sentry.server.config.ts in the vas3k/TaxHacker repository.
The vas3k/TaxHacker open-source tax management application organizes settings across a strongly-typed configuration system and environment-specific files. Understanding where these TaxHacker configuration files reside is essential for customizing deployments, managing secrets, and extending the application's functionality.
Core Runtime Configuration
The Central Config Module (lib/config.ts)
All runtime configuration flows through Zod validation in lib/config.ts. This module reads process.env variables, validates them against a strict schema, and exports a strongly-typed config object. It handles app versioning, API keys, feature flags, and service URLs. Every other module imports this singleton rather than accessing environment variables directly, ensuring type safety and centralized validation.
Environment Variable Template (.env.example)
The .env.example file serves as the reference for required environment variables. It documents fields including DATABASE_URL, NEXT_PUBLIC_SENTRY_DSN, and UPLOAD_PATH. Developers copy this template to .env and populate it with deployment-specific values that lib/config.ts subsequently validates at application startup.
Framework and Infrastructure Configuration
Next.js Build Settings (next.config.ts)
The next.config.ts file manages Next.js compiler settings and runtime behavior. It conditionally enables Sentry integration when related environment variables exist and forwards selected environment variables to the client side, bridging server secrets and browser runtime.
Sentry Error Tracking Configuration
Error monitoring splits across runtime environments:
sentry.edge.config.ts: Initializes Sentry for edge runtime with DSN, tracing, and release management.sentry.server.config.ts: Configures Node.js runtime Sentry initialization for server-side error tracking.
Both files consume DSN values from the central configuration but initialize separately for their respective execution contexts.
Data and Storage Configuration
Database Schema (prisma/schema.prisma)
Database structure declarations live in prisma/schema.prisma. While this file defines table schemas and relationships, the actual connection string comes from DATABASE_URL, which is validated by lib/config.ts and passed to the Prisma client.
File Upload Paths (lib/files.ts)
File handling configuration resides in lib/files.ts. This module imports config.uploadPath from the central configuration object—validated from process.env.UPLOAD_PATH—and resolves the absolute directory path for document uploads using Node.js path resolution.
How Configuration Flows Through the Application
Accessing the Typed Config Object
Import the validated configuration singleton to check service availability:
import { config } from '@/lib/config';
if (config.isSentryEnabled) {
// Sentry initializes separately in sentry.*.config.ts,
// but use this flag to guard optional monitoring logic.
}
Configuring Database Connections
Pass the validated database URL to Prisma using the central config:
import { PrismaClient } from '@prisma/client';
import { config } from '@/lib/config';
const prisma = new PrismaClient({
datasources: { db: { url: config.databaseUrl } },
});
Resolving Upload Directories
Use the configuration object to determine file storage locations:
import { config } from '@/lib/config';
import path from 'path';
const uploadDir = path.resolve(config.uploadPath);
// Use `uploadDir` when persisting uploaded tax documents.
Checking Feature Flags
Gate beta functionality using strongly-typed flags defined in the schema:
import { config } from '@/lib/config';
if (config.featureFlags.enableBeta) {
// Render experimental tax calculation UI components.
}
Summary
lib/config.ts: Central, type-safe configuration loader using Zod schema validation..env.example: Template documenting all required environment variables.next.config.ts: Next.js build-time settings and client-side environment forwarding.sentry.edge.config.tsandsentry.server.config.ts: Runtime-specific error monitoring initialization.prisma/schema.prisma: Database schema definition (connection string comes from central config).lib/files.ts: Upload path resolution using the validatedconfig.uploadPathvalue.
Frequently Asked Questions
Where is the main configuration file in TaxHacker?
The primary configuration logic resides in lib/config.ts. This TypeScript file validates all environment variables using Zod and exports a typed config object that the entire application imports. It acts as the single source of truth for settings like database URLs, API keys, and feature flags.
How do I set up environment variables for TaxHacker?
Copy .env.example to .env and fill in the required values including DATABASE_URL, UPLOAD_PATH, and optional Sentry DSN strings. The lib/config.ts module loads and validates these variables at runtime, throwing errors if required fields are missing or malformed.
What is the purpose of the Sentry configuration files?
TaxHacker splits Sentry error monitoring across two files: sentry.edge.config.ts handles edge runtime initialization for middleware and edge API routes, while sentry.server.config.ts configures the Node.js runtime for traditional server components. Both read DSN values from the central config but initialize separately for their respective environments.
How does TaxHacker handle file upload configuration?
File upload paths are configured through the UPLOAD_PATH environment variable, validated in lib/config.ts, and consumed by lib/files.ts. The files module resolves the absolute path using Node.js path.resolve(), ensuring consistent directory handling across different deployment environments.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →