Hexdocs Frontend is using Lustre, a single-page application running in client, interacting with the backend through asynchronous HTTP requests.
Running a Lustre application can easily be achieved using Gleam and the Lustre Dev Tools. Lustre Dev Tools is a companion package to Lustre, in charge of compiling, bundling, and running the application in browser.
The application uses environment variables to configure API endpoints. Before running the dev server or building, you must generate the configuration file:
cd config && gleam run -m configThis generates src/hexdocs/config.gleam with default URLs. To customize URLs for
local development:
cd config && \
SEARCH_URL=http://localhost:9200 \
HEXDOCS_URL=http://localhost:4000 \
HEXPM_URL=http://localhost:4001 \
gleam run -m configWith Gleam installed on your path, you can directly start the development server using Lustre Dev Tools.
gleam run -m lustre/dev startThe application will be running at http://localhost:1234.
Building the application can be done with the Lustre Dev Tools too.
gleam run -m lustre/dev build- All source files reside in
srcfolder. - There's no
index.htmlin the sources, as the file is automatically generated by Lustre Dev Tools with the configuration written ingleam.toml. hexdocs.cssis the entrypoint for CSS for the application. Tailwind is setup in that file.