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
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 using sample.env
as a template:
The default values in sample.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:
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:
http://localhost:3000/
http://localhost:3000/
and you'll be logged in automatically without email confirmationNote: 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:
npm run install:all
npm run deploy
For detailed instructions, refer to the CONTRIBUTING.md file in the repository.
This project is licensed under the MIT License.