# Project export: racingSpartan

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: CruzHacks 2024
- Tagline: Do you experience a tough time understanding assigned readings by your teacher? The racingSpartan is aimed to help students use Vectara's AI to help students better understand assigned articles
- Devpost: https://devpost.com/software/racingspartan
- GitHub: https://github.com/shubmi02/racingSpartan
- Team: 2 GitHub contributor(s) — Pajay1234 (6 commits), Shubham Mishra (3 commits)

## Devpost submission (written by the team)

### Inspiration

Our inspiration for making this web application was continuously failing to do well in comprehending articles that were written in tough English.

### What it does

Our tool takes an article that a teacher would upload onto our site and allow students to highlight snippets they don't understand and get a summary through the API calls of Vectara

### How we built it

We built it with a ReactJS frontend and an ExpressJS backend, and host it locally on our machines. We hold user data in a MongoDB Atlas Database.

### Challenges we ran into

We ran into challenges of trying to deploy in Cloudflare pages. We ended up dropping this idea since we were only able to run the frontend in Cloudflare and were unable to figure out how to get the worker to host the backend of the full stack project.

### Accomplishments we're proud of

We are proud of being able to incorporate a Generative AI into our project and in addition using our first hackathon as an opportunity to try technologies outside of our comfort zone

### What we learned

We learned to try to make a bare minimum number of specifications that could be achievable. At first we were overambitious and as a result we spent a lot of time in trying to setup our environment rather than trying to perfect features.

### What's next

Our next step is to provide a more available project by hosting in a cloud environment and in addition developing separate portals for student and teacher roles.

## README (from the GitHub repository)

No README available.

## Detected evidence (automated analysis)

Indexed codebase: 15 recognized source files, 10 KB.
- CSS (language) — detected in the code
- Express (technology) — detected in the code
- HTML (language) — detected in the code
- JavaScript (language) — detected in the code
- React (technology) — detected in the code
- MongoDB (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (23 of 23)

```
.vscode/settings.json
back-end/app.js
back-end/package.json
back-end/Procfile
back-end/public/index.html
back-end/public/script.js
back-end/public/styles.css
front-end/.gitignore
front-end/package.json
front-end/public/index.html
front-end/public/manifest.json
front-end/public/robots.txt
front-end/README.md
front-end/src/App.css
front-end/src/App.js
front-end/src/App.test.js
front-end/src/index.css
front-end/src/index.js
front-end/src/reportWebVitals.js
front-end/src/setupTests.js
package.json
README.md
test.js
```

### Dependencies

- back-end/package.json: express@^4.18.2
- front-end/package.json: @babel/plugin-proposal-private-property-in-object@^7.21.11, @testing-library/jest-dom@^5.17.0, @testing-library/react@^13.4.0, @testing-library/user-event@^13.5.0, axios@^1.6.5, react@^18.2.0, react-dom@^18.2.0, react-router-dom@^6.21.3, react-scripts@^5.0.1, web-vitals@^2.1.4
- package.json: @babel/plugin-proposal-private-property-in-object@^7.21.11, axios@^1.6.5, concurrently@^8.2.2, dotenv@^16.3.2, react-scripts@^5.0.1

### Recent commits (newest first)

- initial master commit
- deploy heroku
- merged shub's dream
- install updated
- CI=False
- updated app.js
- testing
- revert to before cloudflare frustration
- CI=false
- updated build try4
- added babel
- updated build try3
- update build try 2
- updated dependencies
- build directory added
- adding build
- Update package.json
- Update package.json
- Merge branch 'main' of https://github.com/shubmi02/racingSpartan
- update app.js

## Key source files (fetched from GitHub, selected and truncated for size)

### package.json

```
{
  "name": "full-stack-app",
  "version": "1.0.0",
  "scripts": {
      "start": "concurrently \"npm run start:frontend\" \"npm run start:backend\"",
      "start:frontend": "cd front-end && npm start",
      "start:backend": "cd back-end && npm start"
  },
  "dependencies": {
    "axios": "^1.6.5",
    "concurrently": "^8.2.2",
    "dotenv": "^16.3.2",
    "react-scripts": "^5.0.1"
  },
  "devDependencies": {
    "@babel/plugin-proposal-private-property-in-object": "^7.21.11"
  }
}

```

### back-end/package.json

```
{
  "name": "back-end",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.18.2"
  }
}

```

### front-end/package.json

```
{
  "name": "front-end",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.17.0",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "axios": "^1.6.5",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "^6.21.3",
    "react-scripts": "^5.0.1",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@babel/plugin-proposal-private-property-in-object": "^7.21.11"
  }
}

```

### back-end/app.js

```javascript
// create an express app
const express = require("express")
const app = express()

// use the express-static middleware
app.use(express.static("public"))

// define the first route
app.get("/", function (req, res) {
  res.send("<h1>Hello World!</h1>")
})

// start the server listening for requests
app.listen(process.env.PORT || 3000, 
	() => console.log("Server is running..."));
```

### front-end/src/index.js

```javascript
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

```

### front-end/src/App.js

```javascript
import logo from './logo.svg';
import axios from 'axios';
import './App.css';
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';


function App() {
  async function testGet(e) {
    e.preventDefault();
    let response = await axios.post('http://localhost:5000/api/test');
    console.log(response.data);
  }

  return (
    <div className="App">
       <button onClick={async (e)=> await testGet(e)}>cock</button>
      <BrowserRouter>
        <Routes>
          <Route path="/" element={<Navigate to="/homepage" />} />
          {/* <Route path="/homepage" element={<SquishList />} /> */}
        </Routes>
      </BrowserRouter>
    </div>
  );
}

export default App;
```

### front-end/src/setupTests.js

```javascript
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

```

### front-end/src/App.test.js

```javascript
import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
  render(<App />);
  const linkElement = screen.getByText(/learn react/i);
  expect(linkElement).toBeInTheDocument();
});

```

### back-end/public/styles.css

```css
h1 {
	font-family: 'Alegreya' ;
}

body {
	font-family: 'Source Sans Pro' ;
	width: 50%;
	margin-left: 25%;
	text-align: justify;
	line-height: 1.7;
	font-size: 18px;
}

input {
	font-size: 18px;
	text-align: center;
}

button {
	font-size: 18px;
	color: #fff;
}

#generate {
	background-color: #09f;
}

#copy {
	background-color: #0c6;
}

```

### front-end/src/reportWebVitals.js

```javascript
const reportWebVitals = onPerfEntry => {
  if (onPerfEntry && onPerfEntry instanceof Function) {
    import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
      getCLS(onPerfEntry);
      getFID(onPerfEntry);
      getFCP(onPerfEntry);
      getLCP(onPerfEntry);
      getTTFB(onPerfEntry);
    });
  }
};

export default reportWebVitals;

```

[5 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]