4.4 KiB
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
- MongoDB Integration: NoSQL database for flexible data storage
- Responsive Design: Mobile-friendly interface without external CSS frameworks
Technology Stack
- Backend: Symfony 7.2 (PHP 8.2+)
- Database: MongoDB with Doctrine ODM
- Frontend: Vanilla JavaScript with modern CSS
- Architecture: Clean Architecture with SOLID principles
Requirements
- PHP 8.2 or higher
- MongoDB 4.4 or higher
- Composer
- MongoDB PHP Extension
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 MongoDB connection:APP_ENV=dev APP_SECRET=your-secret-key-here MONGODB_URI=mongodb://localhost:27017 -
Start MongoDB Make sure MongoDB is running on your system.
-
Seed the database
php bin/console app:seed-data -
Start the development server
symfony server:startOr use PHP's built-in server:
php -S localhost:8000 -t public/
Project Structure
src/
├── Command/ # Console commands
├── Controller/ # HTTP controllers
├── Document/ # MongoDB document models
├── Repository/ # Data access layer
├── Service/ # Business logic layer
└── Kernel.php # Application kernel
templates/
├── base.html.twig # Base template
└── home/ # Home page templates
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
- Documents: MongoDB document models (
Brand,CarModel,CarRevision) - Repositories: Data access interfaces
Application Layer
- Services: Business logic (
CarSearchService) - Commands: Console commands for data management
Infrastructure Layer
- Controllers: HTTP request handlers
- Templates: Twig templates for rendering
Key Design Principles
- SOLID Principles: Each class has a single responsibility
- Dependency Injection: All dependencies are injected via constructor
- No Else Statements: Code uses early returns for better readability
- Readable Names: Self-documenting code with descriptive names
Development
Adding New Data
Use the seed command to populate the database:
php bin/console app:seed-data
Console Commands
List all available commands:
php bin/console list
Database Operations
The application uses MongoDB with Doctrine ODM. All database operations are handled through repositories following the Repository pattern.
Styling Guidelines
- No External CSS Frameworks: Pure CSS following modern standards
- Responsive Design: Mobile-first approach
- Modern UI: Clean, minimalist design inspired by search engines
- Accessibility: Semantic HTML and proper contrast ratios
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.