# PROYECTO FREELANCER
---
## RESUMEN (español)
Se busca desarrollador backend con experiencia en **Python/Flask, JavaScript y MySQL** para ampliar una plataforma de gestión de importación de camiones desde Europa. El sistema ya tiene un backend funcional para las áreas de técnicos, taller y cliente. El trabajo consiste en añadir las nuevas áreas internas (Precompra y Postcompra), mejorar la autenticación y conectar la pasarela de pago con Stripe.
Se proporciona documentación completa: prototipo HTML con todos los flujos definidos y un documento de requisitos detallado en inglés. Plazo aproximado: **5 semanas**. Presupuesto: **800 € – 2.000 €**.
---
## PROJECT DESCRIPTION (English)
We are looking for a backend developer to extend an existing vehicle import management platform built with **Python (Flask) + MySQL**.
### What already exists (do not rebuild)
The platform already has a working backend for:
- Technician area — full inspection workflow, 13-tab form, draft/autosave, multimedia via SFTP, PDF report generation with Playwright.
- Workshop area — client management, inspections, adjustments.
- Client area — panel, inspections, adjustments.
- Public website — static pages, served by Flask.
All of this is in production and must not be broken.
### What needs to be built
**1. Authentication migration (required before anything else)**
The current authentication system needs to be upgraded before adding new areas:
- Migrate to token-based authentication (JWT or Flask sessions).
- Improve password security.
- Add role-based endpoint authorization.
- Review CORS policy.
**2. New user roles and login routing**
Add three new internal roles to the existing login system (inicio_sesion.html):
- PRECOMPRA — redirects to Precompra area after login.
- POSTCOMPRA — redirects to Postcompra area after login.
- ADMIN — access to both areas.
After login, store role and user name in sessionStorage so the frontend builds the correct navigation header automatically.
**3. Precompra area (new — full backend)**
- Lead management: receive leads from website forms (contact, vehicle search, vehicle detail page), create leads manually, manage statuses.
- Internal vehicle stock: add vehicles manually, assign to one or multiple clients, track status (unassigned / assigned / reserved / sold).
- Client file: channel configuration (direct / via workshop / both), proposed vehicles, notes, conversion to Postcompra (with payment validation).
- Connection to technician area: when an inspection is finalised, notify Precompra automatically.
**4. Postcompra area (new — full backend)**
- Import file management with 6 tabs: Documents, Payments, Transport, Homologation, Chat, Activity.
- Phase tracking: advance phases, propagate status updates to client area in real time.
- Homologation incidents: assign to workshop or client, propagate visibility automatically.
- Payment blocking rules: certain phases cannot advance until specific payments are confirmed.
- Completed imports: list, reopen for warranty or post-delivery incidents.
**5. Client area extensions**
- Dashboard showing active phases (reviews, precompra, postcompra).
- Proposed vehicles view: client marks preferences.
- Import tracking: phases, progress, incidents assigned to client.
- Document management: view requested documents and upload them.
- 'I want to import it' button: creates a lead in Precompra automatically.
**6. Workshop area extensions**
- Assigned homologation incidents: view, comment, upload resolution photos.
- Workshop billing: view own earnings from collaborating with IC (never sees IC margins or commissions).
**7. Stripe payment integration (new)**
Integrate Stripe for the paid services on the public website (vehicle search from €69, inspection from €269). After successful payment: create CLIENT account automatically and send credentials by email, create lead in Precompra.
**8. Internal billing — Postcompra (new)**
Invoice management for the internal team: list, summary by concept, mark as paid, send reminders, download PDF.
**9. Account creation and credential delivery**
All accounts are created by Importar Camión — no self-registration. The system must support manual account creation (client, workshop, technician) with automatic credential email delivery.
---
### Technical stack
- **Backend:** Python / Flask
- **Database:** MySQL
- **Production server:** Gunicorn
- **PDF generation:** HTML template to PDF (current implementation needs to be reviewed and improved as part of this project)
- **Frontend:** HTML + vanilla JavaScript (no framework, no build system)
- **Media storage:** SFTP server (separate from the app server)
- **Email:** SMTP
- **Config:** python-dotenv
---
### What you will receive
- Full HTML prototype of all areas with annotated buttons and forms.
- Backend requirements document (English) covering endpoints, business rules, flows and connections between areas. This document reflects the current state — minor details may evolve during development, please flag anything unclear before implementing.
- Existing backend code.
- Document describing what is already implemented and what needs to be built from scratch.
- Server access documentation (SSH, deployment guide).
---
### Requirements
- Solid experience with **Python and Flask**.
- Experience with **MySQL**.
- Experience integrating **Stripe**.
- Ability to work with an existing codebase without breaking it.
- Clear communication — if something in the requirements is unclear or incomplete, flag it before implementing rather than making assumptions.
- Deliver within **5 weeks**.
---
### Budget
€800 – €2,000 depending on experience and approach. Fixed price preferred. Please include a brief breakdown of how you would approach this project in your proposal.
Show More