Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/DavidCevallos15/Crucidrive---APP/llms.txt

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

This guide walks you through getting both the backend server and the Expo mobile app running on your local machine. By the end, you will have a live Express + Socket.io API connected to Supabase, and an Expo dev client ready to run on a simulator or physical device — all from a single monorepo clone.
CruciDrive uses the Supabase free tier for its database, authentication, and Row Level Security policies, which means the initial infrastructure cost is $0. You only need a free Supabase account to follow this guide.

Prerequisites

Before you begin, make sure you have the following installed and available:
  • Node.js LTS (v20 or higher) — nodejs.org
  • Gitgit-scm.com
  • Expo CLI — install globally with npm install -g expo-cli or use npx expo for every command
  • A Supabase project — create a free one at supabase.com. You will need your project URL and anon key from Project Settings → API.

Setup Steps

1

Clone the repository

Clone the CruciDrive monorepo from GitHub and navigate into the project root:
git clone https://github.com/DavidCevallos15/Crucidrive---APP.git
cd Crucidrive---APP
The repository contains two top-level directories: /backend (Node.js/Express server) and /frontend (React Native Expo app). Each has its own package.json and must be configured and started independently.
2

Configure backend environment variables

Navigate into the backend directory and create a .env file. The backend requires three environment variables to boot — your Supabase project URL, the anonymous public key, and the port for the HTTP/WebSocket server:
cd backend
cp .env.example .env   # if an example file is present, otherwise create it manually
Open .env and set the following values:
# .env — CruciDrive Backend

# Your Supabase project URL (found in Project Settings → API)
SUPABASE_URL=https://your-project-ref.supabase.co

# Supabase anonymous/public key (safe to expose in client-side code)
SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

# Port for the Express + Socket.io HTTP server
PORT=3000
Never commit your .env file to version control. The .gitignore in the backend directory excludes it by default. Use the Supabase anon key, not the secret service_role key, for this configuration.
3

Install dependencies and start the backend

From inside the backend/ directory, install dependencies and launch the development server using nodemon (which auto-restarts on file changes):
npm install
npm run dev
When the server boots successfully, you should see the following startup banner in your terminal:
=================================================
 Servidor de CruciDrive (REST + Sockets) corriendo
 Puerto: 3000
 URL local: http://localhost:3000
=================================================
The server starts an HTTP server on the configured PORT, registers three REST route groups (/api/auth, /api/viajes, /api/chats), and initializes the Socket.io handler for real-time GPS and chat events — all in a single process.
4

Configure frontend environment variables

Open a new terminal, navigate to the frontend/ directory, and create a .env file for the Expo app. The frontend uses Expo’s EXPO_PUBLIC_ prefix convention so variables are safely embedded in the client bundle at build time:
cd ../frontend
Create a .env file with the following contents:
# .env — CruciDrive Frontend (Expo)

# Base URL of the running Express backend
EXPO_PUBLIC_API_BASE_URL=http://localhost:3000

# Your Supabase project URL
EXPO_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co

# Supabase anonymous/public key
EXPO_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

# WebSocket server URL — typically the same as the backend URL
EXPO_PUBLIC_SOCKET_URL=http://localhost:3000
When testing on a physical Android or iOS device on the same Wi-Fi network, replace localhost with your machine’s local IP address (e.g., 192.168.1.x). Devices cannot reach localhost on your development machine through Expo Go.
5

Install dependencies and start the Expo app

From inside the frontend/ directory, install dependencies and start the Expo development server:
npm install
Then choose your target platform:
expo start
Scanning the QR code with the Expo Go app on your physical device will load the app immediately. For Android emulator or iOS simulator, make sure the respective tools (Android Studio / Xcode) are installed and a virtual device is running.
6

Verify the backend connection

With the backend running, confirm the server is healthy and connected to Supabase by hitting the root endpoint. This endpoint internally calls supabase.auth.getSession() to verify the Supabase connection is live:
curl http://localhost:3000/
A successful response looks like:
{
  "status": "ok",
  "message": "Servidor Express de CruciDrive activo y conectado a Supabase correctamente.",
  "timestamp": "2025-01-15T14:32:00.000Z"
}
If you receive a 500 error instead, double-check that SUPABASE_URL and SUPABASE_ANON_KEY in your backend .env are correct and that your Supabase project is active.
The default geographic center for CruciDrive’s map and geofencing logic is Crucita, Manabí, Ecuador — latitude -1.0448, longitude -80.5432. Any PostGIS proximity queries and default map viewport will be centered on this coordinate.

What’s Running

After completing all steps, you have:
ProcessURLDescription
Express REST APIhttp://localhost:3000/apiAuth, rides, and chat endpoints
Socket.io serverws://localhost:3000Live GPS tracking and in-ride chat
Expo dev serverexp://localhost:8081React Native app with hot reload
From here, explore the Architecture page to understand how the backend modules, database schema, and real-time infrastructure fit together.

Build docs developers (and LLMs) love