Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Muhammadbugaje/trustride/llms.txt

Use this file to discover all available pages before exploring further.

TrustRide runs on Django 6.0 with Daphne as the ASGI server (required for WebSocket support), Redis as both the Celery broker and the channel layer, and PostgreSQL as the primary database. The steps below get a fully functional local environment — including real-time chat and background task processing — running in under 10 minutes.
1

Verify Prerequisites

You need Python 3.10 or later, a running PostgreSQL instance, and a running Redis server before cloning the project. Confirm each is available:
python --version          # Python 3.10.x or higher
psql --version            # PostgreSQL 14+ recommended
redis-cli ping            # should return PONG
node --version            # Node 18+ for Tailwind CSS compilation
TrustRide uses daphne (the ASGI server from the Django Channels project) as the first entry in INSTALLED_APPS. If Daphne is missing or channels is not installed, python manage.py runserver will raise an ImproperlyConfigured error on startup — install the full requirements.txt before running any management commands.
2

Clone and Create a Virtual Environment

Clone the repository, enter the project directory, and isolate dependencies in a virtualenv:
git clone https://github.com/Muhammadbugaje/trustride.git
cd trustride
python -m venv venv
source venv/bin/activate          # Windows: venv\Scripts\activate
All subsequent commands assume the virtualenv is active. The project root — the directory that contains manage.py — is your working directory for every command in this guide.
3

Install Dependencies

TrustRide pins every package via requirements.txt. Install everything in one shot:
pip install -r requirements.txt
Key packages this installs include Django==6.0.6, channels==4.3.2, channels_redis==4.3.0, daphne==4.2.2, celery==5.6.3, django-celery-beat==2.9.0, psycopg2-binary==2.9.12, cloudinary==1.44.2, djangorestframework==3.17.1, and django-environ==0.14.0.
4

Configure Environment Variables

TrustRide uses python-dotenv to load a .env file from the project root. Create .env and populate it with the variables below. Every key maps to an os.getenv(...) call in trust_ride/settings.py.
# .env — place in the project root (same directory as manage.py)

# Django core
DJANGO_SECRET_KEY=your-long-random-secret-key-here
DJANGO_DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1

# Database — use DATABASE_URL for a single connection string,
# or leave blank to fall back to SQLite for quick local testing
DATABASE_URL=postgres://trustride_user:password@localhost:5432/trustride_db

# Redis — used by both Celery and (optionally) Django Channels
CELERY_BROKER_URL=redis://localhost:6379/0
CELERY_RESULT_BACKEND=redis://localhost:6379/0

# Email (Brevo SMTP is the configured default)
EMAIL_HOST=smtp-relay.brevo.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=your-brevo-login@smtp-brevo.com
EMAIL_HOST_PASSWORD=your-brevo-smtp-key
DEFAULT_FROM_EMAIL=TrustRide <noreply@trustride.ng>

# Paystack (payment gateway integration)
PAYSTACK_PUBLIC_KEY=pk_test_xxxxxxxxxxxx
PAYSTACK_SECRET_KEY=sk_test_xxxxxxxxxxxx

# CORS (add ngrok URL here when testing webhooks)
CORS_ALLOWED_ORIGINS=http://127.0.0.1:8000,http://localhost:8000
CSRF_TRUSTED_ORIGINS=http://127.0.0.1:8000,http://localhost:8000
If DATABASE_URL is not set, settings.py falls back to SQLite (db.sqlite3 in the project root). SQLite works for initial exploration but does not support pg_trgm indexing, which the origin/destination search is optimised for. Switch to PostgreSQL before running load tests or working on search performance.
5

Run Migrations and Populate Sample Data

Apply all database migrations and then seed the database with initial platform configuration using the included population script:
python manage.py migrate
python manage.py shell -c "exec(open('populate_sample_data.py').read()); create_sample_app_settings()"
populate_sample_data.py defines a create_sample_app_settings() helper that inserts default AppSetting records — platform_fee_percent, auto_cleanup_interval_hours, verification_timeout_hours, waitlist_expiry_minutes, and gps_update_interval_seconds. Run it via manage.py shell as shown above. To create test users and sample trips, use python manage.py createsuperuser for an admin account, then register rider and driver accounts through the web UI.
After migration, collect static files if you plan to run Daphne instead of runserver:
python manage.py collectstatic --noinput
6

Start All Services

TrustRide requires four concurrent processes for full local functionality. Open a separate terminal tab for each:Terminal 1 — Daphne ASGI server (required for WebSocket chat and notifications):
daphne -b 127.0.0.1 -p 8000 trust_ride.asgi:application
Terminal 2 — Celery worker (processes background tasks: seat expiry, notifications, booking reminders):
celery -A trust_ride worker --loglevel=info
Terminal 3 — Celery Beat (triggers scheduled tasks: expire_bookings_and_cleanup every 120 s, update_trip_statuses every 60 s):
celery -A trust_ride beat --loglevel=info --scheduler django_celery_beat.schedulers:DatabaseScheduler
Terminal 4 — Standard Django dev server (alternative to Daphne for HTTP-only development; does not support WebSockets):
python manage.py runserver
Open http://127.0.0.1:8000 in your browser. The admin panel is at /control/ and Django’s built-in admin is at /admin/.
TrustRide ships with django-ngrok==0.1.0 in requirements.txt. Run python manage.py ngrok to get a public HTTPS tunnel to your local server — useful for testing Paystack payment webhooks and email verification links that require a publicly reachable URL. Add the generated ngrok domain to both ALLOWED_HOSTS and CSRF_TRUSTED_ORIGINS in your .env.

Build docs developers (and LLMs) love