thomas-br / unifi-hotspot-portal

Captive Portal for Guest Wifi with Unifi
MIT License
15 stars 1 forks source link

Initial Release Scope #2

Open thomas-br opened 1 year ago

thomas-br commented 1 year ago

I started a branch feature/initial-release-scope to collaborate on the initial release scope.

Project Overview

The project is split into a frontend project (based on React & Gatsby.js; representing the hotspot portal accessed by the client) and the backend (built with Strapi) for the required APIs, server logic (Telegram & Unifi) & admin UI (maintaining supported sites & data for a given connection to the Unifi Controller).

Backend

The development environment for Strapi is based on node & yarn (npm). To install the required dependencies run yarn install on project root. Using yarn develop the backend server can be started and will listen by default on port 1337.

For the moment a local sqlite database is being used. Later for a productive usage, a real db (for example containerd) is recommended. Configuration (see config files in folder ./config as well as the Strapi documentation) would need to be changed in order to connect to, for example a mariadb.

The datamodel and service logic can be found under ./src/api. See the Strapi Documentation for details. In a nutshell:

Frontend

The frontend ca. be found in the subfolder ./ui. Dependencies can be installed using yarn install. Additionally the gatsby-cli is required. The development server can be run using yarn develop, by default starting on port 8000.

Please note that for productive usage the frontend is built into static HTML/JS files using the build script, which results in the build result to be stored in the folder ./ui/public. It is foreseen that the built UI is being put to the public folder (see docs), thus being then hosted by strapi. (In theory this is not the best approach, but two servers are a bit of an overkill for a hotspot portal solution).

For now the connection to the API using localhost:1337 is hardcoded for development, but needs to be moved into configuration to support development and productive usage.

The basic flow with the hotspot portal & the API works already including the status management. I haven't yet reached the state of testing the authorize guest functionality in the backend, as here I use a different library than before in my private version.

Required work (list to be completed)

Feel free to contribute or ask questions regarding concepts or understanding of certain things below.