E-WIKI - Electric Vehicle Database
A modern Symfony application for browsing and searching electric vehicle information. This application provides a clean, search-engine-like interface for exploring electric vehicle brands, models, and specifications.
Features
- Modern Search Interface: Google-like search experience for electric vehicles
- Brand Directory: Browse popular electric vehicle manufacturers
- Vehicle Database: Comprehensive information about electric car models and revisions
- RESTful API: JSON API endpoints for integration
- PostgreSQL Integration: Relational database for structured data storage
- Responsive Design: Mobile-friendly interface without external CSS frameworks
Technology Stack
- Backend: Symfony 7.2 (PHP 8.3+)
- Database: PostgreSQL with native PDO
- Frontend: Vanilla JavaScript with modern CSS
- Architecture: Clean Architecture with SOLID principles
Requirements
- PHP 8.3 or higher
- PostgreSQL 13 or higher
- Composer
- PostgreSQL PHP Extension (pdo_pgsql)
Installation
-
Clone the repository
git clone <repository-url> cd evwiki -
Install dependencies
composer install -
Configure environment
cp .env.local.example .env.localEdit
.env.localand set your PostgreSQL connection:APP_ENV=dev APP_SECRET=your-secret-key-here DATABASE_DSN="pgsql:host=localhost;port=5432;dbname=evwiki" DATABASE_USER=postgres DATABASE_PASSWORD=postgres -
Start PostgreSQL Make sure PostgreSQL is running on your system.
-
Initialize the database
php bin/console app:database:init -
Start the development server
symfony server:startOr use PHP's built-in server:
php -S localhost:8000 -t public/
Docker Setup
You can also run the application using Docker:
-
Start the services
docker-compose up -d -
Initialize the database in the container
docker-compose exec app php bin/console app:database:init
Project Structure
src/
├── Command/ # Console commands
├── Application/
│ └── Controller/ # HTTP controllers
├── Domain/
│ ├── Model/ # Domain models
│ └── Repository/ # Repository interfaces
├── Infrastructure/
│ └── PostgreSQL/ # PostgreSQL implementation
│ ├── PostgreSQLClient.php
│ └── Repository/ # Concrete repositories
└── Kernel.php # Application kernel
templates/
├── base.html.twig # Base template
└── home/ # Home page templates
database/
└── schema.sql # PostgreSQL schema
config/
├── bundles.php # Bundle configuration
├── packages/ # Package configurations
├── routes.yaml # Route definitions
└── services.yaml # Service container
API Endpoints
Search
GET /api/search?query={term}- Search for vehicles, brands, or models
Brands
GET /api/brands- Get all brandsGET /api/brands/{brandId}/models- Get models for a specific brand
Models
GET /api/models/category/{category}- Get models by category
Architecture
This application follows clean architecture principles:
Domain Layer
- Models: Core domain models (
Brand,CarModel,CarRevision) - Repositories: Data access interfaces
Application Layer
- Controllers: HTTP request handlers
- Commands: Console commands for data management
Infrastructure Layer
- PostgreSQL: Database implementation with native PDO
- Templates: Twig templates for rendering
Key Design Principles
- SOLID Principles: Each class has a single responsibility
- Dependency Injection: All dependencies are injected via constructor
- Clean Architecture: Domain logic is independent of infrastructure
- Readable Code: Self-documenting code with descriptive names
Database Commands
Initialize Database
Initialize the database with schema and sample data:
php bin/console app:database:init
Console Commands
List all available commands:
php bin/console list
Database Schema
The application uses PostgreSQL with the following main tables:
- brands: Electric vehicle manufacturers
- car_models: Vehicle models belonging to brands
- car_revisions: Specific revisions of car models with detailed specifications
All database operations are handled through repositories following the Repository pattern, using native PDO for optimal performance.
Styling Guidelines
- No External CSS Frameworks: Pure CSS following modern standards
- Mobile-First: Responsive design approach
- Clean Design: Minimalist interface focusing on content
Environment Variables
Required environment variables:
APP_ENV: Application environment (dev/prod)APP_SECRET: Secret key for SymfonyDATABASE_DSN: PostgreSQL DSN connection stringDATABASE_USER: PostgreSQL usernameDATABASE_PASSWORD: PostgreSQL password
Contributing
- Follow PSR-12 coding standards
- Write clean, self-documenting code
- Use dependency injection
- Follow SOLID principles
- Avoid else statements
- Use meaningful variable and method names
License
This project is licensed under the MIT License.
Support
For support and questions, please open an issue in the repository.