Rice Carpool is a ridesharing platform built for the Rice University community. It connects students to coordinate shared travel, making it simple to organize and join rides between Rice, Houston airports, and surrounding areas.
Ensure you have the following installed before getting started:
- Go
- Node.js
- Docker Desktop
Note
Request the shared Google OAuth development credentials from the leads before starting local configuration.
-
Start Docker Desktop.
-
Create a local
.envfile from.env.example:# macOS or Linux cp .env.example .env# Windows PowerShell Copy-Item .env.example .env
-
Add the supplied Google OAuth values to your
.envfile:SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_IDSUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_SECRET
Warning
Do not commit .env to version control.
Run the following commands from the repository root:
# First time setup: checks tools and installs dependencies
npm run setup
# Start local database, backend, and frontend
npm run devPress Ctrl+C to stop local services.
| Service | Port(s) | Description |
|---|---|---|
| Frontend | 3000 |
Next.js application (http://localhost:3000) |
| Backend | 8080 |
Go Connect RPC server |
| Supabase / Database | 54321, 54322 |
Local PostgreSQL instance |
Note
npm run setupstarts Supabase briefly to validate the environment, then stops it.npm run devkeeps all data localized within your local Docker environment.
| Path | Purpose |
|---|---|
proto/carpool/v1/ |
API Protocol Buffer messages and request validation schemas |
backend/internal/rpc/ |
Parse requests, invoke application services, and construct RPC responses |
backend/internal/app/ |
Business rules, authorization, database transactions, and contact privacy |
backend/internal/db/postgres/ |
Convert application records to and from sqlc database calls |
backend/internal/db/queries/ |
SQL query sources; assigned queries contain headers to fill |
supabase/migrations/ |
Database schema migrations |
frontend/src/ |
Pre-built frontend client |
Important
Follow these guidelines strictly when writing backend logic:
- Caller Verification:
ListRides,GetRide, andListLocationsallow a missing bearer token. A supplied invalid token is rejected. Every other RPC requiresrpc.actorFromContext. Request IDs select target entities; they do not establish caller identity. - Transaction Integrity: Begin every storage operation via
app.Database.BeginTx. Repositories created from that transaction share a singleSerializablesnapshot. Defer rollback and build an authorized mutation result before committing. - Contact Privacy: Enforce privacy rules using
app.projectUserandapp.projectRides. Guest ride responses include trip facts andoccupied_seats, but no owner, riders, or notes. Signed-in users see contacts only when permitted. Do not expose raw stored contact information in RPC responses. - Layer Separation:
- RPC layer: Parsing, service invocation, error mapping, and protobuf conversion.
- App layer (
app/): Business logic and domain rules. - DB layer (
db/postgres/):sqlcdata conversion.
- Code Generation: Edit
.protoand.sqlsource files, then regenerate code. Do not manually edit generated files inbackend/internal/gen/,backend/internal/db/sqlc/, orfrontend/src/gen/.
The assigned backend operations start as stubs. Their implementations must follow these rules:
- Visitors can list locations and active rides without signing in. Discovery includes full rides and excludes departures more than one hour in the past.
- A visitor can open a ride only while it qualifies for discovery. Cancelled and older rides return
NotFoundto visitors; signed-in users can still open their ride history. - Public ride results include the route, departure time, capacity, status, and occupied seats (including the driver). They omit the owner, riders, and notes. Signed-in results retain the existing contact privacy rules.
- Discovery and ride detail pages are public. Profile, ride history, creation, editing, and ride actions require sign-in and a completed profile. After sign-in and onboarding, the frontend returns users to their intended page.
go build ./... # Compile backend packages
go test ./... # Run backend test suite
sqlc generate # Generate Go code from SQL queries
sqlc diff # Verify SQL query changes against database schema- Protobuf: Run
buf generateinproto/. - Frontend: Run
npm run generateinfrontend/.
npm run db:start # Start local Supabase database
npm run db:stop # Stop Supabase database
npm run db:reset # Reset local Supabase database
npm run backend # Run Go backend individually
npm run frontend # Run Next.js frontend individually- Database Integration Tests: Use
backend/internal/testutil.SetupTestDB. It boots a disposable PostgreSQL container when Docker is available or uses an explicitly setTEST_DATABASE_URL. It ignores standardDATABASE_URL. - CI Pipeline: Operation test checks are visible in CI (initially non-blocking to allow incremental merges). Build and code generation checks must pass.
- Frontend Checks: From
frontend/, runnpm test,npm run lint,npx tsc --noEmit, andnpm run build. Install the browser once withnpx playwright install chromium, then runnpm run test:e2efor mocked public-browsing flows.
Built by RiceApps Studio :>
- Andrew Chu
- Angel J Guerrero
- Calvin Wong
- Claire Li
- Dara Odukoya
- Eason Tang
- Emily Zheng
- Katherine Han
- Joya Roy
- Liya Ferede
- Marianna Argeiti
- Megan Cung
- Melody Cui
- Yiyi Sun
- Zimo Wang