How pabloamomo/dloc-platform works
DLOC is a GPS tracking platform: device messages enter through the server’s HTTP or protocol-specific socket handlers, are persisted, and are exposed through an API to a React frontend. The API also manages devices, sharing, authentication, images, and live WebSocket updates. The sampled code supports the server’s main dispatch and persistence relationships; several frontend and API service connections are documented only at a high level, so those links are dashed and unverified.
Main entry points: App.tsx React application · source/server.ts GPS server · source/server.ts API server · routesLocation.ts HTTP location
Components 23
GPS ingestion
- GPS server
dloc-server/source/server.ts - Socket handler
dloc-server/source/controllers/server-socket/serverSocketHandler.ts - Protocol adapters
dloc-server/source/infraestucture/models/ServerSocketHandlerPropsInjection.ts - HTTP location
dloc-server/source/controllers/server-http/routes/routesLocation.ts - Packet processing
dloc-server/source/services/server-http/protoHttpHandlePacket.ts
API services
- API server
dloc-api/source/server.ts - HTTP routes
dloc-api/source/controllers/routes.ts - Device services
dloc-api/source/services/device - Token authentication
dloc-api/source/functions/checkToken.ts - WebSocket handler
dloc-api/source/sockets/socketHandler.ts - Position updates
dloc-api/source/sockets/services/getPositionService.ts - Power profiles
dloc-api/source/sockets/services/updatePowerProfileService.ts - Persistence contract
dloc-api/source/persistence/_Persistence.ts
Frontend
- React application
dloc-frontend/src/App.tsx - Tracking map
dloc-frontend/src/pages/Map/Map.tsx - Device management
dloc-frontend/src/pages/Profile/Profile.tsx - Application providers
dloc-frontend/src/providers/DevicesProvider.tsx - API clients
dloc-frontend/src/functions/serviceCall.ts
Persistence
- Server persistence
dloc-server/source/infraestucture/mySql/mySqlPersistence.ts - MySQL
- MySQL adapter
dloc-api/source/persistence/mySql/_mySqlPersistence.ts
Other components
- GPS devices
- Platform user
Connections 27
- GPS devices → Socket handler: send packets
- GPS devices → HTTP location: submit locations
- GPS server → Socket handler: starts socket
dloc-server/source/server.ts - GPS server → HTTP location: starts HTTP
dloc-server/source/server.ts - GPS server → Protocol adapters: selects adapter
dloc-server/source/server.ts - Socket handler → Protocol adapters: dispatches packets
dloc-server/source/controllers/server-socket/serverSocketHandler.ts - HTTP location → Packet processing: processes packet
dloc-server/source/controllers/server-http/routes/routesLocation.ts - HTTP location → Server persistence: gets persistence
dloc-server/source/controllers/server-http/routes/routesLocation.ts - GPS server → Server persistence: starts persistence
dloc-server/source/server.ts - Server persistence → MySQL: reads and writes
- API server → HTTP routes: starts HTTP
- API server → WebSocket handler: starts WebSocket
dloc-api/source/server.ts - API server → MySQL adapter: sets persistence
dloc-api/source/server.ts - API server → Persistence contract: uses contract
dloc-api/source/server.ts - HTTP routes → Device services: serves device APIs
- WebSocket handler → Token authentication: validates token
dloc-api/source/sockets/socketHandler.ts - WebSocket handler → Persistence contract: reads data signature
dloc-api/source/sockets/socketHandler.ts - Position updates → Persistence contract: loads positions
dloc-api/source/sockets/services/getPositionService.ts - Power profiles → Persistence contract: updates profile
dloc-api/source/sockets/services/updatePowerProfileService.ts - MySQL adapter → MySQL: reads and writes
- Platform user → React application: uses platform
- React application → Tracking map: presents tracking
- React application → Device management: manages devices
- React application → Application providers: uses providers
- Application providers → API clients: requests data
- API clients → HTTP routes: calls API
- React application → WebSocket handler: receives live updates