How aydev-fr/isen-api works
Project Type and Purpose
• The project is a REST API written in Golang designed to scrape and expose information from Aurion’s ENT (note manager) as well as ISEN-related data (notations, absences, planning, etc.).
• The README explains that the service takes user credentials or tokens, scrapes the corresponding web interfaces (Aurion, ISEN), then processes and sends the data back via REST endpoints. This makes it a middleware/scraping API with RESTful endpoints.
• It is a backend-focused API service intended either for public consumption (with caution regarding sensitive credentials) or self-hosting.
Analysis of the File Structure
• Top-Level Files:
• Files such as Dockerfile, docker-compose.yaml, Caddyfile, and certificates indicate containerized deployment and perhaps the use of a reverse proxy (Caddy) to manage HTTPS.
• CHANGELOG.md, LICENSE, and README indicate a well-documented open-source project.
• Source Files and Directories:
• main.go: Entry point for the Go application.
• pkg/ directory: The core logic is modularized inside:
• pkg/api: Contains API routing (routers.go), caching (cache.go), and variants (e.g., fake.go) which suggests different implementation strategies or testing endpoints.
• pkg/aurion: Houses scrapping logic for Aurion such as login, navigation, schedule extraction, sidebar management, and table/view state processing.
• pkg/isen: Contains functionality related to ISEN such as absences, notations, personal info, and planning.
• Documentation:
• The docs folder contains API documentation (Swagger JSON/YAML) indicating that the API’s contract is formally documented.
• CI/CD & Security:
a. Main Components:
• API Gateway / Entry Point: Represented by main.go that starts the server and establishes the API endpoints.
• REST API Layer: Illustrate pkg/api, highlighting:
◦ API routing (routers.go): Handling incoming requests to endpoints like /v1/token, /v1/notations, /v1/absences, /v1/agenda.
◦ Caching mechanism (cache.go) that may improve performance.
• Scraping/Processing Modules:
◦ pkg/aurion: Responsible for logging in and scraping data from Aurion’s ENT (e.g., login, schedule, navigation).
◦ pkg/isen: Handles ISEN-specific scrapping tasks such as retrieving absences, notations, personal info, and planning.
• External Clients: Clients making HTTP requests to the REST API (as shown in README usage examples).
• Deployment & Infrastructure:
◦ Docker and Docker Compose: Containerization of the API.
◦ Caddy (via Caddyfile): Web server/reverse proxy for secure, production-grade HTTPS routing.
◦ Certificates: For ensuring secure connections.
b. Relationships and Interactions:
• Within the API Gateway, show routing decisions: incoming requests based on endpoints are directed to the appropriate handling functions.
• That the API layer calls the underlying scrapers in pkg/aurion and pkg/isen to fulfill the requests.
• Optionally, include CI/CD pipelines (GitHub workflows) as supporting infrastructure for automatic builds, testing, and deployment (especially if it’s important in the deployment environment).
c. Architectural Patterns and Technologies:
• Modular organization, with clear separation between the API interface (pkg/api) and business logic (pkg/aurion and pkg/isen).
• Point out the use of the REST architectural style.
• Use of containerization (Docker) and a reverse proxy (Caddy) for deployment.
• External dependencies such as Goquery for scraping and possibly additional libraries (Golang standard libraries).