AI-Powered Safari and Travel Planning Platform
SafariSmart Kenya is a travel platform designed to modernize how users plan their Kenyan safaris. By integrating Google's Gemini AI, the system generates personalized, budget-conscious, and interest-based itineraries. The platform aims to promote domestic tourism by making travel planning accessible and transparent.
To democratize travel planning in Kenya, enabling users to discover destinations and plan affordable trips through intelligent automation.
The following diagram illustrates the high-level architecture of the SafariSmart Kenya platform, detailing the data flow between the user, the Django backend, and the external Gemini AI service.
graph TD
User[User Client] -->|HTTP Request| LoadBalancer[Load Balancer/Render]
LoadBalancer -->|Forward| Django[Django Backend]
subgraph "Application Layer"
Django -->|Route| Views[View Controllers]
Views -->|Validate| Forms[Form Validation]
Views -->|Query| ORM[Django ORM]
end
subgraph "AI Integration Layer"
Views -->|Prepare Prompt| GeminiService[Gemini Service]
GeminiService -->|API Call| GeminiAPI[Google Gemini API]
GeminiAPI -->|JSON Response| GeminiService
end
subgraph "Data Layer"
ORM -->|Read/Write| DB[(PostgreSQL Database)]
end
GeminiService -->|Parsed Data| Views
Views -->|Render| Templates[HTML Templates]
Templates -->|Response| User
The application uses a relational database to manage users, destinations, and generated itineraries. The core relationships are depicted below.
erDiagram
User ||--o{ Itinerary : "creates"
User ||--o{ WizardSession : "has"
Destination ||--o{ Itinerary : "included_in"
Destination ||--o{ WizardSession : "selected_in"
User {
int id PK
string username
string email
}
Destination {
int id PK
string name
string destination_type
decimal average_cost_per_day
string popular_activities
}
Itinerary {
int id PK
int user_id FK
string title
int duration_days
json itinerary_data
int total_budget
string share_code
}
WizardSession {
int id PK
string session_key
int current_step
json interests
int budget_amount
}
- AI-Powered Itinerary Generator: Utilizes Generative AI to create day-by-day travel plans based on user constraints (budget, group size, interests).
- Destination Management: A curated database of over 20 Kenyan destinations with detailed metadata (costs, activities, weather).
- Wizard-Based Interface: A multi-step form that guides users through the planning process, storing progress in
WizardSessionto prevent data loss. - Security Implementation:
- Brute-force Protection: Implemented via
django-axes. - Content Security Policy: Enforced using
django-csp. - Rate Limiting: Applied to API endpoints to prevent abuse.
- Brute-force Protection: Implemented via
- Responsive Design: Built with Bootstrap 5 and SCSS for a consistent experience across devices.
- Backend Framework: Django 5.0 (Python 3.11)
- AI Service: Google Generative AI (Gemini Pro)
- Database: PostgreSQL (Production), SQLite (Development)
- Frontend: HTML5, SCSS, Bootstrap 5, JavaScript
- Security Libraries: Argon2, Bleach, Django-CSP, Django-Axes
- Deployment Platform: Render.com
- Python 3.11 or higher
- Git
- Virtualenv
-
Clone the Repository
git clone https://github.com/owuorviny109/safarismart-kenya.git cd safarismart-kenya -
Create and Activate Virtual Environment
python -m venv venv # Windows venv\Scripts\activate # Linux/Mac source venv/bin/activate
-
Install Dependencies
pip install -r requirements.txt
-
Environment Configuration Create a
.envfile in the root directory with the following variables:DEBUG=True SECRET_KEY=your-secure-secret-key GEMINI_API_KEY=your-google-gemini-api-key OPENWEATHER_API_KEY=your-openweather-api-key DATABASE_URL=sqlite:///db.sqlite3
-
Apply Database Migrations
python manage.py migrate
-
Load Initial Configuration Data This script populates the database with default travel types, budget categories, and system settings.
python manage.py shell < load_config_data.py -
Start the Development Server
python manage.py runserver
safarismart-kenya/
├── accounts/ # User authentication & profile management
│ ├── forms.py # Login, Registration, and Profile forms
│ ├── models.py # User profile models
│ ├── urls.py # Account-related URL routing
│ └── views.py # Authentication logic (Login, Logout, Register)
├── api/ # Internal API endpoints
│ ├── urls.py # API URL routing
│ └── views.py # API view logic (e.g., dynamic data fetching)
├── core/ # Core application logic
│ ├── management/ # Custom Django management commands
│ ├── middleware/ # Custom middleware (e.g., analytics)
│ ├── services/ # Business logic services (AI, Email, etc.)
│ ├── templatetags/ # Custom template tags and filters
│ ├── models.py # Core models (WizardSession, Itinerary)
│ ├── models_config.py # System configuration models
│ ├── urls.py # Core URL routing
│ └── views.py # Main views (Landing, Dashboard, Wizard)
├── destinations/ # Destination management
│ ├── models.py # Destination models
│ ├── urls.py # Destination URL routing
│ └── views.py # Destination listing and detail views
├── safarismart/ # Project configuration
│ ├── settings.py # Main Django settings
│ ├── settings_production.py # Production-specific settings
│ ├── urls.py # Root URL configuration
│ └── wsgi.py # WSGI application entry point
├── static/ # Static assets
│ ├── css/ # Compiled CSS files
│ ├── images/ # Project images
│ └── js/ # JavaScript files
├── templates/ # HTML Templates
│ ├── accounts/ # Authentication templates
│ ├── components/ # Reusable UI components (Navbar, Footer)
│ ├── core/ # Core templates (Landing, Dashboard)
│ ├── destinations/ # Destination templates
│ └── base.html # Base template with common layout
├── .gitignore # Git exclusion rules
├── build.sh # Render.com build script
├── db.sqlite3 # Development database
├── FAQ.md # Frequently Asked Questions
├── load_config_data.py # Database seeding script
├── manage.py # Django management utility
├── package.json # Frontend dependencies
├── README.md # Project documentation
├── render.yaml # Render.com infrastructure config
├── requirements.txt # Python dependencies
└── USER_GUIDE.md # User instruction manual
The project utilizes a hybrid deployment strategy to maximize reliability while minimizing costs:
- Application & Database: Hosted on Render.com (Free Tier)
- Media Storage: Hosted on AWS S3 (Permanent Storage)
This architecture ensures that user-uploaded images (destinations, avatars) persist across deployments, solving Render's ephemeral filesystem limitation.
Configuration:
- See
AWS_DEPLOYMENT_PLAN.mdfor architecture details. - See
aws/S3_SETUP_GUIDE.mdfor setup instructions.
Status: Live & Integrated
- FAQ.md - Frequently Asked Questions
- USER_GUIDE.md - User instruction manual
- CHANGELOG.md - Version history and release notes
- AWS_DEPLOYMENT_PLAN.md - Production deployment guide
Contributions are welcome. Please follow the standard fork-and-pull request workflow:
- Fork the repository.
- Create a feature branch.
- Commit your changes with clear messages.
- Push to your branch.
- Open a Pull Request describing your changes.
Vincent Owuor
- GitHub: @owuorviny109
- Email: owuorvincent069@gmail.com
- Portfolio: owuorvincent.vercel.app