{"info":{"_postman_id":"2672f56c-569b-475d-8b61-3c57ffdc7c91","name":"CodeShastra","description":"<html><head></head><body><p>StartFragment</p>\n<p>The CodeShastra REST API powers a full-stack EdTech platform designed to bridge the gap between academic learning and real-world software engineering. It provides endpoints for user authentication, profile management, a project and challenge catalog, course/lab browsing, and a live server-side code execution engine.</p>\n<p><strong>Base URL:</strong>&nbsp;<code>http://localhost:5000</code></p>\n<p><strong>Authentication:</strong>&nbsp;Protected routes require a Bearer token passed in the&nbsp;<code>Authorization</code>&nbsp;header. Obtain your token by logging in via&nbsp;<code>POST /api/auth/login</code>. Admin-restricted routes additionally require the authenticated user to have the&nbsp;<code>admin</code>&nbsp;role.</p>\n<p><strong>Tech Stack:</strong>&nbsp;Node.js, Express.js, MongoDB (Mongoose), JWT, bcrypt, Node child_process (sandboxed code execution).</p>\n<p>EndFragment</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"50841552","collectionId":"2672f56c-569b-475d-8b61-3c57ffdc7c91","publishedId":"2sBXqKofJu","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2026-05-02T16:02:33.000Z"},"item":[{"name":"register user","id":"29f6024e-db47-4e4c-9ca6-3b220e1c3bc3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n  \"name\": \"John Doe\",\r\n  \"email\": \"john@example.com\",\r\n  \"password\": \"password123\"\r\n}\r\n","options":{"raw":{"language":"json"}}},"url":"http://localhost:5000/api/auth/register","description":"<p>StartFragmentCreates a new user account. Accepts name, email, and password. Returns the user object with a JWT token.EndFragment</p>\n","urlObject":{"protocol":"http","port":"5000","path":["api","auth","register"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"29f6024e-db47-4e4c-9ca6-3b220e1c3bc3"},{"name":"login user","id":"696ba82d-a267-42d9-a63d-f690522850d1","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n  \"email\": \"john@example.com\",\r\n  \"password\": \"password123\"\r\n}\r\n","options":{"raw":{"language":"json"}}},"url":"http://localhost:5000/api/auth/login","description":"<p>StartFragmentAuthenticates an existing user. Returns user details and a JWT token to use in protected routes.EndFragment</p>\n","urlObject":{"protocol":"http","port":"5000","path":["api","auth","login"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"696ba82d-a267-42d9-a63d-f690522850d1"},{"name":"get current user","id":"a23e6878-d85d-4d04-8761-ed99fa81a1de","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"bearer","value":"","type":"text"}],"url":"http://localhost:5000/api/auth/me","description":"<p>StartFragmentReturns the currently authenticated user's profile. Requires a valid Bearer token.EndFragment</p>\n","urlObject":{"protocol":"http","port":"5000","path":["api","auth","me"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"a23e6878-d85d-4d04-8761-ed99fa81a1de"},{"name":"change password","id":"d3a1b98d-7947-419f-8248-f53bca138b0b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n  \"currentPassword\": \"password123\",\r\n  \"newPassword\": \"newpassword456\"\r\n}\r\n","options":{"raw":{"language":"json"}}},"url":"http://localhost:5000/api/auth/change-password","description":"<p>StartFragmentUpdates the authenticated user's password. Requires the current password for verification.EndFragment</p>\n","urlObject":{"protocol":"http","port":"5000","path":["api","auth","change-password"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"d3a1b98d-7947-419f-8248-f53bca138b0b"},{"name":"get leaderboard","id":"730e88b3-0eb9-4f8e-b407-15256cd5d003","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/api/users/leaderboard","description":"<p>StartFragmentReturns all users sorted by XP in descending order for the global leaderboard.EndFragment</p>\n","urlObject":{"protocol":"http","port":"5000","path":["api","users","leaderboard"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"730e88b3-0eb9-4f8e-b407-15256cd5d003"},{"name":"update profile","id":"3b4c5115-afb6-4abd-923b-58197331de1f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n  \"bio\": \"Full-stack developer from NY\",\r\n  \"github\": \"https://github.com/johndoe\",\r\n  \"location\": \"New York, USA\"\r\n}\r\n","options":{"raw":{"language":"json"}}},"url":"http://localhost:5000/api/users/profile","description":"<p>StartFragmentUpdates the authenticated user's profile fields such as bio, location, github, and specialization.EndFragment</p>\n","urlObject":{"protocol":"http","port":"5000","path":["api","users","profile"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"3b4c5115-afb6-4abd-923b-58197331de1f"},{"name":"delete account","id":"b1538cbe-2670-442c-8ec3-6c1551580f8a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"url":"http://localhost:5000/api/users/account","description":"<p>StartFragmentPermanently deletes the authenticated user's account and all associated data. Irreversible.EndFragment</p>\n","urlObject":{"protocol":"http","port":"5000","path":["api","users","account"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"b1538cbe-2670-442c-8ec3-6c1551580f8a"},{"name":"get all projects","id":"00e870ff-0761-4a6e-81f6-a6ac27d533c6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/api/projects","description":"<p>StartFragmentReturns the full list of all available projects in the catalog.EndFragment</p>\n","urlObject":{"protocol":"http","port":"5000","path":["api","projects"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"00e870ff-0761-4a6e-81f6-a6ac27d533c6"},{"name":"get single project","id":"0bffd5ab-f10b-45e0-bb8e-c4ae4b47d7ca","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"description":"<p>StartFragmentReturns the details of a single project by its MongoDB ID.EndFragment</p>\n","urlObject":{"query":[],"variable":[]},"url":""},"response":[],"_postman_id":"0bffd5ab-f10b-45e0-bb8e-c4ae4b47d7ca"},{"name":"create project","id":"23249fed-1244-46f9-8f2a-aecc86d68738","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY5ZjYxNjE1ZGRmOTIwMDc4OThkOTZkMCIsImlhdCI6MTc3NzczNTE4OSwiZXhwIjoxNzgwMzI3MTg5fQ.r4BdAcwOkpzNkVoqkiNvrDdL6o2u69hOBxMn61ozjjw","type":"text"}],"body":{"mode":"raw","raw":"{\r\n  \"title\": \"React Dashboard\",\r\n  \"description\": \"Build a responsive dashboard using React and Tailwind.\",\r\n  \"difficulty\": \"MID-LEVEL\",\r\n  \"tech\": \"React, Tailwind, Vite\"\r\n}\r\n\r\n","options":{"raw":{"language":"json"}}},"url":"http://localhost:5000/api/projects","description":"<p>StartFragmentCreates a new project. Admin access required. Accepts title, description, difficulty (JUNIOR / MID-LEVEL / SENIOR), and tech.EndFragment</p>\n","urlObject":{"protocol":"http","port":"5000","path":["api","projects"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"23249fed-1244-46f9-8f2a-aecc86d68738"},{"name":"get all challenges","id":"1ece6008-d8a7-4ab5-be17-9c7893e5066b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/api/challenges","description":"<p>StartFragmentReturns the full list of all available coding challenges.EndFragment</p>\n","urlObject":{"protocol":"http","port":"5000","path":["api","challenges"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"1ece6008-d8a7-4ab5-be17-9c7893e5066b"},{"name":"get a single challenge","id":"5fb00541-1ada-4790-9f53-80ef91fedc9a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/api/challenges/64f1a2b3c4d5e6f7a8b9c0d2","description":"<p>StartFragmentReturns the details of a single challenge by its MongoDB ID.EndFragment</p>\n","urlObject":{"protocol":"http","port":"5000","path":["api","challenges","64f1a2b3c4d5e6f7a8b9c0d2"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"5fb00541-1ada-4790-9f53-80ef91fedc9a"},{"name":"create challenge","id":"382df6c0-eee5-44d9-86f0-912f229afb95","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY5ZjYxNjE1ZGRmOTIwMDc4OThkOTZkMCIsImlhdCI6MTc3NzczNTE4OSwiZXhwIjoxNzgwMzI3MTg5fQ.r4BdAcwOkpzNkVoqkiNvrDdL6o2u69hOBxMn61ozjjw","type":"text"}],"body":{"mode":"raw","raw":"{\r\n  \"title\": \"Two Sum\",\r\n  \"description\": \"Given an array of integers, return indices of the two numbers.\",\r\n  \"difficulty\": \"EASY\",\r\n  \"xp\": 50,\r\n  \"track\": \"Algorithms\",\r\n  \"iconType\": \"FaCode\",\r\n  \"iconBg\": \"bg-green-100\"\r\n}\r\n\r\n\r\n","options":{"raw":{"language":"json"}}},"url":"http://localhost:5000/api/challenges","urlObject":{"protocol":"http","port":"5000","path":["api","challenges"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"382df6c0-eee5-44d9-86f0-912f229afb95"},{"name":"run code without submitting","id":"6289c16a-5830-49fb-9e92-f294d0402282","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY5ZjYxNjE1ZGRmOTIwMDc4OThkOTZkMCIsImlhdCI6MTc3NzczNTE4OSwiZXhwIjoxNzgwMzI3MTg5fQ.r4BdAcwOkpzNkVoqkiNvrDdL6o2u69hOBxMn61ozjjw","type":"text"}],"body":{"mode":"raw","raw":"{\r\n  \"language\": \"javascript\",\r\n  \"sourceCode\": \"console.log('Hello World');\"\r\n}\r\n","options":{"raw":{"language":"json"}}},"url":"http://localhost:5000/api/submissions/run","description":"<p>StartFragmentCreates a new coding challenge. Admin access required. Accepts title, description, difficulty (EASY / MEDIUM / HARD), xp, track, iconType, and iconBg.EndFragment</p>\n","urlObject":{"protocol":"http","port":"5000","path":["api","submissions","run"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"6289c16a-5830-49fb-9e92-f294d0402282"},{"name":"submit code for challenge evaluation","id":"676842e7-064b-4122-8e22-7a99b86cb99b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY5ZjYxNjE1ZGRmOTIwMDc4OThkOTZkMCIsImlhdCI6MTc3NzczNTE4OSwiZXhwIjoxNzgwMzI3MTg5fQ.r4BdAcwOkpzNkVoqkiNvrDdL6o2u69hOBxMn61ozjjw","type":"text"}],"body":{"mode":"raw","raw":"{\r\n  \"challengeId\": \"69f61bb2201ec7b646bfda1e\",\r\n  \"language\": \"javascript\",\r\n  \"sourceCode\": \"function twoSum(nums, target) { return [0, 1]; }\"\r\n}\r\n","options":{"raw":{"language":"json"}}},"url":"http://localhost:5000/api/submissions/submit","description":"<p>StartFragmentExecutes the provided source code in a sandboxed environment without saving results. Accepts language and sourceCode.EndFragment</p>\n","urlObject":{"protocol":"http","port":"5000","path":["api","submissions","submit"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"676842e7-064b-4122-8e22-7a99b86cb99b"}]}