PropSpaceX User Service

Authentication and user management microservice — hybrid email/password and blockchain wallet login, device trust verification, and audit logging over REST and gRPC.

Node.jsTypeScriptJWTPostgreSQLGeoIPgRPC
GitHub
01

System Architecture

REQUESTPOST /auth/logintracing
gRPCbind sessionlocatewallet logintrailAPI GatewayExternal trafficEDGEInternal ServicesToken checksEDGEREST APILogin · RegisterSVCgRPC SerververifyToken()SVCAuth EngineJWT · Refresh rotationSVCDevice TrustFingerprintsSVCGeoIPMaxMind · travel checksEXTWallet AuthSignature verifySVCPostgreSQLUsers · SessionsDATAAudit LogAuth eventsDATA

Logins arrive from the gateway over REST; internal services verify tokens over gRPC. The auth engine rotates refresh tokens, binds sessions to device fingerprints, and validates location via GeoIP before touching PostgreSQL. Wallet login verifies an Ethereum signature instead of a password.

02

Database Design

SCHEMA4 tables · 4 relationshover a table
usersPostgreSQLiduuidemailvarcharpassword_hashvarcharwallet_addressvarcharmfa_enabledboolcreated_attimestampdevicesPostgreSQLiduuiduser_iduuidfingerprintvarcharlast_ipinettrustedboollast_seentimestampsessionsPostgreSQLiduuiduser_iduuiddevice_iduuidrefresh_hashvarcharexpires_attimestamprevokedboolauth_eventsPostgreSQLiduuiduser_iduuideventvarcharipinetgeojsonbcreated_attimestamp

Sessions are bound to both a user and a trusted device; every auth event lands in an append-only trail for impossible-travel and audit checks.

03

Engineering Challenges

01

Hybrid authentication

One identity model backing two login paths — traditional email/password and Ethereum wallet signature verification.

02

Token security

JWT with refresh-token rotation and device binding prevents token theft and replay attacks.

03

Device trust

Fingerprinting flags logins from unknown devices; GeoIP adds impossible-travel detection on top.

04

Audit trail

Every auth event lands in an append-only log with IP and geo context for compliance and incident review.

04

Trade-offs & Decisions

ChoseOverBecause
JWT + refreshServer sessionsStateless verification scales horizontally without a shared session store on the hot path.
PostgreSQLMongoDBACID guarantees matter for identity and audit data more than schema flexibility.
FingerprintingIP-only checksIPs churn constantly on mobile networks; device fingerprints are a far more stable trust signal.