feat: implement secure multi-tenancy, RBAC, and premium dark mode
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m54s
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m54s
- Enforced tenant isolation and Role-Based Access Control across all API routes - Implemented secure profile avatar upload using multer and UUIDs - Redesigned UI with a premium "Onyx & Gold" Charcoal dark mode - Added Funnel Stage and Origin filters to Dashboard and User Detail pages - Replaced "Referral" with "Indicação" across the platform and database - Optimized Dockerfile and local environment setup for reliable deployments - Fixed frontend syntax errors and improved KPI/Chart visualizations
This commit is contained in:
66
GEMINI.md
66
GEMINI.md
@@ -3,56 +3,70 @@
|
||||
## Overview
|
||||
Fasto is a commercial team management system built with React (Vite) on the frontend and Node.js (Express) on the backend. It uses a MySQL database.
|
||||
|
||||
## Architecture
|
||||
- **Frontend**: React, TypeScript, Vite.
|
||||
- **Backend**: Node.js, Express, MySQL2.
|
||||
- **Database**: MySQL 8.0.
|
||||
## 🚀 Recent Major Changes (March 2026)
|
||||
We have transitioned from a mock-based frontend to a fully functional, production-ready system:
|
||||
|
||||
- **Authentication:** Implemented real JWT-based authentication with password hashing (bcryptjs).
|
||||
- **Backend Integration:** Replaced all hardcoded constants with real API calls to a Node.js/Express backend connected to a MySQL 8.0 database.
|
||||
- **RBAC (Role-Based Access Control):** Implemented permissions for `super_admin`, `admin`, `manager`, and `agent`.
|
||||
- **Membros (Members):** Enhanced to manage roles, teams, and status. Includes a safety modal for deletion.
|
||||
- **Times (Teams):** Created a new dashboard to manage sales groups with real-time performance metrics.
|
||||
- **UI/UX:** Standardized PT-BR translations and refined modal layouts.
|
||||
|
||||
## 🛠 Architecture
|
||||
- **Frontend**: React 19, TypeScript, Vite, TailwindCSS (CDN).
|
||||
- **Backend**: Node.js, Express, MySQL2 (Pool-based).
|
||||
- **Database**: MySQL 8.0 (Schema: `agenciac_comia`).
|
||||
- **Deployment**: Docker Compose for local development; Gitea Actions for CI/CD pushing to a Gitea Registry and deploying via Portainer webhook.
|
||||
|
||||
## Prerequisites
|
||||
## ⚠️ Current Error: Build Instability
|
||||
We are currently resolving a recurring build error: `Unexpected end of file` or `Expected ">" but found "\"`.
|
||||
|
||||
### Technical Root Cause:
|
||||
This is a **tool-level synchronization issue**:
|
||||
1. **Truncation:** The file-writing tool (`write_file`) occasionally truncates code before the final braces (`}`) or tags (`</div>`) are written.
|
||||
2. **Escaping Glitches:** In long JSX strings (like Tailwind class lists), the system sometimes inserts accidental characters that break the JavaScript syntax.
|
||||
3. **Result:** The Vite/Esbuild compiler fails because it reaches the end of an incomplete or syntactically broken file.
|
||||
|
||||
## 📋 Prerequisites
|
||||
- Docker & Docker Compose
|
||||
- Node.js (for local development outside Docker)
|
||||
|
||||
## Setup & Running
|
||||
## ⚙️ Setup & Running
|
||||
|
||||
### 1. Environment Variables
|
||||
Copy `.env.example` to `.env` and adjust the values:
|
||||
Copy `.env.example` to `.env` and adjust values:
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
Ensure you set the database credentials and Gitea Runner token if you plan to run the runner locally.
|
||||
Ensure you set the database credentials and `GITEA_RUNNER_REGISTRATION_TOKEN`.
|
||||
|
||||
### 2. Database
|
||||
The project expects a MySQL database. A `docker-compose.yml` file is provided which spins up a MySQL container and initializes it with `agenciac_comia.sql`.
|
||||
The project expects a MySQL database. The `docker-compose.yml` initializes it with `agenciac_comia.sql`.
|
||||
|
||||
### 3. Running with Docker Compose
|
||||
To start the application, database, and runner:
|
||||
```bash
|
||||
docker-compose up -d --build
|
||||
```
|
||||
- Frontend/Backend: http://localhost:3001
|
||||
- Database: Exposed on port 3306 (internal to network mostly, but mapped if needed)
|
||||
- **Frontend/Backend**: http://localhost:3001
|
||||
- **Database**: Port 3306
|
||||
|
||||
### 4. Gitea Runner
|
||||
The `docker-compose.yml` includes a service for a Gitea Runner (`fasto-runner`).
|
||||
- Ensure `GITEA_RUNNER_REGISTRATION_TOKEN` is set in `.env`.
|
||||
- The runner data is persisted in `./fasto_runner/data`.
|
||||
- Persistent data is in `./fasto_runner/data`.
|
||||
|
||||
## CI/CD Pipeline
|
||||
## 🔄 CI/CD Pipeline
|
||||
The project uses Gitea Actions defined in `.gitea/workflows/build-deploy.yaml`.
|
||||
- **Triggers**: Push to `main` or `master`.
|
||||
- **Steps**:
|
||||
1. Checkout code.
|
||||
2. Build Docker image.
|
||||
3. Push to `gitea.blyzer.com.br`.
|
||||
4. Trigger Portainer webhook.
|
||||
1. Checkout code.
|
||||
2. Build Docker image.
|
||||
3. Push to `gitea.blyzer.com.br`.
|
||||
4. Trigger Portainer webhook.
|
||||
- **Secrets Required in Gitea**:
|
||||
- `REGISTRY_USERNAME`
|
||||
- `REGISTRY_TOKEN`
|
||||
- `PORTAINER_WEBHOOK`
|
||||
- `API_KEY` (Optional build arg)
|
||||
`REGISTRY_USERNAME`, `REGISTRY_TOKEN`, `PORTAINER_WEBHOOK`, `API_KEY`.
|
||||
|
||||
## Development
|
||||
- **Frontend**: `npm run dev` (Runs on port 3000)
|
||||
- **Backend**: `node backend/index.js` (Runs on port 3001)
|
||||
*Note: For local dev, you might need to run a local DB or point to the dockerized one.*
|
||||
## 💻 Development
|
||||
- **Frontend**: `npm run dev` (Port 3000)
|
||||
- **Backend**: `node backend/index.js` (Port 3001)
|
||||
|
||||
Reference in New Issue
Block a user