Environment Variables
The Inmobiliaria Web application uses Vite’s environment variable system. All client-side environment variables must be prefixed withVITE_.
API Configuration
VITE_API_URL
The base URL for the backend API.src/lib/api.ts:7-17):
- If
VITE_API_URLis set, it will be used - Otherwise, defaults to
http://localhost:10000/apiin both development and production
Creating Environment Files
Create a.env file in the project root:
Add
.env to your .gitignore to prevent committing sensitive configuration.Environment-Specific Files
Vite supports environment-specific files:.env- Loaded in all environments.env.local- Loaded in all environments, ignored by git.env.development- Development only.env.production- Production only
.env.[mode].local.env.[mode].env.local.env
Vite Configuration
The Vite build tool is configured invite.config.ts.
Current Configuration
Plugins
@tanstack/router-plugin
@tanstack/router-plugin
Automatically generates type-safe route definitions.Options:
target: "react"- Generates React-specific route typesautoCodeSplitting: true- Automatically splits routes into separate chunks for optimal loading
routeTree.gen.ts with fully typed route definitions.@vitejs/plugin-react
@vitejs/plugin-react
Provides React Fast Refresh (HMR) support.Features:
- Hot Module Replacement for instant updates
- Preserves component state during development
- Automatic JSX transformation
Common Configuration Options
You can extendvite.config.ts with additional options:
TypeScript Configuration
The project uses TypeScript 5.8.3 with strict type checking.Main Configuration (tsconfig.json)
tsconfig.app.json- Application source codetsconfig.node.json- Build tooling (Vite config, etc.)
Application Config (tsconfig.app.json)
Key TypeScript Settings
Strict Mode Enabled
Strict Mode Enabled
All strict type checking options are enabled:
strict: true- Enables all strict checking optionsnoUnusedLocals: true- Error on unused local variablesnoUnusedParameters: true- Error on unused function parametersnoFallthroughCasesInSwitch: true- Prevent fallthrough in switch statementsnoUncheckedSideEffectImports: true- Ensure imports have type definitions
Modern JavaScript Target
Modern JavaScript Target
target: "ES2022"- Compiles to ES2022 JavaScriptlib: ["ES2022", "DOM", "DOM.Iterable"]- Includes modern browser APIsmodule: "ESNext"- Uses latest ECMAScript module syntax
Bundler Module Resolution
Bundler Module Resolution
moduleResolution: "bundler"- Optimized for Vite bundlerallowImportingTsExtensions: true- Can import.tsfiles directlyverbatimModuleSyntax: true- Preserves import/export syntax
React JSX
React JSX
jsx: "react-jsx"- Uses new JSX transform (no need to import React)- Works with React 17+ automatic JSX runtime
Tailwind CSS Configuration
The application uses Tailwind CSS 3.4.17 for styling.Configuration (tailwind.config.js)
Custom Theme
Primary Color (Amber/Gold)
Primary Color (Amber/Gold)
Amber/gold color palette used for primary actions and highlights.
Secondary Color (Slate)
Secondary Color (Slate)
Slate gray palette for secondary elements and backgrounds.
Custom Font Family
Custom Font Family
Uses Inter font as the default sans-serif font.
Make sure to include the Inter font in your HTML or use a CDN.
Content Sources
Tailwind scans these files for class usage:./index.html- Main HTML file./src/**/*.{js,ts,jsx,tsx}- All source files
PostCSS Configuration
Tailwind requires PostCSS. Configuration is typically inpostcss.config.js:
API Client Configuration
The API client is configured insrc/lib/api.ts and handles all backend communication.
Features
Automatic Credentials
Automatic Credentials
All requests include credentials for cookie-based authentication:
Automatic Content-Type
Automatic Content-Type
Automatically sets
Content-Type: application/json for non-FormData requests:Error Handling
Error Handling
Parses JSON error responses and throws user-friendly errors:
Available API Methods
Seesrc/lib/api.ts:62-188 for the complete API client with methods for:
- Properties:
list(),get(),getBySlug(),create(),update(),delete(),addToFavorites(),removeFromFavorites() - Users:
getProfile(),updateProfile(),getFavorites() - Admin:
getStats(),getProperties(),getUsers(),updateUserRole(),updatePropertyStatus(),createAdmin() - Metadata:
getAll(),getPropertyTypes(),getPropertySubtypes(),getOperationTypes(), etc. - Contact:
submitAppraisal()
Next Steps
- Review Environment Setup for installation
- Explore Database Schema to understand data models
- Check API Reference for endpoint documentation
- Learn about Authentication configuration