Skip to content

Backend for the AI Interview Mentor platform. FastAPI server providing REST APIs for user authentication, resume upload, interview sessions, and analytics. All data is securely stored and managed in Palantir Foundry via Ontology SDK. Acts as a secure proxy for Palantir operations and keeps secrets off the frontend.

License

Notifications You must be signed in to change notification settings

manas-1404/aiinterview-backend

Repository files navigation

aiinterview-backend

This repository contains the backend server for the Palantir AI Interview Practice Platform. The backend is implemented using FastAPI and integrates deeply with Palantir Foundry to support various capabilities such as user authentication, resume upload and parsing, interview session management, practice plan workflows, and dashboard analytics.

Note: Access to Palantir Foundry (dev tier or higher) is required to run and develop this backend. Make sure you have the necessary Palantir credentials and project access.


Table of Contents


Overview

The backend provides RESTful APIs to manage users, interview sessions, resume data, practice plans, and dashboard analytics for the AI Interview platform. All user data, interview artifacts, and workflow states are stored and managed in Palantir Foundry, leveraging its ontology model and secure access.


Features

  • User Authentication: Secure JWT-based login and signup with role-based access controls.
  • Resume Upload and Parsing: Accepts resume details, stores them in Foundry, and validates input.
  • Interview Session Management: Handles the creation and retrieval of interview sessions, results, and recommendations from the Palantir Evaluation and Coach Agent.
  • Practice Plan Workflows: Coaches can approve/decline or edit practice plans and tasks; users can view and update their plans.
  • Dashboard Analytics: Aggregates and exposes combined results, session data, and progress metrics.
  • Caching Layer: Uses Redis for performance, caching dashboard and practice plan data per user.
  • Palantir Foundry Integration: All persistent data and operations are coordinated through Foundry's APIs and ontology objects.

Architecture

  • FastAPI application, modular routers for each resource.
  • Palantir Foundry as the System of Record: All user data, interview sessions, resumes, practice plans, and other artifacts are stored in Palantir Foundry. This ensures data privacy, auditability, and scalability using Palantir's secure infrastructure.
  • Ontology SDK: Communication with Palantir Foundry is performed exclusively via the RESTful APIs generated by Palantir Ontology SDK.
  • Backend Security: This backend is intentionally lightweight. It is primarily a secure proxy for API calls that interact with Palantir Foundry, protecting all Palantir secrets and credentials from exposure to the frontend or clients. No Palantir credentials are ever exposed to the browser or end user.
  • Redis: Used for caching user-specific data, dashboard and previous interview runs.
  • Environment-based configuration via .env file.

Demo

Dashboard

This page shows the dashboard of the Ai-Interviewer application. The dashboard metrics and information are computed using Palantir AIP Logic and automations.

Dashboard


Practice Plan & Previous Interviews

This page shows the practice plan and the practice tasks after the interview. All the information and tasks are generated with the help of Palantir AIP Agents, AIP Logic and automations.

Practice Plan and Tasks


Setup and Installation

Prerequisites

  • Python 3.10+
  • Palantir Dev Tier access (with API keys and project access)
  • Redis instance (cloud or local)
  • All credentials and configuration values for Palantir and Redis

Clone the Repository

git clone https://github.com/manas-1404/aiinterview-backend.git
cd aiinterview-backend

Install Dependencies

It's recommended to use a Python virtual environment:

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Environment Variables

Create a .env file in the root directory with the following keys (see utils/config.py for full list):

PALANTIR_API_KEY=your_palantir_api_key
INTERVIEWER_AGENT_RID=your_agent_rid
ONTOLOGY_RID=your_ontology_rid
PALANTIR_PROJECT_URL=https://your-palantir-instance-url
FOUNDRY_TOKEN=your_foundry_token
ALLOWED_ORIGINS=["http://localhost:3000"]
REDIS_CLOUD_URL=redis://your-redis-url
UPSTASH_REDIS_REST_URL=your_upstash_url
UPSTASH_REDIS_REST_TOKEN=your_upstash_token
OAUTHLIB_INSECURE_TRANSPORT=1
JWT_AUTH_ALGORITHM=HS256
JWT_SIGNATURE_SECRET_KEY=your_jwt_secret
JWT_TOKEN_EXPIRATION_MINUTES=60
JWT_REFRESH_TOKEN_EXPIRATION_DAYS=7

All variables are required for the backend to function.


Running the Server

Start the FastAPI application:

uvicorn main:app --reload

The server will initialize the Palantir Foundry client on startup. If credentials are invalid or missing, startup will fail.


API Endpoints

Authentication

  • POST /api/auth/login: User login. Returns JWT token and refresh cookie.
  • POST /api/auth/signup: User signup.

Resume Upload

  • POST /api/storage/send-data: Upload resume data (requires authentication).

Interview Sessions

  • GET /get-all-interview-sessions: Fetch all interview sessions and related analytics for the user.

Practice Plan

  • GET /get-all-practice-details: Retrieve the user's practice plan and tasks.
  • POST /review: Coach can review, approve, or decline practice plans/tasks.

Dashboard

  • GET /get-dashboard-data: Aggregate dashboard data for the authenticated user.

(See individual route modules for additional endpoints and details.)


Authentication

  • All protected endpoints require a JWT token in the Authorization: Bearer <token> header.
  • JWTs are generated on login and must be stored client-side.
  • Refresh tokens are managed via HTTP-only cookies.

Integration with Palantir Foundry

  • Data Storage: All user data, interview sessions, resumes, practice plans, and metrics are stored in Palantir Foundry. This ensures data security, privacy, and scalability.
  • Ontology SDK: The backend interacts with Foundry exclusively via the Palantir Ontology SDK, using typed ontology objects and queries for all read/write operations.
  • Backend as Secure Proxy: The backend acts as a minimal, secure proxy for all Foundry interactions. No Palantir secrets or credentials are ever exposed to the frontend or client applications; all sensitive operations are performed server-side.

Caching and Storage

  • Redis is used for caching user dashboard and practice plan data, keyed by user ID.
  • The cache is automatically refreshed and expires after a set period.

Contributing

  1. Fork this repository.
  2. Create a new branch (git checkout -b feature/your-feature).
  3. Commit your changes.
  4. Push to your branch.
  5. Create a Pull Request.

Notes

  • No production secrets or credentials should be committed.
  • This backend assumes you have the Palantir dev tier and all project resources set up.
  • If you encounter issues with authentication, double-check your .env and Palantir access. The FOUNDRY_TOKEN needs to be refreshed everyday to avoid connection errors.

License

This project is for personal use only! See LICENSE for details.

About

Backend for the AI Interview Mentor platform. FastAPI server providing REST APIs for user authentication, resume upload, interview sessions, and analytics. All data is securely stored and managed in Palantir Foundry via Ontology SDK. Acts as a secure proxy for Palantir operations and keeps secrets off the frontend.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages