Getting started with Rideshare
Install the source, configure PostgreSQL, sessions, and optional S3 storage, apply migrations, run onboarding, and deploy.
Requirements
- Node.js 20 or later (
enginesinpackage.json); the README recommends Node.js 22 for Next.js 16. - npm (the repository ships a
package-lock.json). - A PostgreSQL database you are allowed to migrate.
Clone and install
git clone https://github.com/openshiporg/openfront-rideshare.git
cd openfront-rideshare
npm ciEnvironment
Copy .env.example to .env and replace the placeholders:
DATABASE_URL=postgresql://user:password@localhost:5432/openfront_rideshare
SESSION_SECRET=replace-with-at-least-32-random-characters
PUBLIC_SIGNUPS_ALLOWED=false
# Optional S3-compatible image storage
S3_BUCKET_NAME=
S3_REGION=
S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=
S3_ENDPOINT=| Variable | Used for |
|---|---|
DATABASE_URL | PostgreSQL connection for Keystone and Prisma. Required in production. |
SESSION_SECRET | Signs stateless session cookies (30-day max age). In production it is required and must be at least 32 characters; startup throws otherwise. Generate one with openssl rand -hex 32. |
PUBLIC_SIGNUPS_ALLOWED | When true, opens /dashboard/signup and also opens rider signup at /account/signup. Keep it false unless you want open signup. With it false, rider signup opens only while at least one active fleet has rider accounts set to open. |
S3_BUCKET_NAME, S3_REGION, S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, S3_ENDPOINT | Optional S3-compatible image storage. Storage is configured only when S3_BUCKET_NAME is set; S3_REGION defaults to auto. |
SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD, SMTP_FROM, SMTP_STORE_LINK | Optional SMTP for password reset email. |
OPENROUTER_API_KEY, OPENROUTER_MODEL, OPENROUTER_MAX_TOKENS | Optional dashboard AI assistant. Without the key and model, the completion endpoint returns 503. |
Never commit .env.
Migrations
The repository contains checked-in Prisma migrations: seven inherited starter migrations followed by Rideshare migrations for the foundation schema, atomic offer acceptance, time-window constraints, branding/cancellation/payment observations, fleet operations mode, and fleet rider accounts.
npm run migrate # prisma migrate deploy
npm run migrate:gen # after schema changes: keystone build, view-order generation, prisma migrate devnpm run dev runs keystone build --no-ui, then npm run migrate, then next dev. It applies migrations to whatever database DATABASE_URL points at.
Run locally
npm run dev| Path | Surface |
|---|---|
/ and /book | Rider booking |
/rides/[confirmationCode] | Trip status page |
/account, /account/signup, /account/rides | Rider sign-in, signup, and ride history |
/dashboard | Operator dashboard |
/api/graphql | GraphQL API |
First user and onboarding
- Open the app. While no users exist, every route redirects to
/dashboard/init, which creates the first user. That user receives the Admin role. - The onboarding dialog offers starter templates.
bootstrapRideshare(mode: "minimal" | "full")creates one starter fleet with an owner membership for you, a service area, a ride service and fare rule, driver and vehicle eligibility policies, a driver and vehicle with compliance documents and policy evaluations, availability rules, the manual payment provider (if missing), provider connections, and a marketplace registration.fulladds an accessible ride service and a wheelchair-accessible vehicle. Running it again inspects the existing starter fleet instead of creating a duplicate. - Alternatively, use the custom setup steps or Settings, which call
setupFleet,setupServiceArea,setupRideService, andsetupFareRule.dismissRideshareOnboardinghides the dialog. - To take bookings, the fleet needs status
active, operations modemanual(manual dispatch), an active ride service with an active fare rule, and at least one approved driver with an approved vehicle who is online (available) for immediate rides; scheduled rides can be offered to active drivers who are not currently available. Set rider accounts toopenif riders should be able to sign up. Rider signup is global: it opens when any active fleet has rider accountsopen.
Replace the starter fleet's names, fares, and documents with your own before taking bookings.
Checks
npm test # tsx --test tests/*.test.ts
npm run typecheck
npm run lint
npm run audit # tsx scripts/audit.tsNext: Deployment and Set up a fleet.