"FOSSMentoring" is a web application built using Next.js. The project focus on mentoring and opportunities.
Packed with features like markdown blogging, blog feed, mentor feed, scheduling features, availability setup, real-time chat and media share, opportunity board and multiple chaining for API integration, and a lot more.
V1: Instead of building a mentoring platform from scratch, clone and deploy to get a lot of features out of the box, and add additional features as required. (Completed)
V2: Enter certain parameters and get the platform deployed within minutes, all automated. (In progress)
- FOSSMentoring Documentation
- Youtube Product Demo
- API Documentation
- Technologies Used
Clone the repository or download the ZIP file.
Navigate to the project directory.
git clone https://github.com/RajGM/FOSSMentoring.git
Install the dependencies.
cd FOSSMentoring
Install the dependencies.
npm install
Add API keys to .env.local file
Run the development server.
npm run dev
Open your web browser and visit http://localhost:3000 to access the application.
Visit http://localhost:3000 in your browser to access the application.
Route: /pages/index.tsx
Description:
The homepage displays posts based on tags such as "VISA", "SOP", "Blog", and "Essay". It provides functionalities for users to load more posts and navigate through them.
Route: /pages/[username]/index.tsx
Description:
This page allows users to search for mentors. They can search either by organization or by the name of a person. The results will display relevant mentor profiles.
Route: /pages/blog/
Description:
A dedicated space for users to read and explore various blogs. The content can range from informative articles to user experiences and more.
Route: /pages/chat
Description:
This page facilitates communication between users. It provides a platform for direct messaging, group chats, and other communication-related features.
Route: /pages/dashboard
Description:
The dashboard is a central hub for users. It provides functionalities like checking university emails, setting availability, managing sessions, updating profiles, and more. Users can also view their activities and notifications here.
Route: /pages/enter
Description:
This is the entry point for users to log in to the platform. It supports authentication via Google. If a user is logging in for the first time, they will be prompted to choose a username.
Route: /pages/opp
Description:
The opportunities page is dedicated to showcasing various opportunities available for users. This could range from job listings to events or other types of opportunities.
The project uses next/font
to automatically optimize and load Inter, a custom Google Font. For more details on deploying the Next.js app, refer to the Vercel Platform and the Next.js deployment documentation.
Version: 1.0.0
Summary: Add new event
Description: Endpoint to add a new event.
- Format:
application/json
postedBy
(string): Username of the poster.eventN
(string): Event name.link
(string): Link to the event.appS
(string): Application Starts.appE
(string): Application Ends.eventS
(string, optional): Event Starts.eventE
(string, optional): Event Ends.
authorization
(string): Authorization token. Requiredcategory
(string): Category of the event. Required
-
200 OK: Event added successfully.
- Content-Type:
application/json
success
(string): Success message.
- Content-Type:
-
400 Bad Request: Missing or invalid headers.
- Content-Type:
application/json
error
(string): Error message.
- Content-Type:
This endpoint is designed to handle the booking functionality. It verifies the authorization, creates an ICS event, sends emails to the relevant parties, and updates the booking slots in the database.
authorization
(string): Authorization token. Required
mentor
(string): Username of the mentor.start
(string): Start time of the event.end
(string): End time of the event.summary
(string): Summary of the event.description
(string): Description or details of the event.location
(string): Location of the event.enteredEmail
(string): Email provided during the booking process.date
(string): Date of the booking.startTime
(string): Start time of the booking slot.endTime
(string): End time of the booking slot.
- Status Code: 200
- Body:
success
(string): Success message, typically indicating the event name added.
-
Status Code: 400
- Body:
error
(string): "Authorization header missing"
- Body:
-
Status Code: 500
- Body:
error
(string): "Internal Server Error"
- Body:
- Verifies the presence of the authorization header.
- Decodes the token and retrieves the user details.
- Creates an ICS event based on the provided details.
- Prepares an email with the ICS event attached and sets it up to be sent to the user, mentor, and the provided email.
- Updates the booking slots in the database for the specified user and date.
- Commits the batch operations to the database.
- Firebase Admin: Used for database operations and authentication.
- Utility functions:
createICS
,to24HourFormat
for event creation and time formatting.
This endpoint is designed to handle the creation of chat sessions between two users. It ensures that both users have references to each other in their chat lists and initializes a greeting message in the chat.
authorization
(string): Authorization token. Required
user
(object):uid
(string): User ID of the first user.
user2
(string): User ID of the second user.combinedId
(string): Combined ID representing the chat session.
- Status Code: 200
- Body:
success
(string): "Auth Done"
- Status Code: 500
- Body:
error
(string): "Internal Server Error"
- Body:
- Verifies the authorization token and decodes it.
- Prepares references to both users' chat lists and individual user details.
- Checks if the first user already has a chat list. If so, the new chat reference is added. If not, a new chat list is created with the new chat reference.
- Repeats the same process for the second user.
- Initializes a greeting message ("Hello") in the chat session.
- Commits all the database operations in a batch.
- Firebase Admin: Used for database operations and authentication.
- Utility functions:
arrayPush
,serverTimestamp
for array operations and timestamp generation.
This endpoint is designed to handle the editing of events. It verifies the authorization, checks if the event already exists, and either creates a new event or edits the existing one. The endpoint also interacts with calendar events and Discord messages, either creating or editing them based on the provided data.
authorization
(string): Authorization token. Requiredcategory
(string): Category of the event. Requiredfirestoreid
(string): Firestore ID for the event. Required
postedBy
(string): Username of the poster.eventN
(string): Event name.link
(string): Link to the event.appS
(string): Application Starts.appE
(string): Application Ends.calID
(number): Calendar ID of the event. If0
, a new event will be created.discordMessageID
(number): Discord message ID. If0
, a new message will be sent.
- Status Code: 200
- Body:
success
(string): "Hack Updated"
- Status Code: 401
- Body:
error
(string): "UnAuthorized"
- Body:
- Verifies the authorization token and decodes it.
- Retrieves the user's social data.
- Checks if a calendar event already exists. If not, a new event is created. Otherwise, the existing event is edited.
- Checks if a Discord message already exists. If not, a new message is sent. Otherwise, the existing message is edited.
- Updates the Firestore with the new or edited event details.
- Sends a success response upon successful operation.
- Firebase Admin: Used for database operations and authentication.
- Utility functions:
addCalendarEvent
,editCalendarEvent
,sendMessage
,editMessage
for event and message operations.
This endpoint is designed to handle the voting and closing of items. It verifies the authorization, checks the type of operation (vote or close), and updates the database accordingly.
authorization
(string): Authorization token. Requiredfirestoreid
(string): Firestore ID for the item being voted or closed. Requiredcategory
(string): Category of the item. Required
type
(string): Type of operation - either "vote" or "close".username
(string): Username of the user performing the operation.
- Status Code: 200
- Body:
success
(string): "Authorization Success"
- Status Code: 200
- Body:
error
(string): "Authorization Failed"
- Body:
- Verifies the authorization token and decodes it.
- Retrieves the current data of the item from the database.
- If the operation type is "vote":
- Checks if the user has already voted.
- If not, increments the vote count and adds the user to the list of voters.
- If the operation type is "close":
- Checks if the user has already voted to close.
- If not, increments the close count and adds the user to the list of closers.
- If the close count reaches or exceeds 9, the item is moved to a "Closed" collection and deleted from the original collection.
- Sends a success response upon successful operation.
- Firebase Admin: Used for database operations and authentication.
- Utility function:
arrayPush
for array operations.
This endpoint is designed to verify the domain of a user's email against a list of university domains stored in Firestore. If a match is found, the user is marked as a mentor in the database.
authorization
(string): Authorization token. Required
- Status Code: 200
- Body:
success
(string): "ADDED"
- Status Code: 400
- Body:
error
(string): "Authorization header missing" or "No matching university domain found"
- Body:
- Status Code: 401
- Body:
error
(string): "Authorization Failed"
- Body:
- Checks for the presence of the authorization header.
- Verifies the authorization token and decodes it to extract the user's email.
- Extracts the domain from the user's email.
- Searches the Firestore for a university with a matching domain.
- If a match is found, the user is marked as a mentor in the database.
- Sends a success response if the user is marked as a mentor, or an error response if no matching university domain is found.
- Firebase Admin: Used for database operations and authentication.
- TypeScript: A superset of JavaScript that adds static types.
- React: A JavaScript library for building user interfaces.
- Next.js: A React framework for server-rendered applications.
- Firebase: A platform for web and mobile app development that provides cloud services, including authentication, databases, and more.
- GCP (Google Cloud Platform): A suite of cloud computing services that runs on the same infrastructure that Google uses internally for its end-user products.
- Firebase Cloud Storage: Object storage service for Firebase apps.
- Vercel Deployment: Platform for static sites and Serverless Functions.
- TailWindCSS: A utility-first CSS framework for rapidly building custom user interfaces.
- DaisyUI: A plugin for Tailwind CSS that adds new utilities, components, and a dark mode.
- HyeprUI: A UI library for modern web applications.
- Gmail API: Allows interaction with Gmail, enabling functionalities like sending emails, reading emails, and more.
- Discord API: Enables interaction with Discord, allowing functionalities like sending messages, managing servers, and more.
- Firebase Extensions: Pre-packaged solutions that help developers add common functionality to their apps quickly and safely.