AWS Builder Center
Building an AI-Powered Club Member Portal with RAG and Secure Authentication

Building an AI-Powered Club Member Portal with RAG and Secure Authentication

AI-Powered Club Member Portal An AI-powered Club Member Portal that combines secure authentication, document management, and Retrieval-Augmented Generation (RAG) to provide students with accurate, document-grounded club information. Administrators can publish and update documents with automatic re-indexing and real-time synchronization, while members can ask questions through a chatbot that provides verified answers with source citations and safe fallback responses.



Introduction
The project began as a Club Member Portal designed to provide students with a secure and centralized platform for accessing official club information. As the project evolved, it was extended with Artificial Intelligence and Retrieval-Augmented Generation (RAG) to create an intelligent information assistant.
The main objective was to allow authenticated club members to access documents, communicate through the existing portal, and ask questions about official club information through a chatbot. The chatbot was designed with an important restriction: it should answer questions only using information available in the club's documents rather than relying on general AI knowledge.
The project was developed as an extension of an existing application rather than as a completely new system. The existing authentication, member accounts, chat, document search, user interface, and RAG functionality were preserved while the remaining functionality was added.
  1. Existing Portal Development
The first stage involved building the core Club Member Portal.
The application was developed using a full-stack architecture consisting of a frontend, Node.js and Express.js backend, database services, authentication, and document-processing components.
The portal provided secure member authentication and allowed users to access their accounts after logging in. Existing user sessions and account information were maintained through the authentication system.
The application also included a member dashboard where users could access club-related functionality without needing multiple separate systems.
  1. Authentication and Security
Authentication was implemented as one of the fundamental components of the portal.
Users could securely log in to their accounts, while protected routes ensured that unauthorized users could not access member-specific functionality.
Password recovery functionality was also integrated using email services through Nodemailer.
Security was considered throughout the application. Authentication secrets, API keys, passwords, database credentials, and private information were kept outside the application source code through environment variables.
The system was also designed to avoid logging sensitive information.
  1. Database Integration
A database was integrated with the backend to store application information.
The database was responsible for maintaining information required by the portal, including users, documents, and other application-related data.
The existing database structure was reused wherever possible instead of creating duplicate systems.
As the RAG functionality expanded, document metadata and indexing information were also maintained so that the application could track the status of documents and their associated indexed content.
  1. Document Management
One of the most important parts of the project was integrating official club documents into the portal.
Documents could contain information such as:
  • Club policies
  • Event information
  • Schedules
  • Deadlines
  • Builder resources
  • Workshop information
  • Event-day instructions
The system processed these documents and extracted their text so that the information could be used by the RAG system.
Documents were divided into smaller sections called chunks. Chunking makes it possible to retrieve only the most relevant portions of a document when a user asks a question.
  1. Embedding and Vector Search
After documents were converted into chunks, embeddings were generated for those chunks.
An embedding represents the semantic meaning of text as a numerical vector. These vectors allow the system to find documents or document sections that are semantically related to a user's question.
The existing embedding and retrieval architecture was reused rather than replacing the entire RAG system.
When a user asks a question, the question is converted into an embedding and compared against the indexed document chunks.
The most relevant chunks are then retrieved and supplied to the chatbot.
  1. Building the RAG Chatbot
The chatbot was developed using Retrieval-Augmented Generation.
Instead of allowing the AI model to answer freely, the system first searches the club's knowledge base.
The process is:
User asks a question ↓ Question is converted into an embedding ↓ Relevant document chunks are retrieved ↓ Retrieved information is provided to the AI model ↓ AI generates a grounded answer ↓ Sources are returned with the answer
This approach makes the chatbot useful for answering questions about official club information while reducing unsupported responses.
  1. Grounded AI Responses
A major design requirement was that the chatbot should answer only from club documents.
For example, if a member asks about an event schedule, the chatbot must retrieve the relevant event document before generating an answer.
If the required information cannot be found, the system should not guess.
Instead, it provides a safe response such as:
"I could not find that information in the club documents. Please contact the AWS Student Builder Group Leader."
This prevents the AI from inventing schedules, rooms, deadlines, policies, or other club information.
  1. Source Citations
Source tracking was added throughout the RAG pipeline.
Every retrieved document chunk maintains metadata such as the document name, chunk identifier, ranking, and relevance score.
A chatbot response can therefore contain information such as:
Answer:
"Judging has moved to Room B."
Sources:
  1. event-day-briefing.md Relevance: 0.91
This allows users and judges to verify where the chatbot obtained its information.
Fake sources or manually generated source names are not used.
  1. Admin Document Management
The next phase extended the existing portal with administrator functionality.
Authenticated administrators can access a document-management section.
The administrator can:
  • Upload a document
  • Paste document content
  • Provide a document name
  • Publish a document
  • Update an existing document
  • Monitor indexing status
The interface displays useful document information such as filename, document type, publication date, last updated time, and indexing status.
Possible indexing states include:
  • Published
  • Indexing
  • Indexed
  • Failed
This provides administrators with visibility into the knowledge-base update process.
  1. Automatic Re-Indexing
A major requirement of the extension was removing the need to restart the application whenever a document changes.
When an administrator publishes a document, the backend immediately starts the indexing process.
The process is:
Admin publishes document ↓ Document is saved ↓ Text is extracted ↓ Content is chunked ↓ Embeddings are generated ↓ Old chunks are replaced when necessary ↓ New chunks are inserted into the index ↓ Document is marked as indexed ↓ Knowledge base is updated
This allows newly published information to become available to the chatbot within approximately 60 seconds.
  1. Updating Existing Documents
The system also supports updating documents.
When an existing document is modified, its previous indexed chunks should not remain alongside the new version.
Instead, the previous document chunks are removed or replaced before the new chunks are inserted.
This prevents duplicate or outdated information from being retrieved by the chatbot.
The document metadata also records information such as version, update time, and indexing status.
  1. Real-Time Knowledge-Base Updates
Another important improvement was live synchronization.
Previously, users could have needed to refresh the browser to see changes.
The extended system uses the existing realtime architecture where available.
When indexing finishes, the server can emit an event such as:
"knowledge-base:updated"
or:
"document:indexed"
Connected clients receive the event and update their document lists.
A small notification such as:
"Knowledge base updated — new documents are now available."
can inform users without interrupting their current session.
  1. Live Chat Synchronization
The chatbot does not require users to restart an existing chat session after an administrator publishes a document.
Once indexing is complete, the next question automatically uses the latest retrieval index.
Therefore, the flow becomes:
Administrator publishes document ↓ Document is indexed ↓ Knowledge base is updated ↓ Member continues existing chat ↓ Next question searches the updated knowledge base
This makes the system suitable for live events where information can change shortly before or during an event.
  1. Event-Day Briefing
A required document named "event-day-briefing.md" was added to the knowledge base.
This document contains important event information such as:
  • Today's schedule
  • Rooms
  • Judging times
  • Deadlines
The document is indexed like other club documents.
When a member asks a question related to the event schedule, the RAG system retrieves the appropriate section.
The chatbot response also identifies "event-day-briefing.md" as the source.
This demonstrates that the chatbot is actually using the club knowledge base instead of relying on general AI knowledge.
  1. Smoke Testing
A smoke-test system was introduced to validate the core RAG functionality.
The required questions are maintained through "09-smoke-test-questions.md".
The testing interface displays:
  • Test question
  • Expected source
  • Actual answer
  • Actual sources
  • PASS/FAIL result
A test is marked PASS only when the system produces an answer, retrieves the expected source, and produces an answer grounded in the retrieved content.
The system does not hardcode PASS results.
This provides a simple way for the development team and judges to verify the RAG pipeline.
  1. POST /ask API
A strict API endpoint was implemented for external evaluation.
The endpoint is:
"POST /ask"
It accepts:
{ "question": "What is today's judging schedule?" }
The response contains the required top-level structure:
{ "answer": "The grounded answer...", "sources": [ { "document": "event-day-briefing.md", "rank": 1, "score": 0.91 } ] }
The response is not wrapped inside "data", "result", or another object.
This allows an evaluator or another application to directly access "answer" and "sources".
  1. API Error Handling
The API also handles invalid requests.
Examples include:
  • Missing question
  • Empty question
  • Malformed JSON
  • Retrieval failures
  • Indexing problems
  • AI provider errors
The server returns clear error messages without exposing internal stack traces, API keys, passwords, or other sensitive information.
  1. LAN and Event-WiFi Support
For the event demonstration, the backend is configured to listen on:
"0.0.0.0:8080"
Instead of binding only to "127.0.0.1", this allows other devices on the same local network to access the API.
The endpoint can therefore be accessed using:
"http://<machine-ip>:8080/ask"
CORS and frontend configuration are also designed to support communication across the local network.
This is useful when judges need to test the API from another machine connected to the event Wi-Fi.
  1. Admin Dashboard
A simple administrative dashboard was added without replacing the existing portal UI.
The dashboard can contain sections such as:
  • Overview
  • Documents
  • Knowledge Base
  • Smoke Tests
  • API Status
The Knowledge Base section provides information about the number of documents, indexed documents, indexing documents, failed documents, and the latest synchronization time.
The API Status section provides information about the server and "/ask" endpoint.
  1. Member Experience
The existing member experience was preserved.
Members continue to have access to:
  • Their account
  • Existing dashboard
  • Existing chat
  • Existing document search
  • Existing portal features
The new functionality is integrated rather than replacing the existing interface.
Chat responses now display their sources clearly below the AI answer.
The document section can also show updated timestamps and live knowledge-base notifications.
  1. AWS Architecture Concept
Although live AWS deployment was not the primary goal of the three-hour extension, the architecture was designed with future cloud deployment in mind.
A conceptual AWS architecture could map:
Document storage → Amazon S3
Document publishing → AWS Lambda
Document processing → Lambda or processing service
Vector search → Amazon OpenSearch or equivalent
RAG generation → Amazon Bedrock
API → API Gateway and backend service
Realtime communication → AWS WebSocket-compatible architecture
This architecture is presented as a future deployment concept and is not falsely represented as a currently deployed AWS system.
  1. Complete System Workflow
The final system can be understood through the following workflow:
Administrator logs in ↓ Administrator uploads or updates a document ↓ Document is published ↓ Backend saves the document ↓ Text is extracted and chunked ↓ Embeddings are generated ↓ Vector/search index is updated ↓ Document becomes searchable ↓ Realtime update is sent to connected clients ↓ Member dashboard updates automatically ↓ Member asks a question ↓ Latest knowledge base is searched ↓ Relevant chunks are retrieved ↓ AI generates a grounded response ↓ Sources are returned ↓ Member sees the answer and citations
  1. Final Validation
Before the final demonstration, the application is validated against the main requirements.
The validation includes checking:
  • Existing authentication
  • Existing member accounts
  • Existing chat
  • Existing document search
  • Admin document upload
  • Document updates
  • Automatic indexing
  • Latest-content retrieval
  • Live document updates
  • Event-day briefing retrieval
  • Source citations
  • Safe fallback responses
  • Three smoke tests
  • POST /ask
  • Exact API response structure
  • Port 8080
  • "0.0.0.0" binding
  • LAN connectivity
  • CORS configuration
  • Security and secret protection
Conclusion
The project evolved from a traditional Club Member Portal into an AI-powered, document-grounded information platform.
The key achievement was not simply adding a chatbot, but creating a controlled RAG system where official club documents act as the knowledge source.
The extension allows administrators to publish new information, automatically re-index it, and make it available to members without restarting the application or refreshing their browsers.
The chatbot retrieves the latest information, provides grounded answers, and exposes the documents used as sources.
With secure authentication, database integration, document management, automatic indexing, realtime synchronization, source citations, smoke testing, and a standardized "/ask" API, the final system provides a practical foundation for an AI-powered club information assistant while preserving the original portal functionality.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article