This guide will walk you through setting up the KSSEM College ERP System on your computer. This application helps manage student information and provides a dashboard for students, faculty, and administrators.
| Landing Page | Portal Dashboard |
|---|---|
![]() |
![]() |
| Fee Management | Digital Classroom |
|---|---|
![]() |
![]() |
The KSSEM ERP follows a modern serverless architecture built on the Next.js and Firebase ecosystems.
Download the editable diagram at public/Assets/system_architecture.drawio.
Before you start, make sure you have the following:
- A Computer: Running Windows, macOS, or Linux.
- Internet Connection: To download software and connect to Firebase.
- A Web Browser: Such as Chrome, Firefox, Edge, or Safari.
- A Google Account: You'll need this to create a Firebase project, which acts as the backend for the app.
- An Email Account (for sending notifications): You'll need SMTP credentials from an email provider like Gmail (using an App Password), SendGrid, or another email service to send notifications.
- Patience: Setting up software can sometimes be tricky, but follow these steps carefully, and you'll get there!
- Firebase: Think of Firebase as the "brain" and "memory" for our application. It's a service provided by Google that will store user accounts, data (like student profiles, settings), and help with other background tasks.
- Node.js & npm: Node.js is an environment that lets the application code run on your computer.
npm(Node Package Manager) is a tool that comes with Node.js and helps install and manage the different "parts" or "packages" the application needs to work. - Terminal (or Command Prompt/PowerShell): This is a text-based window where you can type commands to tell your computer what to do. We'll provide the exact commands you need to type.
- On Windows: It's usually called "Command Prompt" or "PowerShell".
- On macOS or Linux: It's usually called "Terminal".
.env.localfile: A special file in your project where you store secret keys and configuration specific to your local setup (like your Firebase project details). This file is not shared publicly.- Service Account Key: A JSON file that gives server-side code (like our Next.js backend features) administrative access to your Firebase project. This is also kept secret.
- SMTP: Simple Mail Transfer Protocol. These are the credentials (host, port, user, password) your application needs to connect to an email server to send emails.
Follow these steps in order for a fresh setup.
Node.js is essential for running the application.
- Go to the official Node.js website: https://nodejs.org/
- Download the installer for the LTS (Long Term Support) version. It should be clearly marked on the homepage. Choose the version for your operating system (Windows, macOS).
- Once downloaded, run the installer. Follow the on-screen instructions, accepting the default options. This will install both Node.js and npm.
- Check if it's installed:
- Open your Terminal (or Command Prompt/PowerShell).
- Type
node -vand press Enter. You should see a version number likev18.x.xorv20.x.x. - Then, type
npm -vand press Enter. You should see another version number. - If you see version numbers for both, Node.js and npm are installed!
- If you received the application code as a ZIP file:
- Find the ZIP file on your computer.
- Extract its contents to a new folder. For example, you can create a folder named
StudentAppon your Desktop and extract the files there.
- If you received the application code as a folder:
- Simply ensure the folder is in a convenient location on your computer, like your Desktop or Documents folder. Let's assume you've named this folder
StudentApp.
- Simply ensure the folder is in a convenient location on your computer, like your Desktop or Documents folder. Let's assume you've named this folder
- You should have received a college logo image (e.g., from the project maintainer).
- Save this image file as
placeholder-logo.svginside thepublicfolder within yourStudentAppdirectory.- The
StudentAppfolder is the main folder containing all the application code. - Inside
StudentApp, you'll find a folder namedpublic. - Place your
placeholder-logo.svgfile directly into thispublicfolder. - The final path should look something like:
StudentApp/public/placeholder-logo.svg.
- The
You need to tell your Terminal to work "inside" the application folder.
- Open your Terminal (or Command Prompt/PowerShell) as described in Step 1.
- Type
cd(that'sc,d, then a space). - Drag the
StudentAppfolder (or whatever you named it) from your computer's file explorer (like Windows Explorer or macOS Finder) directly into the Terminal window. This should paste the full path to the folder aftercd. - Press Enter. Your Terminal prompt should change, indicating you are now "in" that folder.
The application relies on several pre-built code packages. npm will download and install them.
- Make sure your Terminal is still in the
StudentAppfolder (from Step 4). - Type the following command exactly and press Enter:
npm install
- This step might take a few minutes. Wait for it to complete.
Firebase will be the backend for your application.
- Go to the Firebase website: https://console.firebase.google.com/
- Sign in with your Google Account.
- Click on "Add project" or "Create a project".
- Project Name: Give your project a name (e.g.,
MyStudentAppFirebase). - Google Analytics: You can choose to disable Google Analytics for this Firebase project if you wish (toggle the switch off or choose "Not now"). Click Continue.
- Click Create project. Wait for Firebase to create your project.
Tell Firebase that a web application will be connecting to it.
- On your Firebase project's "Project Overview" page, look for an icon that looks like
</>(Web). Click this icon. - App nickname: Give your web app a nickname (e.g.,
StudentAppWeb). - Firebase Hosting: Uncheck the box for "Also set up Firebase Hosting for this app."
- Click Register app.
- Add Firebase SDK: Firebase will show you configuration values (your
firebaseConfig). COPY THESE VALUES CAREFULLY! You'll need them for the.env.localfile. - After copying, click Continue to console.
Your local application needs to know how to connect to your Firebase project and other services.
-
In your
StudentAppfolder, create a file named.env.local.-
Open a simple text editor.
-
Copy and paste the following template into the new file:
# Firebase Client Configuration - REQUIRED # Get these from: Firebase Console > Project Settings > General > Your apps > Web app > SDK setup and configuration NEXT_PUBLIC_FIREBASE_API_KEY= NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN= NEXT_PUBLIC_FIREBASE_PROJECT_ID= NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET= NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID= NEXT_PUBLIC_FIREBASE_APP_ID= # NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID= # Optional, only if you enabled Google Analytics for Firebase # Google Analytics 4 (GA4) Configuration - OPTIONAL # Get this from your GA4 Property > Data Streams > Web Stream Details # NEXT_PUBLIC_GA_MEASUREMENT_ID= # Genkit AI Features API Key - REQUIRED for AI features # Get this from Google AI Studio: https://aistudio.google.com/app/apikey # For Vercel, also set this in Project Settings > Environment Variables. GOOGLE_GENAI_API_KEY= # Email Notification (SMTP) Credentials - REQUIRED for sending emails # Get these from your email provider (e.g., Gmail App Password, SendGrid, etc.) # For Vercel, also set these in Project Settings > Environment Variables. SMTP_HOST= SMTP_PORT= SMTP_USER= SMTP_PASS= SMTP_FROM_ADDRESS= # Firebase Admin SDK (Server-Side) - REQUIRED (Use one method below) # For Vercel, set this in Project Settings > Environment Variables. # For local development, this is the recommended way. # This should be the Base64 encoded string of your service account JSON file. # See Step 9 for how to generate this. GOOGLE_APPLICATION_CREDENTIALS_B64= # DEPRECATED: Raw JSON string (less reliable, use Base64 above) # GOOGLE_APPLICATION_CREDENTIALS_JSON=
-
-
Fill in the values:
- Replace the empty values after each variable with the keys and credentials you obtained.
- For
GOOGLE_APPLICATION_CREDENTIALS_B64, you will generate the Base64 string in the next step.
-
Save the
.env.localfile in the root of yourStudentAppfolder.
For server-side features (like some advanced data operations or Genkit flows that interact with Firebase Admin), the application needs admin credentials. We will use a Base64 encoded string which is more reliable.
-
Generate a Service Account Key:
- In the Firebase console, go to your Project Settings (click the gear icon near "Project Overview").
- Go to the Service accounts tab.
- Click on Generate new private key. Confirm by clicking Generate key.
- A JSON file will be downloaded. Keep this file secure; it grants admin access. Save it somewhere safe on your computer.
-
Convert the JSON key to Base64:
- You can use a simple online tool or a local command to do this.
- Online Tool (Simple): Go to https://www.base64encode.net/.
- Select "Encode files into Base64 format".
- Click the box to upload your downloaded JSON file.
- Click the "ENCODE" button.
- Copy the resulting long string of text from the output box.
- Local Command (Advanced): Open your terminal.
- On macOS/Linux:
base64 -w 0 /path/to/your/downloaded-key.json - On Windows (PowerShell):
[Convert]::ToBase64String([IO.File]::ReadAllBytes("/path/to/your/downloaded-key.json")) - Replace
/path/to/your/downloaded-key.jsonwith the actual path to your file. Copy the output.
- On macOS/Linux:
-
Provide Credentials to the App:
- Go back to your
.env.localfile. - Paste the entire Base64 string you copied as the value for
GOOGLE_APPLICATION_CREDENTIALS_B64. - For Vercel Deployment: When deploying, you must also copy this variable and its full Base64 value into your Vercel project's Environment Variables settings.
- Go back to your
- In the Firebase console, under Build, click Authentication.
- Click Get started.
- Select Email/Password from the sign-in providers.
- Toggle Enable to ON. Click Save.
- In the Firebase console, under Build, click Firestore Database.
- Click Create database.
- Choose Start in production mode. Click Next.
- Select a Cloud Firestore location. This cannot be changed later. Click Enable.
- Open your Terminal. Type:
(On macOS/Linux, you might need
npm install -g firebase-tools
sudo npm install -g firebase-tools. On Windows, run Command Prompt as Administrator.)
- In the Terminal, type:
firebase login
- Follow prompts to sign in with the Google Account used for your Firebase project.
- Ensure your Terminal is "inside" your
StudentAppfolder. Type:firebase use --add
- Use arrow keys to select your Firebase project. Press Enter.
- For "alias," press Enter (or type a short name like
studentapp). This creates/updates a.firebasercfile.
- In your Terminal (still in
StudentAppfolder), type:firebase deploy --only firestore:rules
- Wait for "Deploy complete!"
- Go to Google Analytics.
- Create an Account and a new Google Analytics 4 Property.
- Property name: e.g., "Student ERP GA4".
- Set time zone and currency.
- Set up a Data Stream: Choose Web.
- Website URL:
http://localhost:9002(or your local dev port). - Stream name: e.g., "Student ERP Web Stream".
- Click Create stream.
- Website URL:
- Find your MEASUREMENT ID (starts with "G-", e.g.,
G-XXXXXXXXXX). Copy it. - Open your
.env.localfile. Find the line:Uncomment it and paste your Measurement ID after the# NEXT_PUBLIC_GA_MEASUREMENT_ID==. Save the file. - Restart your app if it's running.
The dev server supports HTTPS via locally-trusted certificates. This is useful if your browser blocks Firebase requests over plain HTTP (e.g., Brave with Shields enabled).
-
Install
mkcert(generates trusted local certificates):- Windows (Scoop):
scoop install mkcert - Windows (Chocolatey, run as Admin):
choco install mkcert -y - macOS:
brew install mkcert - Linux:
sudo apt install mkcert(or see mkcert docs)
- Windows (Scoop):
-
Install the root certificate authority (run once, may need Admin/sudo):
mkcert -install
-
That's it! The
npm run devscript includes--experimental-https, which will auto-generate certificates in acertificates/folder usingmkcert. Your app will be available athttps://localhost:9002.
Note: The
certificates/directory is already in.gitignoreand should never be committed. Each developer generates their own local certificates.
- In your Terminal (in
StudentAppfolder), type:npm run dev
- Open your web browser to the address shown (e.g.,
https://localhost:9002if HTTPS is set up, orhttp://localhost:9002).
- In the app, click Sign Up.
- Full Name: "Admin User"
- Student ID: "admin001"
- Major: "Administration"
- Email: use the email address you want for the first administrator
- Password: Choose a strong password.
- Parent's Email:
parent@example.com(dummy)
- Click Sign Up.
- Go to the Firebase console > Authentication. Copy the User UID for the administrator account you just created.
- Go to Firestore Database. Click the
userscollection. - Find the document whose ID matches the User UID. Click it.
- On the right, find/add the field
role.- If
roleexists, click the pencil icon, change its value fromstudenttoadmin. Click Update. - If
roledoes not exist: Click + Add field. Field name:role, Type:string, Value:admin. Click Add.
- If
- That user is now an admin.
- Go back to your app. Logout if logged in.
- Sign in with the administrator email and password.
- You should see the Admin Dashboard or admin features.
- If using Brave browser and HTTPS is not set up, you may need to disable Brave Shields for localhost.
Congratulations! Initial setup is complete.
If you need to switch the application to a different Firebase project (e.g., from a test project to a production project), follow these steps:
- Create the New Firebase Project (if not done):
- Follow Step 6 from the "Initial Setup Guide" to create your new Firebase project.
- Add a Web App to the New Project:
- Follow Step 7 to add a web app configuration to your new Firebase project. Critically, copy the new
firebaseConfigvalues.
- Follow Step 7 to add a web app configuration to your new Firebase project. Critically, copy the new
- Update Client-Side Configuration (
.env.local):- Open your existing
.env.localfile. - Carefully replace the values for
NEXT_PUBLIC_FIREBASE_API_KEY,NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,NEXT_PUBLIC_FIREBASE_PROJECT_ID, etc., with the new configuration values obtained from your new Firebase project (from step 2 above). - Save the
.env.localfile.
- Open your existing
- Update Server-Side Admin Configuration (Service Account):
- Go to your new Firebase project in the Firebase console.
- Follow Step 9 to generate a new Base64-encoded service account key string for this new project.
- Update your
GOOGLE_APPLICATION_CREDENTIALS_B64environment variable with this new string.- For Vercel: Update this in your Vercel project's Environment Variables settings.
- For local development: Update the
GOOGLE_APPLICATION_CREDENTIALS_B64in your.env.local.
- Update Firebase CLI Association:
- Open your Terminal in the
StudentAppfolder. - Run:
firebase use --add - Select your new Firebase project from the list and give it an alias (or use
default). This updates your.firebasercfile to point the Firebase CLI to the new project for this local directory.
- Open your Terminal in the
- Enable Authentication Methods in New Project:
- In your new Firebase project's console, go to Authentication > Sign-in method.
- Ensure Email/Password (and any other providers you use) are enabled. (Similar to Step 10).
- Set Up Firestore in New Project:
- In your new Firebase project's console, go to Firestore Database.
- Click Create database, choose production mode, and select a location. (Similar to Step 11).
- Deploy Firestore Rules to New Project:
- In your Terminal (in
StudentAppfolder, now associated with the new project), run:firebase deploy --only firestore:rules
- If you have custom indexes, also deploy them:
firebase deploy --only firestore:indexes
- In your Terminal (in
- Recreate Admin User (if necessary):
- The users from your old Firebase project will not automatically be in the new one.
- You will likely need to sign up an administrator account again in the application (which now points to the new project) and then manually set its role to
adminin the new project's Firestore database (as described in Steps 18 & 19).
- Check Other API Keys:
- Update any other keys in your
.env.localfile (likeGOOGLE_GENAI_API_KEYorSMTP_...credentials) if they are tied to the old project or need to be different for the new environment.
- Update any other keys in your
- Restart Your Application:
- Stop your local development server (Ctrl+C) and restart it (
npm run dev). - If deployed on Vercel, you'll need to redeploy for environment variable changes to take full effect.
- Stop your local development server (Ctrl+C) and restart it (
After these steps, your application should be connected to the new Firebase project.
The backend has been upgraded with a GraphQL API.
- Endpoint:
/api/graphql - Schema: Defined in
schema.graphqlat the project root. - Resolvers: Route handlers at
src/app/api/graphql/resolvers.tsconnect GraphQL queries/mutations to existing services. - Client: A lightweight
graphql-requestclient is available atsrc/lib/graphql-client.tsto call the endpoint from frontend pages.
Include the Firebase ID Token in the Authorization header as a Bearer token:
Authorization: Bearer <firebase_id_token>This project is licensed under the GNU General Public License v3.0.



