Privacy-Focused-Web-Analytics-Dashboard

File Organization Strategy

← Back to README Documentation Index Project Structure

Overview

The project has been organized to keep the root directory clean while maintaining functionality and proper tool auto-discovery.

Why Some Config Files Stay at Root

Auto-Discovery Requirement

Certain tools expect configuration files to be at the project root for auto-discovery:

PostCSS (postcss.config.js):

Tailwind (tailwind.config.ts):

Files Organized in /config

These files are moved to /config because they’re explicitly referenced in commands:

Files Remaining at Root

These must stay at root for proper tool integration:

Updated npm Scripts

{
  "dev": "vite --config config/vite.config.ts",
  "build:client": "vite build --config config/vite.config.ts",
  "build:server": "vite build --config config/vite.config.server.ts"
}

By explicitly specifying the config file path, we can keep Vite configs organized in /config while allowing PostCSS and Tailwind to remain at the root where they’re auto-discovered.

File Count Reduction

Root Directory Files (kept minimal)

/config Directory

Result

Root directory is significantly cleaner with core build configs organized in /config while maintaining full functionality.

Best Practices Applied

  1. Separation of Concerns: Build configs in /config, tools that auto-discover at root
  2. Explicit Over Implicit: Using --config flag makes dependencies clear
  3. Minimal Root: Only essential files in project root
  4. Tool Compatibility: Respecting auto-discovery requirements of build tools
  5. Documentation: Clear explanation of why files are where they are

Future Expansion

If the project grows and more Vite plugins are added:

Troubleshooting

If Tailwind CSS styles aren’t loading:

  1. Verify tailwind.config.ts is in the root directory
  2. Verify postcss.config.js is in the root directory
  3. Check that content path in tailwind.config.ts correctly points to client files: ["./client/**/*.{ts,tsx}"]
  4. Restart the dev server: pnpm dev

If Shadcn/ui components can’t be added:

  1. Verify components.json is in the root directory
  2. Verify paths in components.json point to correct locations