Marvel AI is an open-source project by Reality AI, designed to provide smart tools and chatbots to assist teachers in education. The platform leverages Firebase, Next.js, and various AI components to create a seamless learning experience.
The "Marvel" platform is structured into two main components: Firebase and AI. The Firebase side, detailed in this repository, encompasses both the frontend, developed with NextJS and hosted on Firebase Hosting, and the backend, which includes user management and session handling via Firebase Functions like signUpUser
and createChatSession
. The communicator
function acts as a proxy for chat interactions between the Firebase infrastructure and the AI services. Tool requests (like "Quizify" and "YouTube Flashcard Generator") are sent directly from the frontend to the AI endpoints. Firestore DB is utilized for data storage. The AI endpoints are housed in a separate repository, including a chatbot and tools like "Quizify" and "Flashcard Generator."
-
/
: Standard firebase project structure, having frontend, NEXTJS files in the root and backend in the functions folder. -
/functions
: Houses the Firebase Functions, which are serverless functions responsible for backend processes such as AI chatbot and user signup. Any operation which is sensitive or compute intensive or background tasks should be placed in functions.
-
firebase.json
: Contains configuration settings for Firebase services such as hosting and rules. -
firestore.indexes.json
: Manages custom indexing for Firestore to optimize query performance. -
firestore.rules
: Security rules for Firestore database, defining read/write permissions. -
package.json
&package-lock.json
: Defines the project’s frontend dependencies
- Node.js (v18 or later)
- Firebase CLI (v9.10.0 or later)
- Google Firebase Account
To set up the project, follow these steps:
-
Clone the repository:
git clone https://github.com/marvelai-org/marvel-platform
-
Create your firebase project on google firebase console
-
Create a firestore database instance
-
Get firebase config from firebase project settings in firebase console
-
Create a
.env
file in the root of the project usingsample.env
as a template: The default values insample.env
are configured to connect to the production MarvelAI server (app.marvelai.app). You can keep these values if you want to use the production firebase backend (Firestore and Functions), or update them to point to your own firebase project. -
Install Firebase CLI by running the following in terminal:
npm install -g firebase-tools
-
Login to firebase CLI by running the following command:
firebase login
-
Install all dependencies by running:
npm run install:all
You have two options to run the development environment:
npm run dev
This will start the frontend on localhost:3000 and connect to your deployed Firebase backend (Functions and Firestore). Use this option when you want to:
- Test frontend changes against the production backend
- Don't need to modify backend functionality
npm run dev:all
This starts both the frontend and Firebase emulators locally, providing a completely isolated development environment. Use this option when you want to:
- Test full-stack changes locally
- Develop and test Firebase Functions
- Work with a seeded local Firestore database
- Avoid affecting production data
- Once the development server is running, visit:
http://localhost:3000/
- Register a new account using the signup form
- You'll be taken to a confirmation page
- In development mode, you can simply return to
http://localhost:3000/
and you'll be logged in automatically without email confirmation
Note: If you experience any issues with hanging emulator processes after stopping the development server, you can clean them up by running:
npm run kill-emulators
Before deploying, ensure you have the correct Firebase project setup:
- Login to Firebase if you haven't already:
firebase login
- List your Firebase projects to verify you're on the correct one:
firebase projects:list
- If needed, select the correct project:
firebase use <project-id>
Once your Firebase project is properly configured:
- Install all dependencies:
npm run install:all
- Deploy the project (frontend and functions):
npm run deploy
- Fork the Repository: Create a personal fork of the repository to work on.
- Create a Branch: For each new feature or bug fix, create a new branch from the develop branch.
- Implement Changes: Make your changes, ensuring they adhere to the project’s coding standards.
- Commit Changes: Commit your changes with clear, descriptive messages.
- Push to Your Fork: Push your changes to your forked repository.
- Open a Pull Request: Navigate to the original repository and open a pull request from your branch to the develop branch.
- Code Review: Engage in the code review process, addressing any feedback provided.
- Merge: Once approved, your changes will be merged into the develop branch.
For detailed instructions, refer to the CONTRIBUTING.md file in the repository.
This project is licensed under the MIT License.