Backend for the Shared Car System.
🔐 Security
The Shared Car System backend is designed with a security-first, zero-trust approach, where all enforcement occurs server-side and the frontend is treated as untrusted.
All protected endpoints require JWT Bearer authentication
Tokens are verified on every request using centralized middleware
Invalid, expired, or missing tokens are rejected with appropriate HTTP status codes
WebSocket connections use the same authentication model
The system enforces invite-only access — there is no public signup or group discovery
All data access is strictly group-scoped
Users may only access resources belonging to groups they are members of
Role-based permissions are enforced server-side (Owner vs Member)
Group membership is granted exclusively through secure, single-use invite tokens
Invite tokens are:
High-entropy and non-guessable
Time-limited
Invalidated immediately after acceptance
Token reuse or enumeration attempts are rejected
The backend never trusts client-provided identifiers
All resource access is validated against the authenticated user’s group membership
Business rules such as reservation conflict prevention and valid state transitions are enforced in the service layer
Real-time events are delivered via authenticated WebSocket connections
Events are emitted only to group-scoped rooms
No global or public real-time broadcasts exist
The system records a lightweight audit trail for critical actions, including:
Reservation creation and cancellation
Car returns
Pickup request actions
Invite acceptance
Payment updates
This supports accountability and dispute resolution without excessive logging
Sensitive endpoints (authentication, invites) are designed to support rate limiting
The attack surface is intentionally minimized through strict scope control
To reduce risk and scope creep, the following are intentionally out of scope for the current version:
Public access or discovery
Automatic payment processing
External OAuth providers
Live GPS tracking or location sharing
The Shared Car System prioritizes access isolation, correctness, and real-world constraint enforcement. Security is achieved through architecture and authorization rather than client-side controls or heavy tooling.