Ajalol Dealer ποΈ
Modern platform for managing and showcasing vehicles (new and used) in the Dominican Republic. This project is designed to offer an ultra-fast experience to end users and a secure, efficient admin panel for inventory management.
π‘ General Project Idea
Ajalol Dealer is a digital dealership consisting of two main parts:
- Public Catalog: An SEO and speed-optimized portal where customers can search, filter, and view available vehicle details.
- Admin Panel: A secure system (protected by authentication) where administrators can manage the inventory (add, edit, or delete vehicles and upload images).
π οΈ Technologies Used
- Main Framework: Astro (v6) - Used to leverage Server-Side Rendering (SSR), Static Site Generation (SSG), and the βIslandsβ architecture for unmatched performance.
- UI & Interactive Components: React (v19) - Complex state management on the client side (filters, admin dashboard, forms).
- Styling: Tailwind CSS (v4) - Responsive design with a custom design system (
ajalolcolors). - Backend as a Service (BaaS): Firebase (v12)
- Firestore: NoSQL database for vehicle inventory.
- Firebase Storage: Storage for vehicle images.
- Firebase Auth & Admin SDK: Session cookie-based authentication management for enhanced security.
- Image Optimization:
browser-image-compressionand galleries usingphotoswipe.
π Project Structure
/
βββ public/ # Static assets
βββ src/
β βββ components/
β β βββ astro/ # Static Astro components
β β βββ react/ # Interactive components (Island Architecture)
β βββ layouts/ # Master templates (Layout.astro)
β βββ lib/
β β βββ firebase/ # Firebase configuration (client and server)
β βββ pages/ # File-based routing
β β βββ admin/ # Control panel (protected)
β β βββ api/ # Backend endpoints
β β βββ vehiculo/ # Vehicle detail views
β β βββ index.astro # Home page
β βββ middleware.ts # Middleware for security and protected routes
βββ firebase.json # Firebase CLI configuration
βββ firestore.rules # Firestore security rules
βββ storage.rules # Storage security rules
βββ astro.config.mjs # Astro configuration
π Security
The projectβs security is designed with a multi-layered approach:
- Middleware Protection (Edge/Server):
- Panel routes (
/admin/*and/api/admin/*) are protected and require a valid session cookie verified by the Firebase Admin SDK.
- Panel routes (
- Cloudflare Shield (Proxy Secret):
- Public endpoints for
/api/*and/cdn/*in production require a secret in the headers (X-Ajalol-Proxy-Secret) to prevent direct unauthorized access to the origin, bypassing the CDN.
- Public endpoints for
- Firebase Rules:
- Restricted access in
firestore.rulesandstorage.rulesensuring that writes and modifications to the catalog can only be done by users with appropriate privileges.
- Restricted access in
β¨ Implemented Practices & Patterns
- Astro Islands Architecture: Client-side JavaScript is loaded only when strictly necessary (
client:loadon React components likeVehicleFilter). - Hybrid SSR/SSG: The site uses static rendering/prerendering for public pages to guarantee near-instant load times, while using SSR for the admin panel and APIs.
- State and Form Management: Modular React components (
VehicleForm,AdminDashboard) to separate administrative view logic from public rendering. - SEO Optimization: Sitemap inclusion (
@astrojs/sitemap) to facilitate vehicle catalog indexing, alongside dynamic meta tags (description,image) and JSON-LD Structured Data built seamlessly for every vehicle page.
π€ Latest Features (AI, SEO & Advanced Admin)
- AI-Powered Copywriting: Integration with Google Gemini (2.5 Flash) via a native API endpoint. Allows administrators to auto-generate concise, persuasive sales descriptions based on vehicle specifications.
- Dynamic SEO for Vehicles: The
[slug].astrolayout now consumes and exposes complete vehicle specifications (Color, Drive Wheel, Condition, Doors) into standardized Google Rich Snippets (JSON-LDOffer/Car). - Advanced Editing Flow: The Admin Dashboard supports deep-editing of existing vehicles (
PUTmethod). It features an intelligent image management system that seamlessly merges existing CDN-hosted image URLs with new binary uploads, and automatically deletes removed pictures from Google Cloud Storage to optimize storage costs.
π Development Commands
| Command | Action |
|---|---|
npm install | Installs necessary dependencies |
npm run dev | Starts the local development server |
npm run build | Builds the application for production in /dist |
npm run preview | Local preview of the production build |
npm run deploy:rules | Deploys Firebase security rules |