This repo is for the Nextspace frontend. It uses React, Typescript, and Next.js. Production is hosted on Vercel. For more info on the Nextspace backend, check out LLM Engine.
Nextspace uses a hybrid authentication model that supports both anonymous participation and authenticated administrative access.
Guest (authType="guest")
Admin (authType="admin")
/login/admin/*)/admin routes are redirected to signupUser (authType="user")
Guest Sessions: When a user visits Nextspace, SessionManager automatically creates a guest session with a pseudonymous identity. This allows users to participate in conversations without creating an account.
Admin Authentication: Administrators log in through /login with credentials. Upon successful authentication, the session cookie is updated with authType: "admin", granting access to administrative features.
Session Management: All sessions (guest and admin) are stored in encrypted HTTP-only cookies using JWT with A128CBC-HS256 encryption. The middleware.ts file validates these cookies and sets the appropriate x-auth-type header for each request.
Route Protection: The middleware automatically:
/admin routes to /signupSESSION_SECRET environment variable must be at least 32 characters for secure cookie encryptionThis view displays what an event moderator uses when assessing insights and metrics that are being generated by participant questions and feedback. If the event has enabled it and it is provided in the URL as a parameter, a transcript view is also visible. The ModeratorScreen function initially attempts to authenticate the user and retrieves an API token, and if successful initializes the socket connection. This socket listens for "message:new" and acts on it as needed.
This view displays what an event participant uses to send in questions and feedback during an event that uses only the Back Channel agent. The nomenclature for this channel being utilized is currently a "backchannel". The BackchannelRoom function initially attempts to register a new pseudonym for the session and sets local API tokens, if successful. It then joins the socket.io instance and the relevant conversation. The SendData utility function is used here to send messages from the user to the API.
This view is for event participants to interact with Event Assistant or Event Assistant Plus. It provides an interface to send and receive direct messages with the agent, and with Event Assistant Plus, to send messages to the moderator. If the event has enabled it and it is provided in the URL as a parameter, a transcript view is also visible.
This project uses the Next.js Pages Router.
components/ Frontend components used across the app; see docs/ for a detailed breakdown of each component.
docs/ Auto-generated static HTML files for code documentation.
hooks/ Custom React hooks used across the app.
pages/ Next.js pages for the app.
[id] and [type] and renders an Event component.[id] and renders an EventStatus component.utils/ Various utilities used across the app; see docs/ for a detailed breakdown of each method.
Please see the .env.template file to see all available parameters. Copy it to .env and fill in the required values.
The application will fail to start if any required environment variables are missing, with clear error messages indicating which variables need to be set.
These variables must be set for the application to run:
NEXT_PUBLIC_API_URL=<your-backend-url>
The URL you are using to interact with the backend API, e.g. http://localhost:3000/v1
NEXT_PUBLIC_SOCKET_URL=<your-socket-url>
The URL to the socket.io instance, e.g. "ws://localhost:5555/?EIO=4&transport=websocket"
NEXT_PUBLIC_DEFAULT_TOPIC_ID=<topic-id>
The ID of the default topic for submitting new events; used within the event creation form
NEXT_PUBLIC_ABOUT_URL=<about-url>
The URL for the About page footer link
SESSION_SECRET=<secret-key>
Crypto key used to encrypt session cookies with A128CBC-HS256 algorithm
Must be at least 32 characters (256 bits)
Generate securely: openssl rand -base64 32
See https://github.com/panva/jose/issues/210#jwe-alg
It is strongly recommended that you utilize NVM to initiate the version of node recommended by this repo (the minimum version is node 22.0.0):
nvm install
npm install
npm run openapi-types:generate http://localhost:3000/v1/openapi.json
This app uses a types file types.ts dynamically generated against the LLM Engine backend server.
The above example generates types against LLM Engine running locally. You can also provide a URL to a remotely hosted LLM Engine instance if you prefer.
On default port 8080:
npm run dev
OR, to run on a different port if needed
npm x next -- dev -p <PORT>
Open http://localhost:8080 with your browser to see the result.
access.token in the login responseNEXT_PUBLIC_LLM_FCLTR_TOPIC_ID in your .env file. The conversation ID can be found in the response body created in 3b. You can also find it in the Environment view in Postman under the “Current value” column.Note: A collection of debugging configurations is provided when using VS Code. For help with the debugging in other IDEs or in devtools, see here.
NextSpace currently uses the following URL convention when loading either the moderator or back channel view:
.../<moderator|backchannel>?conversationId=<ID>&channel=<channel,password>
So a full example of this on your local instance might look like
This would load the moderator view with both the backchannel insights/metrics and transcript.
The conversationId and passcodes can be found in the response body from step 2b. It should look like this:
"channels": [
{
"_id": "12345678",
"name": "moderator",
"passcode": "xxxxxx",
"__v": 0
},
{
"_id": "12345678",
"name": "participant",
"passcode": "xxxxxx",
"__v": 0
}
],
The transcript channel password is provided only if you are utilizing one of the API endpoints that includes that as a channel (under "With Transcription" in Postman).
This repo automatically has changes deployed to Vercel via the Vercel for GitHub app. Changes merged to the main branch will be deployed to production, while any feature branch will automatically be deployed to a preview URL. If you have forked this repo and want to deploy changes without usage of this app, you can do so via the CLI.
Nextspace includes built-in open source Matomo Tag Manager integration for comprehensive analytics tracking:
The implementation is privacy-friendly (pseudonymized IDs, no message content tracking) and can be easily disabled via environment variable. Analytics gracefully degrades if Matomo isn't configured—the site continues to function normally.
To disable analytics:
NEXT_PUBLIC_ENABLE_ANALYTICS=false
To enable analytics (requires Matomo Tag Manager setup):
NEXT_PUBLIC_ENABLE_ANALYTICS=true # or omit (enabled by default)
Nextspace is AGPL 3.0 licensed.
Please see CONTRIBUTING.md.