How danielsrs/relampago_marquinhos works
Project Type and Purpose
• This is a monorepo full‑stack TypeScript project managing EV charging stations and user interactions.
• It comprises three principal “apps”:
• Car client (apps/car) – a React (likely React Native) application that simulates an electric vehicle.
• Station client (apps/station) – a React application for station operators.
• Server (src/) – a Node.js/TypeScript REST API with in‑memory (or pluggable) data storage and Zod validation.
• There is also a shared package (apps/shared) providing common UI components, API client, utilities, and contexts.
File Structure
• Top‑level:
• package.json, Dockerfiles, docker-compose.yml, install scripts, tsconfig.json – define workspaces, scripts, Docker build, and CI/test setup.
• apps/ – Yarn workspace containing car, station, shared packages.
• src/ – main server and CLI tools (car.ts, station.ts) plus validation schemas and route definitions.
• apps/car and apps/station have their own src/ pages, navigation, state stores (persisted/shared-data), and use apps/shared as a dependency.
• src/server/router.ts and src/server/routes/* implement REST endpoints (registerCar, registerStation, startCharging, reserve, stationSuggestions, etc.).
• Shared code (apps/shared) contains UI components (Navigator, ScrollView, cards), a typed API client (src/api/client.ts), contexts, storage libs, and TCP/log utilities.
README for Insights
• Confirms: Node.js + Yarn 4 workspaces; Docker for containerized runs; Zod for validation; Vitest for tests; core features: register users/stations, manage charging sessions, recommendations, payments.
1. Car Client App (apps/car)
2. Station Client App (apps/station)
3. Shared Library (apps/shared)
4. Server API (src/server)
5. Data Layer (src/server/data/data.ts or pluggable DB)
6. CLI Utilities (src/car.ts, src/station.ts) – optional inset
• Both client apps import Common UI & API client from Shared Library.
• Car/Station UIs → HTTP requests → Server Router → Route Handlers → Data Layer.
• Server route handlers use Zod schemas (src/schemas) and business logic (main.ts) for recommendations.
• CLI utils use the same API client against the Server endpoint (for testing or automation).
• docker-compose orchestrates containers: car, station, server.
c. Architectural Patterns & Principles
• Monorepo with Yarn Workspaces – single root coordinating multiple packages.
• Layered architecture in Server: Router → Controllers (routes) → Business Logic → Data Store.
• Shared component library for DRY UI and API client code.
• Zod‑based schema validation ensuring type safety at the edge.
• Clear separation of concerns: Frontends vs. Backend vs. Shared libs.
d. Key Technologies & Frameworks
• TypeScript, Node.js, React (Native)
• Yarn Workspaces, Docker, docker‑compose
• Zod for validation, Vitest for testing
• React Navigation, Context API, custom storage libs