|
4 | 4 |
|
5 | 5 | **SEGECS** is a high-performance academic governance solution, specifically designed to centralize, automate, and monitor the complete lifecycle of the Supervised Curricular Internship. The platform acts as an intelligent bridge between educational institutions, partner companies, and students, eliminating manual bureaucracies and ensuring full compliance with **Brazilian Law No. 11,788/2008**. |
6 | 6 |
|
7 | | -Unlike generic systems, SEGECS offers a **multi-training** architecture, allowing coordinators to simultaneously manage various technical and professional courses (such as Nursing, Administration, Networking, Building Construction, among others). Each course has its own workload and competency settings, allowing the institution to scale its internship operations without losing individualized control over each contract. |
| 7 | +## 🏛️ System Architecture (On-Premises / Local LAN) |
8 | 8 |
|
9 | | -With a modern, data-driven interface, the system transforms pedagogical monitoring, previously scattered across papers and spreadsheets, into real-time strategic indicators, providing legal security through automated document generation and technical integrity through rigorous data protection policies. |
10 | | - |
11 | | -## 🏛️ System Architecture |
12 | | - |
13 | | -SEGECS uses a modern architecture based on **SPA (Single Page Application)** with a **Serverless** infrastructure, ensuring scalability, security, and high performance. |
| 9 | +This version of SEGECS is optimized for **100% on-premises deployment**, designed to function flawlessly in localized LAN environments with zero external internet connectivity. |
14 | 10 |
|
15 | 11 | ### 🏗️ Tech Stack |
16 | 12 |
|
17 | 13 | - **Frontend:** [React 18](https://react.dev/) with [Vite](https://vitejs.dev/) and [TypeScript](https://www.typescriptlang.org/). |
18 | | -- **Styling:** [TailwindCSS](https://tailwindcss.com/) and [Framer Motion](https://www.framer.com/motion/) for fluid animations. |
19 | | -- **Backend-as-a-Service:** [Supabase](https://supabase.com/) (PostgreSQL, Auth, RLS, and Realtime). |
20 | | -- **State Management:** [React Query (TanStack)](https://tanstack.com/query/latest) for caching and data synchronization. |
21 | | -- **Forms:** [React Hook Form](https://react-hook-form.com/) integrated with [Zod](https://zod.dev/) for rigorous validation. |
22 | | -- **Documentation:** [@react-pdf/renderer](https://react-pdf.org/) for dynamic PDF generation on the client side. |
23 | | -- **Localization:** [i18next](https://www.i18next.com/) for multi-language support (Portuguese and English). |
24 | | - |
25 | | -### 🛡️ Security Layer |
26 | | - |
27 | | -- **Supabase Auth:** Secure authentication with configurable session persistence ("Remember me"). |
28 | | -- **Row Level Security (RLS):** Access policies directly in the database ensuring students see only their data, while coordinators access the management view. |
29 | | -- **Snapshot Logic:** Workloads are copied to contracts at the time of creation, protecting historical records against future changes in the curriculum. |
| 14 | +- **Styling:** [TailwindCSS](https://tailwindcss.com/) and [Framer Motion](https://www.framer.com/motion/). |
| 15 | +- **Database & Backend:** Self-hosted [Supabase](https://supabase.com/docs/guides/self-hosting) (PostgreSQL, Auth, PostgREST, and Realtime) running in Docker. |
| 16 | +- **Containerization:** [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/). |
| 17 | +- **Web Server:** [Nginx](https://nginx.org/) (Alpine-based) serving the frontend SPA. |
30 | 18 |
|
31 | 19 | ## 🚀 Key Features |
32 | 20 |
|
33 | | -### 📋 Administrative Management (Multi-Course) |
34 | | - |
35 | | -- **Customizable Courses:** Registration of any training with specific mandatory workload definition. |
36 | | -- **Partner Management:** Control of companies with monitoring of agreement validity. |
37 | | -- **Talent Bank:** Detailed registration of students, advisors, and field supervisors. |
38 | | - |
39 | | -### ⚙️ Allocation and Vacancy Flow |
40 | | - |
41 | | -- **Vacancy Management:** Publication and control of opportunities by course and company. |
42 | | -- **Intelligent Allocation:** Automatic link between student, vacancy, advisor, and supervisor. |
43 | | -- **Auto-fill:** The system detects the course workload and suggests contract terms instantly. |
44 | | - |
45 | | -### 📈 Monitoring and Control (Compliance) |
| 21 | +- **Administrative Management:** Multi-course support with customizable technical training definitions. |
| 22 | +- **Allocation & Vacancy Flow:** Intelligent link between students, companies, advisors, and supervisors. |
| 23 | +- **Compliance Monitoring:** Frequency logs, technical visits, and pedagogical evaluations. |
| 24 | +- **Automatic Documentation:** Instant generation of TCE (Commitment Term), Activity Plans, and TRE (Realization Term) as PDFs. |
| 25 | +- **Data Resilience:** Automated local database backups and persistent Docker volumes. |
46 | 26 |
|
47 | | -- **Frequency Log:** Daily entry of activities with time validation. |
48 | | -- **Technical Visits:** Full module for recording in-person or remote monitoring. |
49 | | -- **Pedagogical Evaluations:** Grading and feedback system by period. |
50 | | -- **Intelligence Dashboard:** Distribution charts, expiring contract alerts, and evaluation pending items. |
51 | | - |
52 | | -### 🎓 Automatic Documentation (PDF) |
53 | | - |
54 | | -- **TCE (Commitment Term):** Instant generation according to current legislation. |
55 | | -- **Activity Plan:** Detailing technical competencies in development. |
56 | | -- **TRE (Realization Term):** Final completion document with workload summary. |
57 | | -- **SICE Export:** Preparation of structured CSV data for the SEDUC-CE system. |
58 | | - |
59 | | -## 🚦 Getting Started |
| 27 | +## 🚦 Getting Started (Development) |
60 | 28 |
|
61 | 29 | ### 📋 Prerequisites |
62 | 30 |
|
63 | 31 | - **Node.js** (v18+) |
64 | | -- **npm** or **pnpm** |
65 | | -- **Supabase** Instance |
| 32 | +- **pnpm** (preferred) |
| 33 | +- **Docker & Docker Compose** |
66 | 34 |
|
67 | | -### ⚙️ Installation and Configuration |
| 35 | +### ⚙️ Development Setup |
68 | 36 |
|
69 | 37 | 1. **Clone and Install:** |
70 | 38 |
|
71 | 39 | ```bash |
72 | 40 | git clone https://github.com/prof-raimundo/segecs.git |
73 | 41 | cd segecs |
74 | | - npm install |
| 42 | + pnpm install |
75 | 43 | ``` |
76 | 44 |
|
77 | | -2. **Configure Environment Variables:** |
78 | | - Create a `.env` file in the root: |
| 45 | +2. **Configure Environment:** |
| 46 | + Create a `.env` file based on `.env.example`: |
79 | 47 |
|
80 | 48 | ```env |
81 | | - VITE_PUBLIC_SUPABASE_URL=your_supabase_url |
82 | | - VITE_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your_anon_key |
| 49 | + VITE_PUBLIC_SUPABASE_URL=http://localhost:8000 |
| 50 | + VITE_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your_local_anon_key |
83 | 51 | ``` |
84 | 52 |
|
85 | | -3. **Configure Database:** |
86 | | - - Run the script in `database/supabase_schema.sql` in the Supabase SQL editor. |
87 | | - - (Optional) Run `database/seed.sql` to populate the system with test data (70 users, 15 visits, frequencies, etc.). |
88 | | - |
89 | | -4. **Run:** |
| 53 | +3. **Run Dev Server:** |
90 | 54 | ```bash |
91 | | - npm run dev |
| 55 | + pnpm dev |
92 | 56 | ``` |
93 | 57 |
|
| 58 | +--- |
| 59 | + |
| 60 | +## 📦 On-Premises Deployment (Production) |
| 61 | + |
| 62 | +To deploy SEGECS on a local server for LAN access, follow these steps: |
| 63 | + |
| 64 | +### 1. Initialize Supabase Self-Hosted Stack |
| 65 | + |
| 66 | +Run the automated setup script to fetch and configure the official Supabase Docker repository: |
| 67 | + |
| 68 | +```bash |
| 69 | +chmod +x scripts/setup_supabase.sh |
| 70 | +./scripts/setup_supabase.sh |
| 71 | +``` |
| 72 | + |
| 73 | +**Configuration steps inside `supabase-project/`:** |
| 74 | + |
| 75 | +- Run `sh ./utils/generate-keys.sh` to secure your JWT and API keys. |
| 76 | +- Edit `supabase-project/.env` and update `SITE_URL`, `SUPABASE_PUBLIC_URL`, and `API_EXTERNAL_URL` with your **Server's LAN IP** (e.g., `http://192.168.1.100:8000`). |
| 77 | +- Change default passwords for `POSTGRES_PASSWORD` and `DASHBOARD_PASSWORD`. |
| 78 | +- Start the backend: `docker compose up -d`. |
| 79 | + |
| 80 | +### 2. Deploy Frontend Container |
| 81 | + |
| 82 | +Configure your local `.env` with the same LAN IP and the `ANON_KEY` generated in the previous step, then build and start the frontend: |
| 83 | + |
| 84 | +```bash |
| 85 | +# Update .env with your LAN IP |
| 86 | +docker compose up -d --build |
| 87 | +``` |
| 88 | + |
| 89 | +The application will be accessible to all devices on the LAN at `http://<SERVER_LAN_IP>`. |
| 90 | + |
| 91 | +### 3. Database Resilience (Backups) |
| 92 | + |
| 93 | +A backup script is provided in `scripts/backup_db.sh`. It is recommended to schedule this via `cron` on the host machine: |
| 94 | + |
| 95 | +```bash |
| 96 | +# Example: Daily backup at 2 AM |
| 97 | +0 2 * * * /path/to/segecs/scripts/backup_db.sh |
| 98 | +``` |
| 99 | + |
94 | 100 | ## 📂 Folder Structure |
95 | 101 |
|
96 | 102 | ```text |
97 | | -src/ |
98 | | -├── app/ # Global configurations, routes, and providers |
99 | | -├── components/ # Reusable UI components (Pagination, Loading, etc.) |
100 | | -├── features/ # Business modules (students, internships, visits, etc.) |
101 | | -│ └── [feature]/ # Specific components, pages, and services |
102 | | -├── hooks/ # Custom hooks (usePagination, useAuth, useSupabaseCrud) |
103 | | -├── i18n/ # Localization configuration and translation files |
104 | | -├── lib/ # Library configurations (supabase client, utils) |
105 | | -└── types/ # TypeScript type definitions and database types |
| 103 | +segecs/ |
| 104 | +├── database/ # SQL schema and seed files |
| 105 | +├── nginx/ # Nginx production configuration |
| 106 | +├── scripts/ # Setup and backup automation scripts |
| 107 | +├── src/ |
| 108 | +│ ├── app/ # Global configurations and routes |
| 109 | +│ ├── components/ # Reusable UI components |
| 110 | +│ ├── features/ # Business modules (students, internships, etc.) |
| 111 | +│ ├── hooks/ # Custom React hooks |
| 112 | +│ └── lib/ # Supabase client and utilities |
| 113 | +├── Dockerfile # Multi-stage production build |
| 114 | +└── docker-compose.yml # Frontend orchestration |
106 | 115 | ``` |
107 | 116 |
|
108 | 117 | ## 📄 License |
109 | 118 |
|
110 | 119 | Distributed under the MIT License. See `LICENSE` for more information. |
111 | 120 |
|
112 | 121 | <p align="center"> |
113 | | - Developed with ❤️ to transform technical education. |
| 122 | + Developed with ❤️ to transform technical education in localized environments. |
114 | 123 | </p> |
0 commit comments